Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ContainerLayerComposite.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <algorithm> // for min
|
|
|
|
#include "FrameMetrics.h" // for FrameMetrics
|
|
|
|
#include "Units.h" // for LayerRect, LayerPixel, etc
|
|
|
|
#include "gfx2DGlue.h" // for ToMatrix4x4
|
|
|
|
#include "gfx3DMatrix.h" // for gfx3DMatrix
|
|
|
|
#include "gfxImageSurface.h" // for gfxImageSurface
|
2014-02-26 18:53:27 -08:00
|
|
|
#include "gfxPrefs.h" // for gfxPrefs
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "gfxUtils.h" // for gfxUtils, etc
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
|
|
|
#include "mozilla/gfx/BaseRect.h" // for BaseRect
|
|
|
|
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
|
|
|
#include "mozilla/gfx/Point.h" // for Point, IntPoint
|
|
|
|
#include "mozilla/gfx/Rect.h" // for IntRect, Rect
|
|
|
|
#include "mozilla/layers/Compositor.h" // for Compositor, etc
|
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_CONTAINER
|
|
|
|
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
|
|
|
|
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsDebug.h" // for NS_ASSERTION
|
2014-02-26 13:36:35 -08:00
|
|
|
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
|
|
|
|
#include "nsPoint.h" // for nsIntPoint
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
|
|
|
#include "nsTArray.h" // for nsAutoTArray
|
2014-03-11 19:27:33 -07:00
|
|
|
#include "TextRenderer.h" // for TextRenderer
|
2013-12-03 07:49:46 -08:00
|
|
|
#include <vector>
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
// HasOpaqueAncestorLayer and ContainerRender are shared between RefLayer and ContainerLayer
|
|
|
|
static bool
|
|
|
|
HasOpaqueAncestorLayer(Layer* aLayer)
|
|
|
|
{
|
|
|
|
for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) {
|
|
|
|
if (l->GetContentFlags() & Layer::CONTENT_OPAQUE)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-15 19:20:30 -07:00
|
|
|
/**
|
|
|
|
* Returns a rectangle of content painted opaquely by aLayer. Very consertative;
|
|
|
|
* bails by returning an empty rect in any tricky situations.
|
|
|
|
*/
|
|
|
|
static nsIntRect
|
|
|
|
GetOpaqueRect(Layer* aLayer)
|
|
|
|
{
|
|
|
|
nsIntRect result;
|
2014-02-24 07:09:55 -08:00
|
|
|
gfx::Matrix matrix;
|
|
|
|
bool is2D = aLayer->GetBaseTransform().Is2D(&matrix);
|
|
|
|
|
2013-09-15 19:20:30 -07:00
|
|
|
// Just bail if there's anything difficult to handle.
|
2014-02-24 07:09:55 -08:00
|
|
|
if (!is2D || aLayer->GetMaskLayer() ||
|
|
|
|
aLayer->GetEffectiveOpacity() != 1.0f ||
|
|
|
|
matrix.HasNonIntegerTranslation()) {
|
2013-09-15 19:20:30 -07:00
|
|
|
return result;
|
|
|
|
}
|
2014-02-24 07:09:55 -08:00
|
|
|
|
2013-09-15 19:20:30 -07:00
|
|
|
if (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) {
|
|
|
|
result = aLayer->GetEffectiveVisibleRegion().GetLargestRectangle();
|
|
|
|
} else {
|
|
|
|
// Drill down into RefLayers because that's what we particularly care about;
|
|
|
|
// layer construction for aLayer will not have known about the opaqueness
|
|
|
|
// of any RefLayer subtrees.
|
|
|
|
RefLayer* refLayer = aLayer->AsRefLayer();
|
|
|
|
if (refLayer && refLayer->GetFirstChild()) {
|
|
|
|
result = GetOpaqueRect(refLayer->GetFirstChild());
|
|
|
|
}
|
|
|
|
}
|
2014-02-24 07:09:55 -08:00
|
|
|
|
|
|
|
// Translate our opaque region to cover the child
|
|
|
|
gfx::Point point = matrix.GetTranslation();
|
|
|
|
result.MoveBy(static_cast<int>(point.x), static_cast<int>(point.y));
|
|
|
|
|
2013-09-15 19:20:30 -07:00
|
|
|
const nsIntRect* clipRect = aLayer->GetEffectiveClipRect();
|
|
|
|
if (clipRect) {
|
|
|
|
result.IntersectRect(result, *clipRect);
|
|
|
|
}
|
2014-02-24 07:09:55 -08:00
|
|
|
|
2013-09-15 19:20:30 -07:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-12-03 07:49:46 -08:00
|
|
|
struct LayerVelocityUserData : public LayerUserData {
|
|
|
|
public:
|
|
|
|
LayerVelocityUserData() {
|
|
|
|
MOZ_COUNT_CTOR(LayerVelocityUserData);
|
|
|
|
}
|
|
|
|
~LayerVelocityUserData() {
|
|
|
|
MOZ_COUNT_DTOR(LayerVelocityUserData);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct VelocityData {
|
|
|
|
VelocityData(TimeStamp frameTime, int scrollX, int scrollY)
|
|
|
|
: mFrameTime(frameTime)
|
|
|
|
, mPoint(scrollX, scrollY)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TimeStamp mFrameTime;
|
2013-12-03 11:07:26 -08:00
|
|
|
gfx::Point mPoint;
|
2013-12-03 07:49:46 -08:00
|
|
|
};
|
|
|
|
std::vector<VelocityData> mData;
|
|
|
|
};
|
|
|
|
|
2014-01-31 18:50:06 -08:00
|
|
|
static gfx::Point GetScrollData(Layer* aLayer) {
|
|
|
|
gfx::Matrix matrix;
|
|
|
|
if (aLayer->GetLocalTransform().Is2D(&matrix)) {
|
|
|
|
return matrix.GetTranslation();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Point origin;
|
|
|
|
return origin;
|
|
|
|
}
|
|
|
|
|
2014-03-11 19:27:33 -07:00
|
|
|
static void DrawLayerInfo(const nsIntRect& aClipRect,
|
|
|
|
LayerManagerComposite* aManager,
|
|
|
|
Layer* aLayer)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (aLayer->GetType() == Layer::LayerType::TYPE_CONTAINER) {
|
|
|
|
// XXX - should figure out a way to render this, but for now this
|
|
|
|
// is hard to do, since it will often get superimposed over the first
|
|
|
|
// child of the layer, which is bad.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoCString layerInfo;
|
|
|
|
aLayer->PrintInfo(layerInfo, "");
|
|
|
|
|
|
|
|
nsIntRegion visibleRegion = aLayer->GetVisibleRegion();
|
|
|
|
|
2014-03-11 19:55:07 -07:00
|
|
|
uint32_t maxWidth = std::min<uint32_t>(visibleRegion.GetBounds().width, 500);
|
2014-03-11 19:27:33 -07:00
|
|
|
|
|
|
|
nsIntPoint topLeft = visibleRegion.GetBounds().TopLeft();
|
|
|
|
aManager->GetTextRenderer()->RenderText(layerInfo.get(), gfx::IntPoint(topLeft.x, topLeft.y),
|
|
|
|
aLayer->GetEffectiveTransform(), 16,
|
|
|
|
maxWidth);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-31 18:50:06 -08:00
|
|
|
static LayerVelocityUserData* GetVelocityData(Layer* aLayer) {
|
|
|
|
static char sLayerVelocityUserDataKey;
|
|
|
|
void* key = reinterpret_cast<void*>(&sLayerVelocityUserDataKey);
|
|
|
|
if (!aLayer->HasUserData(key)) {
|
|
|
|
LayerVelocityUserData* newData = new LayerVelocityUserData();
|
|
|
|
aLayer->SetUserData(key, newData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return static_cast<LayerVelocityUserData*>(aLayer->GetUserData(key));
|
|
|
|
}
|
|
|
|
|
2013-12-03 07:49:46 -08:00
|
|
|
static void DrawVelGraph(const nsIntRect& aClipRect,
|
|
|
|
LayerManagerComposite* aManager,
|
|
|
|
Layer* aLayer) {
|
|
|
|
Compositor* compositor = aManager->GetCompositor();
|
|
|
|
gfx::Rect clipRect(aClipRect.x, aClipRect.y,
|
|
|
|
aClipRect.width, aClipRect.height);
|
|
|
|
|
|
|
|
TimeStamp now = TimeStamp::Now();
|
2014-01-31 18:50:06 -08:00
|
|
|
LayerVelocityUserData* velocityData = GetVelocityData(aLayer);
|
2013-12-03 07:49:46 -08:00
|
|
|
|
|
|
|
if (velocityData->mData.size() >= 1 &&
|
|
|
|
now > velocityData->mData[velocityData->mData.size() - 1].mFrameTime +
|
|
|
|
TimeDuration::FromMilliseconds(200)) {
|
|
|
|
// clear stale data
|
|
|
|
velocityData->mData.clear();
|
|
|
|
}
|
|
|
|
|
2014-01-31 18:50:06 -08:00
|
|
|
const gfx::Point layerTransform = GetScrollData(aLayer);
|
2013-12-03 07:49:46 -08:00
|
|
|
velocityData->mData.push_back(
|
2014-01-31 18:50:06 -08:00
|
|
|
LayerVelocityUserData::VelocityData(now,
|
|
|
|
static_cast<int>(layerTransform.x), static_cast<int>(layerTransform.y)));
|
2013-12-03 07:49:46 -08:00
|
|
|
|
2014-01-31 18:50:06 -08:00
|
|
|
// TODO: dump to file
|
2013-12-03 07:49:46 -08:00
|
|
|
// XXX: Uncomment these lines to enable ScrollGraph logging. This is
|
|
|
|
// useful for HVGA phones or to output the data to accurate
|
|
|
|
// graphing software.
|
2014-01-31 18:50:06 -08:00
|
|
|
// printf_stderr("ScrollGraph (%p): %f, %f\n",
|
|
|
|
// aLayer, layerTransform.x, layerTransform.y);
|
2013-12-03 07:49:46 -08:00
|
|
|
|
|
|
|
// Keep a circular buffer of 100.
|
|
|
|
size_t circularBufferSize = 100;
|
|
|
|
if (velocityData->mData.size() > circularBufferSize) {
|
|
|
|
velocityData->mData.erase(velocityData->mData.begin());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (velocityData->mData.size() == 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear and disable the graph when it's flat
|
|
|
|
for (size_t i = 1; i < velocityData->mData.size(); i++) {
|
|
|
|
if (velocityData->mData[i - 1].mPoint != velocityData->mData[i].mPoint) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == velocityData->mData.size() - 1) {
|
|
|
|
velocityData->mData.clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aLayer->GetEffectiveVisibleRegion().GetBounds().width < 300 ||
|
|
|
|
aLayer->GetEffectiveVisibleRegion().GetBounds().height < 300) {
|
|
|
|
// Don't want a graph for smaller layers
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aManager->SetDebugOverlayWantsNextFrame(true);
|
|
|
|
|
2014-01-24 17:49:19 -08:00
|
|
|
const gfx::Matrix4x4& transform = aLayer->GetEffectiveTransform();
|
2013-12-03 07:49:46 -08:00
|
|
|
nsIntRect bounds = aLayer->GetEffectiveVisibleRegion().GetBounds();
|
|
|
|
gfx::Rect graphBounds = gfx::Rect(bounds.x, bounds.y,
|
|
|
|
bounds.width, bounds.height);
|
|
|
|
gfx::Rect graphRect = gfx::Rect(bounds.x, bounds.y, 200, 100);
|
|
|
|
|
|
|
|
float opacity = 1.0;
|
|
|
|
EffectChain effects;
|
2014-01-09 06:26:19 -08:00
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(0.2f,0,0,1));
|
2013-12-03 07:49:46 -08:00
|
|
|
compositor->DrawQuad(graphRect,
|
|
|
|
clipRect,
|
|
|
|
effects,
|
|
|
|
opacity,
|
|
|
|
transform);
|
|
|
|
|
|
|
|
std::vector<gfx::Point> graph;
|
|
|
|
int yScaleFactor = 3;
|
|
|
|
for (int32_t i = (int32_t)velocityData->mData.size() - 2; i >= 0; i--) {
|
2013-12-03 11:07:26 -08:00
|
|
|
const gfx::Point& p1 = velocityData->mData[i+1].mPoint;
|
|
|
|
const gfx::Point& p2 = velocityData->mData[i].mPoint;
|
2013-12-03 07:49:46 -08:00
|
|
|
int vel = sqrt((p1.x - p2.x) * (p1.x - p2.x) +
|
|
|
|
(p1.y - p2.y) * (p1.y - p2.y));
|
|
|
|
graph.push_back(
|
|
|
|
gfx::Point(bounds.x + graphRect.width / circularBufferSize * i,
|
|
|
|
graphBounds.y + graphRect.height - vel/yScaleFactor));
|
|
|
|
}
|
|
|
|
|
|
|
|
compositor->DrawLines(graph, clipRect, gfx::Color(0,1,0,1),
|
|
|
|
opacity, transform);
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
template<class ContainerT> void
|
|
|
|
ContainerRender(ContainerT* aContainer,
|
|
|
|
LayerManagerComposite* aManager,
|
|
|
|
const nsIntRect& aClipRect)
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Setup our temporary surface for rendering the contents of this container.
|
|
|
|
*/
|
|
|
|
RefPtr<CompositingRenderTarget> surface;
|
|
|
|
|
|
|
|
Compositor* compositor = aManager->GetCompositor();
|
|
|
|
|
|
|
|
RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
|
|
|
|
|
|
|
|
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
|
|
|
|
|
|
|
|
aContainer->mSupportsComponentAlphaChildren = false;
|
|
|
|
|
|
|
|
float opacity = aContainer->GetEffectiveOpacity();
|
|
|
|
|
|
|
|
bool needsSurface = aContainer->UseIntermediateSurface();
|
|
|
|
if (needsSurface) {
|
|
|
|
SurfaceInitMode mode = INIT_MODE_CLEAR;
|
|
|
|
bool surfaceCopyNeeded = false;
|
|
|
|
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y,
|
|
|
|
visibleRect.width, visibleRect.height);
|
2013-11-07 01:53:07 -08:00
|
|
|
gfx::IntPoint sourcePoint = gfx::IntPoint(visibleRect.x, visibleRect.y);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
// we're about to create a framebuffer backed by textures to use as an intermediate
|
|
|
|
// surface. What to do if its size (as given by framebufferRect) would exceed the
|
|
|
|
// maximum texture size supported by the GL? The present code chooses the compromise
|
|
|
|
// of just clamping the framebuffer's size to the max supported size.
|
|
|
|
// This gives us a lower resolution rendering of the intermediate surface (children layers).
|
|
|
|
// See bug 827170 for a discussion.
|
|
|
|
int32_t maxTextureSize = compositor->GetMaxTextureSize();
|
|
|
|
surfaceRect.width = std::min(maxTextureSize, surfaceRect.width);
|
|
|
|
surfaceRect.height = std::min(maxTextureSize, surfaceRect.height);
|
|
|
|
if (aContainer->GetEffectiveVisibleRegion().GetNumRects() == 1 &&
|
|
|
|
(aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE))
|
|
|
|
{
|
|
|
|
// don't need a background, we're going to paint all opaque stuff
|
|
|
|
aContainer->mSupportsComponentAlphaChildren = true;
|
|
|
|
mode = INIT_MODE_NONE;
|
|
|
|
} else {
|
2014-01-27 12:25:19 -08:00
|
|
|
const gfx::Matrix4x4& transform3D = aContainer->GetEffectiveTransform();
|
|
|
|
gfx::Matrix transform;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
// If we have an opaque ancestor layer, then we can be sure that
|
|
|
|
// all the pixels we draw into are either opaque already or will be
|
|
|
|
// covered by something opaque. Otherwise copying up the background is
|
|
|
|
// not safe.
|
|
|
|
if (HasOpaqueAncestorLayer(aContainer) &&
|
2014-01-27 12:25:19 -08:00
|
|
|
transform3D.Is2D(&transform) && !ThebesMatrix(transform).HasNonIntegerTranslation()) {
|
2014-02-26 18:53:27 -08:00
|
|
|
surfaceCopyNeeded = gfxPrefs::ComponentAlphaEnabled();
|
2014-01-27 12:25:19 -08:00
|
|
|
sourcePoint.x += transform._31;
|
|
|
|
sourcePoint.y += transform._32;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
aContainer->mSupportsComponentAlphaChildren
|
2014-02-26 18:53:27 -08:00
|
|
|
= gfxPrefs::ComponentAlphaEnabled();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-07 01:53:08 -08:00
|
|
|
sourcePoint -= compositor->GetCurrentRenderTarget()->GetOrigin();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
if (surfaceCopyNeeded) {
|
2013-11-07 01:53:07 -08:00
|
|
|
surface = compositor->CreateRenderTargetFromSource(surfaceRect, previousTarget, sourcePoint);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
} else {
|
|
|
|
surface = compositor->CreateRenderTarget(surfaceRect, mode);
|
|
|
|
}
|
2013-09-01 15:19:19 -07:00
|
|
|
|
|
|
|
if (!surface) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
compositor->SetRenderTarget(surface);
|
|
|
|
} else {
|
|
|
|
surface = previousTarget;
|
|
|
|
aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) ||
|
|
|
|
(aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren());
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoTArray<Layer*, 12> children;
|
|
|
|
aContainer->SortChildrenBy3DZOrder(children);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render this container's contents.
|
|
|
|
*/
|
|
|
|
for (uint32_t i = 0; i < children.Length(); i++) {
|
|
|
|
LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->ImplData());
|
|
|
|
|
2013-07-02 08:16:05 -07:00
|
|
|
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty() &&
|
|
|
|
!layerToRender->GetLayer()->AsContainerLayer()) {
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-02-24 00:57:27 -08:00
|
|
|
nsIntRect clipRect = layerToRender->GetLayer()->
|
|
|
|
CalculateScissorRect(aClipRect, &aManager->GetWorldTransform());
|
|
|
|
if (clipRect.IsEmpty()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIntRegion savedVisibleRegion;
|
|
|
|
bool restoreVisibleRegion = false;
|
2013-09-15 19:20:30 -07:00
|
|
|
if (i + 1 < children.Length() &&
|
|
|
|
layerToRender->GetLayer()->GetEffectiveTransform().IsIdentity()) {
|
|
|
|
LayerComposite* nextLayer = static_cast<LayerComposite*>(children.ElementAt(i + 1)->ImplData());
|
|
|
|
nsIntRect nextLayerOpaqueRect;
|
|
|
|
if (nextLayer && nextLayer->GetLayer()) {
|
|
|
|
nextLayerOpaqueRect = GetOpaqueRect(nextLayer->GetLayer());
|
|
|
|
}
|
|
|
|
if (!nextLayerOpaqueRect.IsEmpty()) {
|
2014-02-24 00:57:27 -08:00
|
|
|
savedVisibleRegion = layerToRender->GetShadowVisibleRegion();
|
2013-09-15 19:20:30 -07:00
|
|
|
nsIntRegion visibleRegion;
|
2014-02-24 00:57:27 -08:00
|
|
|
visibleRegion.Sub(savedVisibleRegion, nextLayerOpaqueRect);
|
2013-09-15 19:20:30 -07:00
|
|
|
if (visibleRegion.IsEmpty()) {
|
|
|
|
continue;
|
|
|
|
}
|
2014-02-24 00:57:27 -08:00
|
|
|
layerToRender->SetShadowVisibleRegion(visibleRegion);
|
|
|
|
restoreVisibleRegion = true;
|
2013-09-15 19:20:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-15 14:01:42 -07:00
|
|
|
if (layerToRender->HasLayerBeenComposited()) {
|
|
|
|
// Composer2D will compose this layer so skip GPU composition
|
|
|
|
// this time & reset composition flag for next composition phase
|
|
|
|
layerToRender->SetLayerComposited(false);
|
2014-02-27 11:07:34 -08:00
|
|
|
nsIntRect clearRect = layerToRender->GetClearRect();
|
|
|
|
if (!clearRect.IsEmpty()) {
|
2014-01-17 18:55:30 -08:00
|
|
|
// Clear layer's visible rect on FrameBuffer with transparent pixels
|
2014-02-27 11:07:34 -08:00
|
|
|
gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.width, clearRect.height);
|
2014-03-27 20:38:32 -07:00
|
|
|
compositor->ClearRect(fbRect);
|
2014-02-27 11:07:34 -08:00
|
|
|
layerToRender->SetClearRect(nsIntRect(0, 0, 0, 0));
|
2014-01-17 18:55:30 -08:00
|
|
|
}
|
2013-10-15 14:01:42 -07:00
|
|
|
} else {
|
2013-11-07 01:53:08 -08:00
|
|
|
layerToRender->RenderLayer(clipRect);
|
2013-10-15 14:01:42 -07:00
|
|
|
}
|
2013-12-03 07:49:46 -08:00
|
|
|
|
2014-02-24 00:57:27 -08:00
|
|
|
if (restoreVisibleRegion) {
|
|
|
|
// Restore the region in case it's not covered by opaque content next time
|
|
|
|
layerToRender->SetShadowVisibleRegion(savedVisibleRegion);
|
|
|
|
}
|
|
|
|
|
2014-02-26 18:53:27 -08:00
|
|
|
if (gfxPrefs::LayersScrollGraph()) {
|
2013-12-03 07:49:46 -08:00
|
|
|
DrawVelGraph(clipRect, aManager, layerToRender->GetLayer());
|
|
|
|
}
|
2014-03-11 19:27:33 -07:00
|
|
|
|
|
|
|
if (gfxPrefs::DrawLayerInfo()) {
|
|
|
|
DrawLayerInfo(clipRect, aManager, layerToRender->GetLayer());
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
// invariant: our GL context should be current here, I don't think we can
|
|
|
|
// assert it though
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needsSurface) {
|
|
|
|
// Unbind the current surface and rebind the previous one.
|
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
|
|
|
if (gfxUtils::sDumpPainting) {
|
2014-01-08 00:37:58 -08:00
|
|
|
RefPtr<gfx::DataSourceSurface> surf = surface->Dump(aManager->GetCompositor());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
WriteSnapshotToDumpFile(aContainer, surf);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
compositor->SetRenderTarget(previousTarget);
|
2014-03-10 05:36:31 -07:00
|
|
|
EffectChain effectChain(aContainer);
|
2013-08-27 21:44:03 -07:00
|
|
|
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(aContainer->GetMaskLayer(),
|
|
|
|
effectChain,
|
|
|
|
!aContainer->GetTransform().CanDraw2D());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
effectChain.mPrimaryEffect = new EffectRenderTarget(surface);
|
|
|
|
|
|
|
|
gfx::Rect rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height);
|
|
|
|
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
|
|
|
aManager->GetCompositor()->DrawQuad(rect, clipRect, effectChain, opacity,
|
2014-01-24 17:49:19 -08:00
|
|
|
aContainer->GetEffectiveTransform());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
2013-06-12 11:25:17 -07:00
|
|
|
|
|
|
|
if (aContainer->GetFrameMetrics().IsScrollable()) {
|
2013-07-02 08:16:05 -07:00
|
|
|
const FrameMetrics& frame = aContainer->GetFrameMetrics();
|
2014-03-10 14:56:59 -07:00
|
|
|
LayerRect layerBounds = ParentLayerRect(frame.mCompositionBounds) * ParentLayerToLayerScale(1.0);
|
2013-09-11 15:17:27 -07:00
|
|
|
gfx::Rect rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height);
|
2013-06-12 11:25:17 -07:00
|
|
|
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
2013-08-02 15:50:17 -07:00
|
|
|
aManager->GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTAINER,
|
2013-06-12 11:25:17 -07:00
|
|
|
rect, clipRect,
|
2014-01-24 17:49:19 -08:00
|
|
|
aContainer->GetEffectiveTransform());
|
2013-06-12 11:25:17 -07:00
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ContainerLayerComposite::ContainerLayerComposite(LayerManagerComposite *aManager)
|
2013-04-25 15:25:33 -07:00
|
|
|
: ContainerLayer(aManager, nullptr)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
, LayerComposite(aManager)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ContainerLayerComposite);
|
|
|
|
mImplData = static_cast<LayerComposite*>(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
ContainerLayerComposite::~ContainerLayerComposite()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ContainerLayerComposite);
|
|
|
|
|
|
|
|
// We don't Destroy() on destruction here because this destructor
|
|
|
|
// can be called after remote content has crashed, and it may not be
|
|
|
|
// safe to free the IPC resources of our children. Those resources
|
|
|
|
// are automatically cleaned up by IPDL-generated code.
|
|
|
|
//
|
|
|
|
// In the common case of normal shutdown, either
|
|
|
|
// LayerManagerComposite::Destroy(), a parent
|
|
|
|
// *ContainerLayerComposite::Destroy(), or Disconnect() will trigger
|
|
|
|
// cleanup of our resources.
|
|
|
|
while (mFirstChild) {
|
|
|
|
RemoveChild(mFirstChild);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContainerLayerComposite::Destroy()
|
|
|
|
{
|
|
|
|
if (!mDestroyed) {
|
|
|
|
while (mFirstChild) {
|
|
|
|
static_cast<LayerComposite*>(GetFirstChild()->ImplData())->Destroy();
|
|
|
|
RemoveChild(mFirstChild);
|
|
|
|
}
|
|
|
|
mDestroyed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LayerComposite*
|
|
|
|
ContainerLayerComposite::GetFirstChildComposite()
|
|
|
|
{
|
|
|
|
if (!mFirstChild) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return static_cast<LayerComposite*>(mFirstChild->ImplData());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-11-07 01:53:08 -08:00
|
|
|
ContainerLayerComposite::RenderLayer(const nsIntRect& aClipRect)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
2013-11-07 01:53:08 -08:00
|
|
|
ContainerRender(this, mCompositeManager, aClipRect);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContainerLayerComposite::CleanupResources()
|
|
|
|
{
|
|
|
|
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
|
|
|
|
LayerComposite* layerToCleanup = static_cast<LayerComposite*>(l->ImplData());
|
|
|
|
layerToCleanup->CleanupResources();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RefLayerComposite::RefLayerComposite(LayerManagerComposite* aManager)
|
2013-04-25 15:25:33 -07:00
|
|
|
: RefLayer(aManager, nullptr)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
, LayerComposite(aManager)
|
|
|
|
{
|
|
|
|
mImplData = static_cast<LayerComposite*>(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
RefLayerComposite::~RefLayerComposite()
|
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RefLayerComposite::Destroy()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!mFirstChild);
|
|
|
|
mDestroyed = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
LayerComposite*
|
|
|
|
RefLayerComposite::GetFirstChildComposite()
|
|
|
|
{
|
|
|
|
if (!mFirstChild) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return static_cast<LayerComposite*>(mFirstChild->ImplData());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-11-07 01:53:08 -08:00
|
|
|
RefLayerComposite::RenderLayer(const nsIntRect& aClipRect)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
2013-11-07 01:53:08 -08:00
|
|
|
ContainerRender(this, mCompositeManager, aClipRect);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RefLayerComposite::CleanupResources()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
} /* layers */
|
|
|
|
} /* mozilla */
|