2012-04-16 16:02:45 -07:00
|
|
|
/* 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/. */
|
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
#include "mozilla/layers/PLayerTransactionChild.h"
|
2013-04-30 22:03:25 -07:00
|
|
|
#include "ClientTiledThebesLayer.h"
|
2012-04-16 16:02:45 -07:00
|
|
|
#include "gfxImageSurface.h"
|
2013-03-18 07:25:50 -07:00
|
|
|
#include "GeckoProfiler.h"
|
2012-08-19 12:33:25 -07:00
|
|
|
#include "gfxPlatform.h"
|
2012-04-16 16:02:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientTiledThebesLayer::ClientTiledThebesLayer(ClientLayerManager* const aManager)
|
2013-08-16 06:18:36 -07:00
|
|
|
: ThebesLayer(aManager,
|
|
|
|
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
|
2013-04-16 14:36:06 -07:00
|
|
|
, mContentClient()
|
2012-12-05 09:10:41 -08:00
|
|
|
{
|
2013-04-30 22:03:25 -07:00
|
|
|
MOZ_COUNT_CTOR(ClientTiledThebesLayer);
|
2013-05-30 18:30:13 -07:00
|
|
|
mPaintData.mLastScrollOffset = CSSPoint(0, 0);
|
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
|
|
|
mPaintData.mFirstPaint = true;
|
2012-12-05 09:10:41 -08:00
|
|
|
}
|
|
|
|
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientTiledThebesLayer::~ClientTiledThebesLayer()
|
2012-12-05 09:10:41 -08:00
|
|
|
{
|
2013-04-30 22:03:25 -07:00
|
|
|
MOZ_COUNT_DTOR(ClientTiledThebesLayer);
|
2012-12-05 09:10:41 -08:00
|
|
|
}
|
|
|
|
|
2012-04-16 16:02:45 -07:00
|
|
|
void
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
2012-04-16 16:02:45 -07:00
|
|
|
{
|
|
|
|
aAttrs = ThebesLayerAttributes(GetValidRegion());
|
|
|
|
}
|
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
void
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientTiledThebesLayer::BeginPaint()
|
2012-11-29 05:08:40 -08:00
|
|
|
{
|
2013-04-30 22:03:25 -07:00
|
|
|
if (ClientManager()->IsRepeatTransaction()) {
|
2012-11-29 05:08:40 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mPaintData.mLowPrecisionPaintCount = 0;
|
|
|
|
mPaintData.mPaintFinished = false;
|
|
|
|
|
|
|
|
// Calculate the transform required to convert screen space into layer space
|
|
|
|
mPaintData.mTransformScreenToLayer = GetEffectiveTransform();
|
|
|
|
// XXX Not sure if this code for intermediate surfaces is correct.
|
|
|
|
// It rarely gets hit though, and shouldn't have terrible consequences
|
|
|
|
// even if it is wrong.
|
|
|
|
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
|
|
|
|
if (parent->UseIntermediateSurface()) {
|
|
|
|
mPaintData.mTransformScreenToLayer.PreMultiply(parent->GetEffectiveTransform());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mPaintData.mTransformScreenToLayer.Invert();
|
|
|
|
|
|
|
|
// Compute the critical display port in layer space.
|
|
|
|
mPaintData.mLayerCriticalDisplayPort.SetEmpty();
|
2013-06-21 14:03:57 -07:00
|
|
|
const FrameMetrics& metrics = GetParent()->GetFrameMetrics();
|
2013-06-10 06:05:42 -07:00
|
|
|
const gfx::Rect& criticalDisplayPort =
|
2013-06-21 14:03:57 -07:00
|
|
|
(metrics.mCriticalDisplayPort * metrics.mDevPixelsPerCSSPixel).ToUnknownRect();
|
2012-11-29 05:08:40 -08:00
|
|
|
if (!criticalDisplayPort.IsEmpty()) {
|
|
|
|
gfxRect transformedCriticalDisplayPort =
|
2013-03-04 06:37:43 -08:00
|
|
|
mPaintData.mTransformScreenToLayer.TransformBounds(
|
|
|
|
gfxRect(criticalDisplayPort.x, criticalDisplayPort.y,
|
|
|
|
criticalDisplayPort.width, criticalDisplayPort.height));
|
2012-11-29 05:08:40 -08:00
|
|
|
transformedCriticalDisplayPort.RoundOut();
|
|
|
|
mPaintData.mLayerCriticalDisplayPort = nsIntRect(transformedCriticalDisplayPort.x,
|
|
|
|
transformedCriticalDisplayPort.y,
|
|
|
|
transformedCriticalDisplayPort.width,
|
|
|
|
transformedCriticalDisplayPort.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate the frame resolution.
|
2013-03-04 06:37:43 -08:00
|
|
|
mPaintData.mResolution.SizeTo(1, 1);
|
2012-11-29 05:08:40 -08:00
|
|
|
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
|
|
|
|
const FrameMetrics& metrics = parent->GetFrameMetrics();
|
2013-06-21 14:03:56 -07:00
|
|
|
mPaintData.mResolution.width *= metrics.mResolution.scale;
|
|
|
|
mPaintData.mResolution.height *= metrics.mResolution.scale;
|
2012-11-29 05:08:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate the scroll offset since the last transaction, and the
|
|
|
|
// composition bounds.
|
|
|
|
mPaintData.mCompositionBounds.SetEmpty();
|
|
|
|
mPaintData.mScrollOffset.MoveTo(0, 0);
|
2013-04-30 22:03:25 -07:00
|
|
|
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
|
2012-11-29 05:08:40 -08:00
|
|
|
if (primaryScrollable) {
|
|
|
|
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
|
|
|
|
mPaintData.mScrollOffset = metrics.mScrollOffset;
|
|
|
|
gfxRect transformedViewport = mPaintData.mTransformScreenToLayer.TransformBounds(
|
|
|
|
gfxRect(metrics.mCompositionBounds.x, metrics.mCompositionBounds.y,
|
|
|
|
metrics.mCompositionBounds.width, metrics.mCompositionBounds.height));
|
|
|
|
transformedViewport.RoundOut();
|
|
|
|
mPaintData.mCompositionBounds =
|
|
|
|
nsIntRect(transformedViewport.x, transformedViewport.y,
|
|
|
|
transformedViewport.width, transformedViewport.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientTiledThebesLayer::EndPaint(bool aFinish)
|
2012-11-29 05:08:40 -08:00
|
|
|
{
|
|
|
|
if (!aFinish && !mPaintData.mPaintFinished) {
|
|
|
|
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
|
|
|
mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
|
2012-11-29 05:08:40 -08:00
|
|
|
mPaintData.mPaintFinished = true;
|
|
|
|
}
|
|
|
|
|
2012-04-16 16:02:45 -07:00
|
|
|
void
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientTiledThebesLayer::RenderLayer()
|
2012-04-16 16:02:45 -07:00
|
|
|
{
|
2013-04-30 22:03:25 -07:00
|
|
|
LayerManager::DrawThebesLayerCallback callback =
|
|
|
|
ClientManager()->GetThebesLayerCallback();
|
|
|
|
void *data = ClientManager()->GetThebesLayerCallbackData();
|
|
|
|
if (!callback) {
|
|
|
|
ClientManager()->SetTransactionIncomplete();
|
2012-04-16 16:02:45 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-16 14:36:06 -07:00
|
|
|
if (!mContentClient) {
|
2013-04-30 22:03:25 -07:00
|
|
|
mContentClient = new TiledContentClient(this, ClientManager());
|
2013-04-16 14:36:06 -07:00
|
|
|
|
|
|
|
mContentClient->Connect();
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientManager()->Attach(mContentClient, this);
|
2013-04-16 14:36:06 -07:00
|
|
|
MOZ_ASSERT(mContentClient->GetForwarder());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mContentClient->mTiledBuffer.HasFormatChanged()) {
|
2012-09-04 15:05:31 -07:00
|
|
|
mValidRegion = nsIntRegion();
|
|
|
|
}
|
|
|
|
|
2012-10-15 01:33:48 -07:00
|
|
|
nsIntRegion invalidRegion = mVisibleRegion;
|
|
|
|
invalidRegion.Sub(invalidRegion, mValidRegion);
|
2012-11-29 05:08:40 -08:00
|
|
|
if (invalidRegion.IsEmpty()) {
|
|
|
|
EndPaint(true);
|
|
|
|
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
|
|
|
// Only paint the mask layer on the first transaction.
|
2013-04-30 22:03:25 -07:00
|
|
|
if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) {
|
|
|
|
ToClientLayer(GetMaskLayer())->RenderLayer();
|
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
|
|
|
}
|
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
// Fast path for no progressive updates, no low-precision updates and no
|
|
|
|
// critical display-port set.
|
|
|
|
if (!gfxPlatform::UseProgressiveTilePainting() &&
|
|
|
|
!gfxPlatform::UseLowPrecisionBuffer() &&
|
|
|
|
GetParent()->GetFrameMetrics().mCriticalDisplayPort.IsEmpty()) {
|
|
|
|
mValidRegion = mVisibleRegion;
|
|
|
|
|
2013-04-30 22:03:25 -07:00
|
|
|
NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
|
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-04-16 14:36:06 -07:00
|
|
|
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
|
2013-04-30 22:03:25 -07:00
|
|
|
callback, data);
|
2012-11-29 05:08:40 -08:00
|
|
|
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientManager()->Hold(this);
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->LockCopyAndWrite(TiledContentClient::TILED_BUFFER);
|
2012-11-29 05:08:40 -08:00
|
|
|
|
2012-04-16 16:02:45 -07:00
|
|
|
return;
|
2012-11-29 05:08:40 -08:00
|
|
|
}
|
2012-04-16 16:02:45 -07:00
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
// Calculate everything we need to perform the paint.
|
|
|
|
BeginPaint();
|
|
|
|
if (mPaintData.mPaintFinished) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure that tiles that fall outside of the visible region are
|
|
|
|
// discarded on the first update.
|
2013-04-30 22:03:25 -07:00
|
|
|
if (!ClientManager()->IsRepeatTransaction()) {
|
2012-11-29 05:08:40 -08:00
|
|
|
mValidRegion.And(mValidRegion, mVisibleRegion);
|
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 (!mPaintData.mLayerCriticalDisplayPort.IsEmpty()) {
|
|
|
|
// Make sure that tiles that fall outside of the critical displayport are
|
|
|
|
// discarded on the first update.
|
|
|
|
mValidRegion.And(mValidRegion, mPaintData.mLayerCriticalDisplayPort);
|
|
|
|
}
|
2012-11-21 14:34:18 -08:00
|
|
|
}
|
|
|
|
|
2012-11-21 14:34:20 -08:00
|
|
|
nsIntRegion lowPrecisionInvalidRegion;
|
2012-11-29 05:08:40 -08:00
|
|
|
if (!mPaintData.mLayerCriticalDisplayPort.IsEmpty()) {
|
|
|
|
if (gfxPlatform::UseLowPrecisionBuffer()) {
|
|
|
|
// Calculate the invalid region for the low precision buffer
|
|
|
|
lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion);
|
|
|
|
|
|
|
|
// Remove the valid region from the low precision valid region (we don't
|
|
|
|
// validate this part of the low precision buffer).
|
|
|
|
lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
|
|
|
|
}
|
2012-11-21 14:34:18 -08:00
|
|
|
|
|
|
|
// Clip the invalid region to the critical display-port
|
2012-11-29 05:08:40 -08:00
|
|
|
invalidRegion.And(invalidRegion, mPaintData.mLayerCriticalDisplayPort);
|
2012-11-21 14:34:20 -08:00
|
|
|
if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
|
2012-11-29 05:08:40 -08:00
|
|
|
EndPaint(true);
|
2012-11-21 14:34:18 -08:00
|
|
|
return;
|
2012-11-21 14:34:20 -08:00
|
|
|
}
|
2012-11-21 14:34:18 -08:00
|
|
|
}
|
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
if (!invalidRegion.IsEmpty() && mPaintData.mLowPrecisionPaintCount == 0) {
|
2012-11-21 14:34:20 -08:00
|
|
|
bool updatedBuffer = false;
|
|
|
|
// Only draw progressively when the resolution is unchanged.
|
|
|
|
if (gfxPlatform::UseProgressiveTilePainting() &&
|
2013-04-30 22:03:25 -07:00
|
|
|
!ClientManager()->HasShadowTarget() &&
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
|
2012-11-21 14:34:20 -08:00
|
|
|
// Store the old valid region, then clear it before painting.
|
|
|
|
// We clip the old valid region to the visible region, as it only gets
|
|
|
|
// used to decide stale content (currently valid and previously visible)
|
2013-04-16 14:36:06 -07:00
|
|
|
nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion();
|
2012-11-21 14:34:20 -08:00
|
|
|
oldValidRegion.And(oldValidRegion, mVisibleRegion);
|
2012-11-29 05:08:40 -08:00
|
|
|
if (!mPaintData.mLayerCriticalDisplayPort.IsEmpty()) {
|
|
|
|
oldValidRegion.And(oldValidRegion, mPaintData.mLayerCriticalDisplayPort);
|
2012-11-21 14:34:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
updatedBuffer =
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->mTiledBuffer.ProgressiveUpdate(mValidRegion, invalidRegion,
|
|
|
|
oldValidRegion, &mPaintData,
|
2013-04-30 22:03:25 -07:00
|
|
|
callback, data);
|
2012-11-21 14:34:20 -08:00
|
|
|
} else {
|
|
|
|
updatedBuffer = true;
|
|
|
|
mValidRegion = mVisibleRegion;
|
2012-11-29 05:08:40 -08:00
|
|
|
if (!mPaintData.mLayerCriticalDisplayPort.IsEmpty()) {
|
|
|
|
mValidRegion.And(mValidRegion, mPaintData.mLayerCriticalDisplayPort);
|
2012-11-21 14:34:18 -08:00
|
|
|
}
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
|
|
|
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
|
2013-04-30 22:03:25 -07:00
|
|
|
callback, data);
|
2012-11-21 11:16:53 -08:00
|
|
|
}
|
2012-11-21 11:16:52 -08:00
|
|
|
|
2012-11-21 14:34:20 -08:00
|
|
|
if (updatedBuffer) {
|
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
|
|
|
mPaintData.mFirstPaint = false;
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientManager()->Hold(this);
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->LockCopyAndWrite(TiledContentClient::TILED_BUFFER);
|
2012-11-29 05:08:40 -08:00
|
|
|
|
|
|
|
// If there are low precision updates, mark the paint as unfinished and
|
|
|
|
// request a repeat transaction.
|
|
|
|
if (!lowPrecisionInvalidRegion.IsEmpty() && mPaintData.mPaintFinished) {
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientManager()->SetRepeatTransaction();
|
2012-11-29 05:08:40 -08:00
|
|
|
mPaintData.mLowPrecisionPaintCount = 1;
|
|
|
|
mPaintData.mPaintFinished = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return so that low precision updates aren't performed in the same
|
|
|
|
// transaction as high-precision updates.
|
|
|
|
EndPaint(false);
|
|
|
|
return;
|
2012-11-21 14:34:20 -08:00
|
|
|
}
|
|
|
|
}
|
2012-11-21 14:34:19 -08:00
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
// Render the low precision buffer, if there's area to invalidate and the
|
|
|
|
// visible region is larger than the critical display port.
|
2012-11-21 14:34:19 -08:00
|
|
|
bool updatedLowPrecision = false;
|
2012-11-29 05:08:40 -08:00
|
|
|
if (!lowPrecisionInvalidRegion.IsEmpty() &&
|
|
|
|
!nsIntRegion(mPaintData.mLayerCriticalDisplayPort).Contains(mVisibleRegion)) {
|
2013-04-16 14:36:06 -07:00
|
|
|
nsIntRegion oldValidRegion =
|
|
|
|
mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
|
2012-11-21 14:34:19 -08:00
|
|
|
oldValidRegion.And(oldValidRegion, mVisibleRegion);
|
|
|
|
|
2012-11-29 05:08:41 -08:00
|
|
|
// If the frame resolution or format have changed, invalidate the buffer
|
2013-04-16 14:36:06 -07:00
|
|
|
if (mContentClient->mLowPrecisionTiledBuffer.GetFrameResolution() != mPaintData.mResolution ||
|
|
|
|
mContentClient->mLowPrecisionTiledBuffer.HasFormatChanged()) {
|
2012-11-21 14:34:19 -08:00
|
|
|
if (!mLowPrecisionValidRegion.IsEmpty()) {
|
2012-11-21 14:34:20 -08:00
|
|
|
updatedLowPrecision = true;
|
2012-11-21 14:34:19 -08:00
|
|
|
}
|
|
|
|
oldValidRegion.SetEmpty();
|
|
|
|
mLowPrecisionValidRegion.SetEmpty();
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->mLowPrecisionTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
2012-11-29 05:08:41 -08:00
|
|
|
lowPrecisionInvalidRegion = mVisibleRegion;
|
2012-11-21 14:34:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Invalidate previously valid content that is no longer visible
|
2012-11-29 05:08:40 -08:00
|
|
|
if (mPaintData.mLowPrecisionPaintCount == 1) {
|
2012-11-21 14:34:19 -08:00
|
|
|
mLowPrecisionValidRegion.And(mLowPrecisionValidRegion, mVisibleRegion);
|
|
|
|
}
|
2012-11-29 05:08:40 -08:00
|
|
|
mPaintData.mLowPrecisionPaintCount++;
|
2012-11-21 14:34:19 -08:00
|
|
|
|
2012-11-21 14:34:19 -08:00
|
|
|
// Remove the valid high-precision region from the invalid low-precision
|
|
|
|
// region. We don't want to spend time drawing things twice.
|
2012-11-29 05:08:40 -08:00
|
|
|
lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
|
2012-11-21 14:34:19 -08:00
|
|
|
|
2012-11-21 14:34:19 -08:00
|
|
|
if (!lowPrecisionInvalidRegion.IsEmpty()) {
|
2013-04-16 14:36:06 -07:00
|
|
|
updatedLowPrecision = mContentClient->mLowPrecisionTiledBuffer
|
|
|
|
.ProgressiveUpdate(mLowPrecisionValidRegion,
|
|
|
|
lowPrecisionInvalidRegion,
|
|
|
|
oldValidRegion, &mPaintData,
|
2013-04-30 22:03:25 -07:00
|
|
|
callback, data);
|
2012-11-21 14:34:19 -08:00
|
|
|
}
|
|
|
|
} else if (!mLowPrecisionValidRegion.IsEmpty()) {
|
|
|
|
// Clear the low precision tiled buffer
|
2012-11-21 14:34:20 -08:00
|
|
|
updatedLowPrecision = true;
|
2012-11-21 14:34:19 -08:00
|
|
|
mLowPrecisionValidRegion.SetEmpty();
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->mLowPrecisionTiledBuffer.PaintThebes(mLowPrecisionValidRegion,
|
|
|
|
mLowPrecisionValidRegion,
|
2013-04-30 22:03:25 -07:00
|
|
|
callback, data);
|
2012-11-21 14:34:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// We send a Painted callback if we clear the valid region of the low
|
|
|
|
// precision buffer, so that the shadow buffer's valid region can be updated
|
|
|
|
// and the associated resources can be freed.
|
2012-11-21 14:34:20 -08:00
|
|
|
if (updatedLowPrecision) {
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientManager()->Hold(this);
|
2013-04-16 14:36:06 -07:00
|
|
|
mContentClient->LockCopyAndWrite(TiledContentClient::LOW_PRECISION_TILED_BUFFER);
|
2012-11-21 14:34:19 -08:00
|
|
|
}
|
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
EndPaint(false);
|
2012-04-16 16:02:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} // mozilla
|
|
|
|
} // layers
|