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 "mozilla/layers/ContentClient.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "BasicLayers.h" // for BasicLayerManager
|
|
|
|
#include "gfxColor.h" // for gfxRGBA
|
|
|
|
#include "gfxContext.h" // for gfxContext, etc
|
|
|
|
#include "gfxPlatform.h" // for gfxPlatform
|
|
|
|
#include "gfxPoint.h" // for gfxIntSize, gfxPoint
|
|
|
|
#include "gfxTeeSurface.h" // for gfxTeeSurface
|
|
|
|
#include "gfxUtils.h" // for gfxUtils
|
|
|
|
#include "ipc/ShadowLayers.h" // for ShadowLayerForwarder
|
2013-12-08 18:52:54 -08:00
|
|
|
#include "mozilla/ArrayUtils.h" // for ArrayLength
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/gfx/2D.h" // for DrawTarget, Factory
|
|
|
|
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
|
|
|
#include "mozilla/gfx/BaseSize.h" // for BaseSize
|
|
|
|
#include "mozilla/gfx/Rect.h" // for Rect
|
|
|
|
#include "mozilla/gfx/Types.h"
|
2013-04-25 15:25:33 -07:00
|
|
|
#include "mozilla/layers/LayerManagerComposite.h"
|
2013-09-06 08:41:00 -07:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for ThebesBufferData
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsDebug.h" // for NS_ASSERTION, NS_WARNING, etc
|
|
|
|
#include "nsISupportsImpl.h" // for gfxContext::Release, etc
|
|
|
|
#include "nsIWidget.h" // for nsIWidget
|
|
|
|
#include "prenv.h" // for PR_GetEnv
|
2013-05-03 10:34:29 -07:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#include "gfxWindowsPlatform.h"
|
|
|
|
#endif
|
2013-10-07 16:15:59 -07:00
|
|
|
#include "gfx2DGlue.h"
|
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 {
|
|
|
|
|
|
|
|
using namespace gfx;
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
/* static */ TemporaryRef<ContentClient>
|
2013-04-16 14:36:06 -07:00
|
|
|
ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
|
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-07-03 13:35:51 -07:00
|
|
|
LayersBackend backend = aForwarder->GetCompositorBackendType();
|
2014-01-23 10:26:41 -08:00
|
|
|
if (backend != LayersBackend::LAYERS_OPENGL &&
|
|
|
|
backend != LayersBackend::LAYERS_D3D9 &&
|
|
|
|
backend != LayersBackend::LAYERS_D3D11 &&
|
|
|
|
backend != LayersBackend::LAYERS_BASIC) {
|
2013-08-04 00:46:17 -07:00
|
|
|
return 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
|
|
|
}
|
2013-05-03 10:34:29 -07:00
|
|
|
|
|
|
|
bool useDoubleBuffering = false;
|
2013-12-05 10:39:22 -08:00
|
|
|
bool useDeprecatedTextures = true;
|
|
|
|
// XXX We need support for gralloc with non-deprecated textures content before
|
|
|
|
// we can use them with FirefoxOS (bug 946720). We need the same locking for
|
|
|
|
// Windows.
|
|
|
|
#if !defined(MOZ_WIDGET_GONK) && !defined(XP_WIN)
|
|
|
|
useDeprecatedTextures = gfxPlatform::GetPlatform()->UseDeprecatedTextures();
|
|
|
|
#endif
|
2013-05-03 10:34:29 -07:00
|
|
|
|
|
|
|
#ifdef XP_WIN
|
2014-01-23 10:26:41 -08:00
|
|
|
if (backend == LayersBackend::LAYERS_D3D11) {
|
2013-05-03 10:34:29 -07:00
|
|
|
useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD2DDevice();
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2014-02-07 05:24:30 -08:00
|
|
|
useDoubleBuffering = LayerManagerComposite::SupportsDirectTexturing() ||
|
2014-01-23 10:26:41 -08:00
|
|
|
backend == LayersBackend::LAYERS_BASIC;
|
2013-05-03 10:34:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
|
2013-12-05 10:39:22 -08:00
|
|
|
if (useDeprecatedTextures) {
|
2013-12-05 10:39:22 -08:00
|
|
|
return new DeprecatedContentClientDoubleBuffered(aForwarder);
|
|
|
|
} else {
|
|
|
|
return new ContentClientDoubleBuffered(aForwarder);
|
|
|
|
}
|
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-05-15 20:45:43 -07:00
|
|
|
#ifdef XP_MACOSX
|
2014-01-23 10:26:41 -08:00
|
|
|
if (backend == LayersBackend::LAYERS_OPENGL) {
|
2013-06-06 22:10:31 -07:00
|
|
|
return new ContentClientIncremental(aForwarder);
|
|
|
|
}
|
2013-05-15 20:45:43 -07:00
|
|
|
#endif
|
2013-12-05 10:39:22 -08:00
|
|
|
if (useDeprecatedTextures) {
|
2013-12-05 10:39:22 -08:00
|
|
|
return new DeprecatedContentClientSingleBuffered(aForwarder);
|
|
|
|
} else {
|
|
|
|
return new ContentClientSingleBuffered(aForwarder);
|
|
|
|
}
|
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-27 19:19:56 -08:00
|
|
|
// We pass a null pointer for the ContentClient Forwarder argument, which means
|
|
|
|
// this client will not have a ContentHost on the other side.
|
|
|
|
ContentClientBasic::ContentClientBasic()
|
|
|
|
: ContentClient(nullptr)
|
2013-11-26 16:29:46 -08:00
|
|
|
, RotatedContentBuffer(ContainsVisibleBounds)
|
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-09-11 21:53:46 -07:00
|
|
|
void
|
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
|
|
|
ContentClientBasic::CreateBuffer(ContentType aType,
|
|
|
|
const nsIntRect& aRect,
|
2013-04-21 19:40:52 -07:00
|
|
|
uint32_t aFlags,
|
2013-09-11 21:53:46 -07:00
|
|
|
RefPtr<gfx::DrawTarget>* aBlackDT,
|
|
|
|
RefPtr<gfx::DrawTarget>* aWhiteDT)
|
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-08-22 23:13:55 -07:00
|
|
|
MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA));
|
2013-11-26 16:29:45 -08:00
|
|
|
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
|
|
|
|
gfxImageFormat format =
|
|
|
|
gfxPlatform::GetPlatform()->OptimalFormatForContent(aType);
|
2013-09-11 21:53:46 -07:00
|
|
|
|
2013-11-26 16:29:45 -08:00
|
|
|
*aBlackDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
|
|
|
|
IntSize(aRect.width, aRect.height),
|
|
|
|
ImageFormatToSurfaceFormat(format));
|
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-27 13:16:34 -08:00
|
|
|
void
|
2013-11-27 13:16:35 -08:00
|
|
|
ContentClientRemoteBuffer::DestroyBuffers()
|
2013-12-05 10:39:22 -08:00
|
|
|
{
|
|
|
|
if (!mTextureClient) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mOldTextures.AppendElement(mTextureClient);
|
|
|
|
mTextureClient = nullptr;
|
|
|
|
if (mTextureClientOnWhite) {
|
|
|
|
mOldTextures.AppendElement(mTextureClientOnWhite);
|
|
|
|
mTextureClientOnWhite = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
DestroyFrontBuffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientRemoteBuffer::BeginPaint()
|
|
|
|
{
|
|
|
|
// XXX: So we might not have a DeprecatedTextureClient yet.. because it will
|
|
|
|
// only be created by CreateBuffer.. which will deliver a locked surface!.
|
|
|
|
if (mTextureClient) {
|
|
|
|
SetBufferProvider(mTextureClient);
|
|
|
|
}
|
|
|
|
if (mTextureClientOnWhite) {
|
|
|
|
SetBufferProviderOnWhite(mTextureClientOnWhite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientRemoteBuffer::EndPaint()
|
|
|
|
{
|
|
|
|
// XXX: We might still not have a texture client if PaintThebes
|
|
|
|
// decided we didn't need one yet because the region to draw was empty.
|
|
|
|
SetBufferProvider(nullptr);
|
|
|
|
SetBufferProviderOnWhite(nullptr);
|
2014-01-23 06:26:59 -08:00
|
|
|
for (unsigned i = 0; i< mOldTextures.Length(); ++i) {
|
2014-01-24 06:25:04 -08:00
|
|
|
if (mOldTextures[i]->IsLocked()) {
|
|
|
|
mOldTextures[i]->Unlock();
|
|
|
|
}
|
2014-01-23 06:26:59 -08:00
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
mOldTextures.Clear();
|
|
|
|
|
|
|
|
if (mTextureClient) {
|
|
|
|
mTextureClient->Unlock();
|
|
|
|
}
|
|
|
|
if (mTextureClientOnWhite) {
|
|
|
|
mTextureClientOnWhite->Unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>& aClient,
|
|
|
|
TextureFlags aFlags)
|
|
|
|
{
|
|
|
|
aClient = CreateTextureClientForDrawing(mSurfaceFormat,
|
|
|
|
mTextureInfo.mTextureFlags | aFlags);
|
|
|
|
if (!aClient) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!aClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
|
|
|
|
aClient = CreateTextureClientForDrawing(mSurfaceFormat,
|
|
|
|
mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags);
|
|
|
|
if (!aClient) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!aClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
|
|
|
|
NS_WARNING("Could not allocate texture client");
|
|
|
|
aClient = nullptr;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_WARN_IF_FALSE(aClient->IsValid(), "Created an invalid texture client");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
|
|
|
|
const nsIntRect& aRect,
|
|
|
|
uint32_t aFlags)
|
|
|
|
{
|
|
|
|
// If we hit this assertion, then it might be due to an empty transaction
|
|
|
|
// followed by a real transaction. Our buffers should be created (but not
|
|
|
|
// painted in the empty transaction) and then painted (but not created) in the
|
|
|
|
// real transaction. That is kind of fragile, and this assert will catch
|
|
|
|
// circumstances where we screw that up, e.g., by unnecessarily recreating our
|
|
|
|
// buffers.
|
|
|
|
NS_ABORT_IF_FALSE(!mIsNewBuffer,
|
|
|
|
"Bad! Did we create a buffer twice without painting?");
|
|
|
|
|
|
|
|
mIsNewBuffer = true;
|
|
|
|
|
|
|
|
DestroyBuffers();
|
|
|
|
|
|
|
|
mSurfaceFormat = aFormat;
|
|
|
|
mSize = gfx::IntSize(aRect.width, aRect.height);
|
|
|
|
mTextureInfo.mTextureFlags = (aFlags & ~TEXTURE_DEALLOCATE_CLIENT) |
|
|
|
|
TEXTURE_DEALLOCATE_DEFERRED;
|
|
|
|
|
|
|
|
if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
|
|
|
|
!AddTextureClient(mTextureClient)) {
|
|
|
|
AbortTextureClientCreation();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
|
|
|
if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) ||
|
|
|
|
!AddTextureClient(mTextureClientOnWhite)) {
|
|
|
|
AbortTextureClientCreation();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
|
|
|
|
}
|
|
|
|
|
|
|
|
CreateFrontBuffer(aRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
|
|
|
|
const nsIntRect& aRect,
|
|
|
|
uint32_t aFlags,
|
|
|
|
RefPtr<gfx::DrawTarget>* aBlackDT,
|
|
|
|
RefPtr<gfx::DrawTarget>* aWhiteDT)
|
|
|
|
{
|
|
|
|
BuildTextureClients(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType), aRect, aFlags);
|
|
|
|
if (!mTextureClient) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-23 06:26:59 -08:00
|
|
|
// We just created the textures and we are about to get their draw targets
|
|
|
|
// so we have to lock them here.
|
|
|
|
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked, "Could not lock the TextureClient");
|
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
*aBlackDT = mTextureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
|
|
|
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
2014-01-23 06:26:59 -08:00
|
|
|
locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
|
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
*aWhiteDT = mTextureClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIntRegion
|
|
|
|
ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
|
|
|
|
const nsIntRegion& aVisibleRegion,
|
|
|
|
bool aDidSelfCopy)
|
|
|
|
{
|
|
|
|
nsIntRegion updatedRegion;
|
|
|
|
if (mIsNewBuffer || aDidSelfCopy) {
|
|
|
|
// A buffer reallocation clears both buffers. The front buffer has all the
|
|
|
|
// content by now, but the back buffer is still clear. Here, in effect, we
|
|
|
|
// are saying to copy all of the pixels of the front buffer to the back.
|
|
|
|
// Also when we self-copied in the buffer, the buffer space
|
|
|
|
// changes and some changed buffer content isn't reflected in the
|
|
|
|
// draw or invalidate region (on purpose!). When this happens, we
|
|
|
|
// need to read back the entire buffer too.
|
|
|
|
updatedRegion = aVisibleRegion;
|
|
|
|
mIsNewBuffer = false;
|
|
|
|
} else {
|
|
|
|
updatedRegion = aRegionToDraw;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
|
|
|
|
"Update outside of buffer rect!");
|
|
|
|
NS_ABORT_IF_FALSE(mTextureClient, "should have a back buffer by now");
|
|
|
|
|
|
|
|
return updatedRegion;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
|
|
|
|
const nsIntRegion& aVisibleRegion,
|
|
|
|
bool aDidSelfCopy)
|
|
|
|
{
|
|
|
|
nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
|
|
|
|
aVisibleRegion,
|
|
|
|
aDidSelfCopy);
|
|
|
|
|
|
|
|
MOZ_ASSERT(mTextureClient);
|
2014-01-23 06:14:58 -08:00
|
|
|
if (mTextureClientOnWhite) {
|
2014-02-06 03:28:29 -08:00
|
|
|
mForwarder->UseComponentAlphaTextures(this, mTextureClient,
|
|
|
|
mTextureClientOnWhite);
|
|
|
|
} else {
|
|
|
|
mForwarder->UseTexture(this, mTextureClient);
|
2014-01-23 06:14:58 -08:00
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
mForwarder->UpdateTextureRegion(this,
|
|
|
|
ThebesBufferData(BufferRect(),
|
|
|
|
BufferRotation()),
|
|
|
|
updatedRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mTextureClient);
|
|
|
|
mFrontAndBackBufferDiffer = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DeprecatedContentClientRemoteBuffer::DestroyBuffers()
|
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-07-08 14:30:44 -07:00
|
|
|
if (!mDeprecatedTextureClient) {
|
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
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureClient = nullptr;
|
|
|
|
mDeprecatedTextureClientOnWhite = 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
|
|
|
|
|
|
|
DestroyFrontBuffer();
|
|
|
|
|
|
|
|
mForwarder->DestroyThebesBuffer(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::BeginPaint()
|
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-07-08 14:30:44 -07:00
|
|
|
// XXX: So we might not have a DeprecatedTextureClient yet.. because it will
|
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 be created by CreateBuffer.. which will deliver a locked surface!.
|
2013-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClient) {
|
2013-12-05 10:39:22 -08:00
|
|
|
SetDeprecatedBufferProvider(mDeprecatedTextureClient);
|
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-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
2013-12-05 10:39:22 -08:00
|
|
|
SetDeprecatedBufferProviderOnWhite(mDeprecatedTextureClientOnWhite);
|
2013-04-21 19:40:52 -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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::EndPaint()
|
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
|
|
|
{
|
|
|
|
// XXX: We might still not have a texture client if PaintThebes
|
|
|
|
// decided we didn't need one yet because the region to draw was empty.
|
2013-12-05 10:39:22 -08:00
|
|
|
SetDeprecatedBufferProvider(nullptr);
|
|
|
|
SetDeprecatedBufferProviderOnWhite(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
|
|
|
mOldTextures.Clear();
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClient) {
|
|
|
|
mDeprecatedTextureClient->Unlock();
|
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-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
|
|
|
mDeprecatedTextureClientOnWhite->Unlock();
|
2013-04-21 19:40:52 -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
|
|
|
}
|
|
|
|
|
2013-08-04 00:46:17 -07:00
|
|
|
bool
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient)
|
2013-08-04 00:46:17 -07:00
|
|
|
{
|
2013-09-23 18:14:12 -07:00
|
|
|
aClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT, mContentType);
|
2013-08-04 00:46:17 -07:00
|
|
|
MOZ_ASSERT(aClient, "Failed to create texture client");
|
|
|
|
|
|
|
|
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
2013-09-23 18:14:12 -07:00
|
|
|
aClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, mContentType);
|
2013-08-04 00:46:17 -07:00
|
|
|
MOZ_ASSERT(aClient, "Failed to create texture client");
|
|
|
|
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
|
|
|
NS_WARNING("Could not allocate texture client");
|
2013-09-23 18:14:12 -07:00
|
|
|
aClient->SetFlags(0);
|
|
|
|
aClient = nullptr;
|
2013-08-04 00:46:17 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(IsSurfaceDescriptorValid(*aClient->GetDescriptor()));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-04-14 18:25:14 -07:00
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
|
2013-05-15 20:45:42 -07:00
|
|
|
const nsIntRect& aRect,
|
|
|
|
uint32_t aFlags)
|
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
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!mIsNewBuffer,
|
|
|
|
"Bad! Did we create a buffer twice without painting?");
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClient) {
|
|
|
|
mOldTextures.AppendElement(mDeprecatedTextureClient);
|
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
|
|
|
mOldTextures.AppendElement(mDeprecatedTextureClientOnWhite);
|
2013-04-21 19:40:52 -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
|
|
|
DestroyBuffers();
|
|
|
|
}
|
|
|
|
|
|
|
|
mContentType = aType;
|
|
|
|
mSize = gfx::IntSize(aRect.width, aRect.height);
|
2013-10-02 13:52:04 -07:00
|
|
|
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
|
2013-08-04 00:46:17 -07:00
|
|
|
|
|
|
|
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClient)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
|
|
|
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClientOnWhite)) {
|
2013-09-23 18:14:12 -07:00
|
|
|
mDeprecatedTextureClient->SetFlags(0);
|
|
|
|
mDeprecatedTextureClient = nullptr;
|
2013-08-04 00:46:17 -07:00
|
|
|
return;
|
|
|
|
}
|
2013-08-06 10:36:35 -07:00
|
|
|
mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
|
2013-04-21 19:40:52 -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
|
|
|
|
2013-04-12 00:28:55 -07:00
|
|
|
CreateFrontBufferAndNotify(aRect);
|
2013-11-21 14:07:55 -08:00
|
|
|
mIsNewBuffer = true;
|
2013-04-14 18:25:14 -07:00
|
|
|
}
|
2013-08-23 01:12:30 -07:00
|
|
|
|
2013-09-11 21:53:46 -07:00
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::CreateBuffer(ContentType aType,
|
2013-05-15 20:45:42 -07:00
|
|
|
const nsIntRect& aRect,
|
|
|
|
uint32_t aFlags,
|
2013-09-11 21:53:46 -07:00
|
|
|
RefPtr<gfx::DrawTarget>* aBlackDT,
|
|
|
|
RefPtr<gfx::DrawTarget>* aWhiteDT)
|
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-07-08 14:30:44 -07:00
|
|
|
BuildDeprecatedTextureClients(aType, aRect, aFlags);
|
2013-09-23 18:14:12 -07:00
|
|
|
if (!mDeprecatedTextureClient) {
|
|
|
|
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
|
|
|
|
2013-11-26 16:29:45 -08:00
|
|
|
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContentForType(
|
|
|
|
mDeprecatedTextureClient->BackendType()));
|
|
|
|
*aBlackDT = mDeprecatedTextureClient->LockDrawTarget();
|
|
|
|
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
|
|
|
*aWhiteDT = mDeprecatedTextureClientOnWhite->LockDrawTarget();
|
2013-04-21 19:40:52 -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
|
|
|
}
|
|
|
|
|
|
|
|
nsIntRegion
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
|
2013-05-15 20:45:42 -07:00
|
|
|
const nsIntRegion& aVisibleRegion,
|
|
|
|
bool aDidSelfCopy)
|
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
|
|
|
{
|
|
|
|
nsIntRegion updatedRegion;
|
|
|
|
if (mIsNewBuffer || aDidSelfCopy) {
|
|
|
|
// A buffer reallocation clears both buffers. The front buffer has all the
|
|
|
|
// content by now, but the back buffer is still clear. Here, in effect, we
|
|
|
|
// are saying to copy all of the pixels of the front buffer to the back.
|
|
|
|
// Also when we self-copied in the buffer, the buffer space
|
|
|
|
// changes and some changed buffer content isn't reflected in the
|
|
|
|
// draw or invalidate region (on purpose!). When this happens, we
|
|
|
|
// need to read back the entire buffer too.
|
|
|
|
updatedRegion = aVisibleRegion;
|
|
|
|
mIsNewBuffer = false;
|
|
|
|
} else {
|
|
|
|
updatedRegion = aRegionToDraw;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
|
|
|
|
"Update outside of buffer rect!");
|
2013-07-08 14:30:44 -07:00
|
|
|
NS_ABORT_IF_FALSE(mDeprecatedTextureClient, "should have a back buffer by now");
|
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
|
|
|
|
|
|
|
return updatedRegion;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
|
2013-05-15 20:45:42 -07:00
|
|
|
const nsIntRegion& aVisibleRegion,
|
|
|
|
bool aDidSelfCopy)
|
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
|
|
|
{
|
|
|
|
nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
|
|
|
|
aVisibleRegion,
|
|
|
|
aDidSelfCopy);
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
MOZ_ASSERT(mDeprecatedTextureClient);
|
|
|
|
mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
|
|
|
mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
2013-04-21 19:40:52 -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
|
|
|
LockFrontBuffer();
|
|
|
|
mForwarder->UpdateTextureRegion(this,
|
|
|
|
ThebesBufferData(BufferRect(),
|
|
|
|
BufferRotation()),
|
|
|
|
updatedRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
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-07-08 14:30:44 -07:00
|
|
|
MOZ_ASSERT(mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
|
|
|
|
MOZ_ASSERT(!mDeprecatedTextureClientOnWhite || mDeprecatedTextureClientOnWhite->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
|
|
|
|
MOZ_ASSERT(mDeprecatedTextureClient);
|
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
|
|
|
|
|
|
|
mFrontAndBackBufferDiffer = true;
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
|
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
|
|
|
mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
|
2013-04-21 19:40:52 -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
|
|
|
}
|
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
void
|
|
|
|
ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
|
|
|
|
{
|
|
|
|
if (!CreateAndAllocateTextureClient(mFrontClient, TEXTURE_ON_BLACK) ||
|
|
|
|
!AddTextureClient(mFrontClient)) {
|
|
|
|
AbortTextureClientCreation();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
|
|
|
|
if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TEXTURE_ON_WHITE) ||
|
|
|
|
!AddTextureClient(mFrontClientOnWhite)) {
|
|
|
|
AbortTextureClientCreation();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mFrontBufferRect = aBufferRect;
|
|
|
|
mFrontBufferRotation = nsIntPoint();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientDoubleBuffered::DestroyFrontBuffer()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mFrontClient);
|
|
|
|
|
|
|
|
mOldTextures.AppendElement(mFrontClient);
|
|
|
|
mFrontClient = nullptr;
|
|
|
|
if (mFrontClientOnWhite) {
|
|
|
|
mOldTextures.AppendElement(mFrontClientOnWhite);
|
|
|
|
mFrontClientOnWhite = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
|
|
|
{
|
|
|
|
mFrontUpdatedRegion = aFrontUpdatedRegion;
|
|
|
|
|
|
|
|
RefPtr<TextureClient> oldBack = mTextureClient;
|
|
|
|
mTextureClient = mFrontClient;
|
|
|
|
mFrontClient = oldBack;
|
|
|
|
|
|
|
|
oldBack = mTextureClientOnWhite;
|
|
|
|
mTextureClientOnWhite = mFrontClientOnWhite;
|
|
|
|
mFrontClientOnWhite = oldBack;
|
|
|
|
|
|
|
|
nsIntRect oldBufferRect = mBufferRect;
|
|
|
|
mBufferRect = mFrontBufferRect;
|
|
|
|
mFrontBufferRect = oldBufferRect;
|
|
|
|
|
|
|
|
nsIntPoint oldBufferRotation = mBufferRotation;
|
|
|
|
mBufferRotation = mFrontBufferRotation;
|
|
|
|
mFrontBufferRotation = oldBufferRotation;
|
|
|
|
|
|
|
|
MOZ_ASSERT(mFrontClient);
|
|
|
|
|
|
|
|
ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-12 11:54:40 -08:00
|
|
|
ContentClientDoubleBuffered::PrepareFrame()
|
2013-12-05 10:39:22 -08:00
|
|
|
{
|
2014-01-12 11:54:40 -08:00
|
|
|
mIsNewBuffer = false;
|
|
|
|
|
2014-01-24 06:25:04 -08:00
|
|
|
if (mTextureClient) {
|
|
|
|
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked);
|
|
|
|
}
|
|
|
|
if (mTextureClientOnWhite) {
|
|
|
|
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked);
|
|
|
|
}
|
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
if (!mFrontAndBackBufferDiffer) {
|
|
|
|
return;
|
|
|
|
}
|
2014-01-12 11:54:40 -08:00
|
|
|
|
|
|
|
if (mDidSelfCopy) {
|
|
|
|
// We can't easily draw our front buffer into us, since we're going to be
|
|
|
|
// copying stuff around anyway it's easiest if we just move our situation
|
|
|
|
// to non-rotated while we're at it. If this situation occurs we'll have
|
|
|
|
// hit a self-copy path in PaintThebes before as well anyway.
|
|
|
|
mBufferRect.MoveTo(mFrontBufferRect.TopLeft());
|
|
|
|
mBufferRotation = nsIntPoint();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mBufferRect = mFrontBufferRect;
|
|
|
|
mBufferRotation = mFrontBufferRotation;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sync front/back buffers content
|
|
|
|
// After executing, the new back buffer has the same (interesting) pixels as
|
|
|
|
// the new front buffer, and mValidRegion et al. are correct wrt the new
|
|
|
|
// back buffer (i.e. as they were for the old back buffer)
|
|
|
|
void
|
|
|
|
ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
|
|
|
|
{
|
|
|
|
if (!mFrontAndBackBufferDiffer) {
|
|
|
|
MOZ_ASSERT(!mDidSelfCopy, "If we have to copy the world, then our buffers are different, right?");
|
|
|
|
return;
|
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
MOZ_ASSERT(mFrontClient);
|
|
|
|
|
|
|
|
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
|
|
|
|
this,
|
|
|
|
mFrontUpdatedRegion.GetBounds().x,
|
|
|
|
mFrontUpdatedRegion.GetBounds().y,
|
|
|
|
mFrontUpdatedRegion.GetBounds().width,
|
|
|
|
mFrontUpdatedRegion.GetBounds().height));
|
|
|
|
|
2014-01-12 11:54:40 -08:00
|
|
|
mFrontAndBackBufferDiffer = false;
|
2013-12-05 10:39:22 -08:00
|
|
|
|
2014-01-12 11:54:40 -08:00
|
|
|
nsIntRegion updateRegion = mFrontUpdatedRegion;
|
2013-12-05 10:39:22 -08:00
|
|
|
if (mDidSelfCopy) {
|
|
|
|
mDidSelfCopy = false;
|
|
|
|
updateRegion = mBufferRect;
|
|
|
|
}
|
|
|
|
|
2014-01-12 11:54:40 -08:00
|
|
|
// No point in sync'ing what we are going to draw over anyway. And if there is
|
|
|
|
// nothing to sync at all, there is nothing to do and we can go home early.
|
|
|
|
updateRegion.Sub(updateRegion, aRegionToDraw);
|
|
|
|
if (updateRegion.IsEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
|
|
|
|
// We need to ensure that we lock these two buffers in the same
|
|
|
|
// order as the compositor to prevent deadlocks.
|
|
|
|
if (!mFrontClient->Lock(OPEN_READ_ONLY)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (mFrontClientOnWhite &&
|
|
|
|
!mFrontClientOnWhite->Lock(OPEN_READ_ONLY)) {
|
|
|
|
mFrontClient->Unlock();
|
|
|
|
return;
|
|
|
|
}
|
2014-02-04 12:35:22 -08:00
|
|
|
{
|
|
|
|
// Restrict the DrawTargets and frontBuffer to a scope to make
|
|
|
|
// sure there is no more external references to the DrawTargets
|
|
|
|
// when we Unlock the TextureClients.
|
|
|
|
RefPtr<DrawTarget> dt =
|
|
|
|
mFrontClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
|
|
|
RefPtr<DrawTarget> dtOnWhite = mFrontClientOnWhite
|
|
|
|
? mFrontClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget()
|
|
|
|
: nullptr;
|
|
|
|
RotatedBuffer frontBuffer(dt,
|
|
|
|
dtOnWhite,
|
|
|
|
mFrontBufferRect,
|
|
|
|
mFrontBufferRotation);
|
|
|
|
UpdateDestinationFrom(frontBuffer, updateRegion);
|
|
|
|
}
|
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
mFrontClient->Unlock();
|
|
|
|
if (mFrontClientOnWhite) {
|
|
|
|
mFrontClientOnWhite->Unlock();
|
|
|
|
}
|
|
|
|
}
|
2013-11-27 13:16:34 -08:00
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
void
|
|
|
|
ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
|
|
|
const nsIntRegion& aUpdateRegion)
|
|
|
|
{
|
2014-01-07 13:09:34 -08:00
|
|
|
DrawTarget* destDT =
|
|
|
|
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
|
2014-01-16 12:52:52 -08:00
|
|
|
if (!destDT) {
|
|
|
|
return;
|
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
|
2014-01-07 13:09:34 -08:00
|
|
|
bool isClippingCheap = IsClippingCheap(destDT, aUpdateRegion);
|
2013-12-05 10:39:22 -08:00
|
|
|
if (isClippingCheap) {
|
2014-01-07 13:09:34 -08:00
|
|
|
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
|
2013-12-05 10:39:22 -08:00
|
|
|
}
|
|
|
|
|
2014-01-10 11:06:17 -08:00
|
|
|
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
|
2014-01-07 13:09:34 -08:00
|
|
|
if (isClippingCheap) {
|
|
|
|
destDT->PopClip();
|
|
|
|
}
|
2014-02-04 12:35:22 -08:00
|
|
|
// Flush the destination before the sources become inaccessible (Unlock).
|
|
|
|
destDT->Flush();
|
2014-01-23 22:58:33 -08:00
|
|
|
ReturnDrawTargetToBuffer(destDT);
|
2013-12-05 10:39:22 -08:00
|
|
|
|
|
|
|
if (aSource.HaveBufferOnWhite()) {
|
|
|
|
MOZ_ASSERT(HaveBufferOnWhite());
|
2014-01-07 13:09:34 -08:00
|
|
|
DrawTarget* destDT =
|
|
|
|
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE);
|
2014-01-16 12:52:52 -08:00
|
|
|
if (!destDT) {
|
|
|
|
return;
|
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
|
2014-01-07 13:09:34 -08:00
|
|
|
bool isClippingCheap = IsClippingCheap(destDT, aUpdateRegion);
|
2013-12-05 10:39:22 -08:00
|
|
|
if (isClippingCheap) {
|
2014-01-07 13:09:34 -08:00
|
|
|
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
|
2013-12-05 10:39:22 -08:00
|
|
|
}
|
|
|
|
|
2014-01-10 11:06:17 -08:00
|
|
|
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
|
2014-01-07 13:09:34 -08:00
|
|
|
if (isClippingCheap) {
|
|
|
|
destDT->PopClip();
|
|
|
|
}
|
2014-02-04 12:35:22 -08:00
|
|
|
// Flush the destination before the sources become inaccessible (Unlock).
|
|
|
|
destDT->Flush();
|
2014-01-23 22:58:33 -08:00
|
|
|
ReturnDrawTargetToBuffer(destDT);
|
2013-12-05 10:39:22 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DeprecatedContentClientDoubleBuffered::~DeprecatedContentClientDoubleBuffered()
|
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-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClient) {
|
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
|
|
|
MOZ_ASSERT(mFrontClient);
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
|
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
|
|
|
mFrontClient->SetDescriptor(SurfaceDescriptor());
|
|
|
|
}
|
2013-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
2013-04-21 19:40:52 -07:00
|
|
|
MOZ_ASSERT(mFrontClientOnWhite);
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
2013-04-21 19:40:52 -07:00
|
|
|
mFrontClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
|
|
|
}
|
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
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
|
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-08-04 00:46:17 -07:00
|
|
|
if (!CreateAndAllocateDeprecatedTextureClient(mFrontClient)) {
|
2013-09-23 18:14:12 -07:00
|
|
|
mDeprecatedTextureClient->SetFlags(0);
|
|
|
|
mDeprecatedTextureClient = nullptr;
|
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
|
|
|
mDeprecatedTextureClientOnWhite->SetFlags(0);
|
|
|
|
mDeprecatedTextureClientOnWhite = nullptr;
|
|
|
|
}
|
2013-08-04 00:46:17 -07:00
|
|
|
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
|
|
|
|
2013-08-06 10:36:35 -07:00
|
|
|
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
|
2013-08-04 00:46:17 -07:00
|
|
|
if (!CreateAndAllocateDeprecatedTextureClient(mFrontClientOnWhite)) {
|
2013-09-23 18:14:12 -07:00
|
|
|
mDeprecatedTextureClient->SetFlags(0);
|
|
|
|
mDeprecatedTextureClient = nullptr;
|
|
|
|
mDeprecatedTextureClientOnWhite->SetFlags(0);
|
|
|
|
mDeprecatedTextureClientOnWhite = nullptr;
|
|
|
|
mFrontClient->SetFlags(0);
|
|
|
|
mFrontClient = nullptr;
|
2013-08-04 00:46:17 -07:00
|
|
|
return;
|
|
|
|
}
|
2013-04-21 19:40:52 -07:00
|
|
|
}
|
2013-08-04 00:46:17 -07:00
|
|
|
|
|
|
|
mFrontBufferRect = aBufferRect;
|
|
|
|
mFrontBufferRotation = nsIntPoint();
|
2013-04-21 19:40:52 -07:00
|
|
|
|
2013-04-12 00:28:55 -07:00
|
|
|
mForwarder->CreatedDoubleBuffer(this,
|
2013-09-23 18:14:12 -07:00
|
|
|
*mFrontClient->LockSurfaceDescriptor(),
|
|
|
|
*mDeprecatedTextureClient->LockSurfaceDescriptor(),
|
2013-04-21 19:40:52 -07:00
|
|
|
mTextureInfo,
|
2013-09-23 18:14:12 -07:00
|
|
|
mFrontClientOnWhite ? mFrontClientOnWhite->LockSurfaceDescriptor() : nullptr,
|
|
|
|
mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->LockSurfaceDescriptor() : 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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientDoubleBuffered::DestroyFrontBuffer()
|
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
|
|
|
{
|
|
|
|
MOZ_ASSERT(mFrontClient);
|
2013-07-08 14:30:44 -07:00
|
|
|
MOZ_ASSERT(mFrontClient->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
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
|
|
|
|
|
|
|
mFrontClient = nullptr;
|
2013-04-21 19:40:52 -07:00
|
|
|
mFrontClientOnWhite = 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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientDoubleBuffered::LockFrontBuffer()
|
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
|
|
|
{
|
|
|
|
MOZ_ASSERT(mFrontClient);
|
2013-07-08 14:30:44 -07:00
|
|
|
mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
2013-04-21 19:40:52 -07:00
|
|
|
if (mFrontClientOnWhite) {
|
2013-07-08 14:30:44 -07:00
|
|
|
mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
2013-04-21 19:40:52 -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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
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
|
|
|
{
|
|
|
|
mFrontUpdatedRegion = aFrontUpdatedRegion;
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
RefPtr<DeprecatedTextureClient> oldBack = mDeprecatedTextureClient;
|
|
|
|
mDeprecatedTextureClient = mFrontClient;
|
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
|
|
|
mFrontClient = oldBack;
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
oldBack = mDeprecatedTextureClientOnWhite;
|
|
|
|
mDeprecatedTextureClientOnWhite = mFrontClientOnWhite;
|
2013-04-21 19:40:52 -07:00
|
|
|
mFrontClientOnWhite = oldBack;
|
|
|
|
|
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
|
|
|
nsIntRect oldBufferRect = mBufferRect;
|
|
|
|
mBufferRect = mFrontBufferRect;
|
|
|
|
mFrontBufferRect = oldBufferRect;
|
|
|
|
|
|
|
|
nsIntPoint oldBufferRotation = mBufferRotation;
|
|
|
|
mBufferRotation = mFrontBufferRotation;
|
|
|
|
mFrontBufferRotation = oldBufferRotation;
|
|
|
|
|
|
|
|
MOZ_ASSERT(mFrontClient);
|
2013-07-08 14:30:44 -07:00
|
|
|
mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
|
2013-04-21 19:40:52 -07:00
|
|
|
if (mFrontClientOnWhite) {
|
2013-07-08 14:30:44 -07:00
|
|
|
mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
|
2013-04-21 19:40:52 -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
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
|
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-07-08 14:30:44 -07:00
|
|
|
struct AutoDeprecatedTextureClient {
|
|
|
|
AutoDeprecatedTextureClient()
|
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
|
|
|
: mTexture(nullptr)
|
|
|
|
{}
|
2013-07-08 14:30:44 -07:00
|
|
|
~AutoDeprecatedTextureClient()
|
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 (mTexture) {
|
|
|
|
mTexture->Unlock();
|
|
|
|
}
|
|
|
|
}
|
2013-07-08 14:30:44 -07:00
|
|
|
DrawTarget* GetDrawTarget(DeprecatedTextureClient* aTexture)
|
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
|
|
|
{
|
|
|
|
MOZ_ASSERT(!mTexture);
|
|
|
|
mTexture = aTexture;
|
2013-04-21 19:40:52 -07:00
|
|
|
if (mTexture) {
|
|
|
|
return mTexture->LockDrawTarget();
|
|
|
|
}
|
|
|
|
return 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
|
|
|
}
|
|
|
|
private:
|
2013-07-08 14:30:44 -07:00
|
|
|
DeprecatedTextureClient* mTexture;
|
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
|
|
|
};
|
|
|
|
|
2014-01-12 11:54:40 -08: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
|
|
|
void
|
2014-01-12 11:54:40 -08:00
|
|
|
DeprecatedContentClientDoubleBuffered::PrepareFrame()
|
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-21 14:07:55 -08:00
|
|
|
mIsNewBuffer = false;
|
|
|
|
|
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 (!mFrontAndBackBufferDiffer) {
|
|
|
|
return;
|
|
|
|
}
|
2014-01-12 11:54:40 -08:00
|
|
|
|
|
|
|
if (mDidSelfCopy) {
|
|
|
|
// We can't easily draw our front buffer into us, since we're going to be
|
|
|
|
// copying stuff around anyway it's easiest if we just move our situation
|
|
|
|
// to non-rotated while we're at it. If this situation occurs we'll have
|
|
|
|
// hit a self-copy path in PaintThebes before as well anyway.
|
|
|
|
mBufferRect.MoveTo(mFrontBufferRect.TopLeft());
|
|
|
|
mBufferRotation = nsIntPoint();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mBufferRect = mFrontBufferRect;
|
|
|
|
mBufferRotation = mFrontBufferRotation;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DeprecatedContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
|
|
|
|
{
|
|
|
|
if (!mFrontAndBackBufferDiffer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mFrontAndBackBufferDiffer = false;
|
|
|
|
|
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
|
|
|
MOZ_ASSERT(mFrontClient);
|
2014-01-12 11:54:40 -08:00
|
|
|
MOZ_ASSERT(mFrontClient->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
2013-04-21 19:40:52 -07:00
|
|
|
MOZ_ASSERT(!mFrontClientOnWhite ||
|
2014-01-12 11:54:40 -08:00
|
|
|
mFrontClientOnWhite->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
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
|
|
|
|
|
|
|
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
|
|
|
|
this,
|
|
|
|
mFrontUpdatedRegion.GetBounds().x,
|
|
|
|
mFrontUpdatedRegion.GetBounds().y,
|
|
|
|
mFrontUpdatedRegion.GetBounds().width,
|
|
|
|
mFrontUpdatedRegion.GetBounds().height));
|
|
|
|
|
|
|
|
nsIntRegion updateRegion = mFrontUpdatedRegion;
|
2013-10-11 13:47:47 -07:00
|
|
|
if (mDidSelfCopy) {
|
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
|
|
|
updateRegion = mBufferRect;
|
2014-01-12 11:54:40 -08:00
|
|
|
mDidSelfCopy = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// No point in sync'ing what we are going to draw over anyway. And if there is
|
|
|
|
// nothing to sync at all, there is nothing to do and we can go home early.
|
|
|
|
updateRegion.Sub(updateRegion, aRegionToDraw);
|
|
|
|
if (updateRegion.IsEmpty()) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
AutoDeprecatedTextureClient autoTextureFront;
|
|
|
|
AutoDeprecatedTextureClient autoTextureFrontOnWhite;
|
2013-11-26 16:29:45 -08:00
|
|
|
// We need to ensure that we lock these two buffers in the same
|
|
|
|
// order as the compositor to prevent deadlocks.
|
|
|
|
DrawTarget* dt = autoTextureFront.GetDrawTarget(mFrontClient);
|
|
|
|
DrawTarget* dtOnWhite = autoTextureFrontOnWhite.GetDrawTarget(mFrontClientOnWhite);
|
|
|
|
RotatedBuffer frontBuffer(dt,
|
|
|
|
dtOnWhite,
|
|
|
|
mFrontBufferRect,
|
|
|
|
mFrontBufferRotation);
|
|
|
|
UpdateDestinationFrom(frontBuffer, updateRegion);
|
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
|
|
|
|
2014-01-08 16:57:52 -08:00
|
|
|
// We need to flush our buffers before we unlock our front textures
|
|
|
|
FlushBuffers();
|
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
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
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
|
|
|
const nsIntRegion& aUpdateRegion)
|
|
|
|
{
|
2014-01-07 13:09:34 -08:00
|
|
|
DrawTarget* destDT =
|
|
|
|
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
|
|
|
|
if (!destDT) {
|
2013-11-21 14:07:55 -08:00
|
|
|
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
|
|
|
|
2014-01-07 13:09:34 -08:00
|
|
|
bool isClippingCheap = IsClippingCheap(destDT, aUpdateRegion);
|
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 (isClippingCheap) {
|
2014-01-07 13:09:34 -08:00
|
|
|
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
|
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
|
|
|
}
|
|
|
|
|
2014-01-10 11:06:17 -08:00
|
|
|
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
|
2014-01-07 13:09:34 -08:00
|
|
|
if (isClippingCheap) {
|
|
|
|
destDT->PopClip();
|
|
|
|
}
|
2014-01-23 22:58:33 -08:00
|
|
|
ReturnDrawTargetToBuffer(destDT);
|
2013-04-21 19:40:52 -07:00
|
|
|
|
|
|
|
if (aSource.HaveBufferOnWhite()) {
|
|
|
|
MOZ_ASSERT(HaveBufferOnWhite());
|
2014-01-07 13:09:34 -08:00
|
|
|
DrawTarget* destDT =
|
|
|
|
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE);
|
2014-01-16 12:52:52 -08:00
|
|
|
if (!destDT) {
|
|
|
|
return;
|
|
|
|
}
|
2013-04-21 19:40:52 -07:00
|
|
|
|
2014-01-07 13:09:34 -08:00
|
|
|
bool isClippingCheap = IsClippingCheap(destDT, aUpdateRegion);
|
2013-04-21 19:40:52 -07:00
|
|
|
if (isClippingCheap) {
|
2014-01-07 13:09:34 -08:00
|
|
|
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
|
2013-04-21 19:40:52 -07:00
|
|
|
}
|
|
|
|
|
2014-01-10 11:06:17 -08:00
|
|
|
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
|
2014-01-07 13:09:34 -08:00
|
|
|
if (isClippingCheap) {
|
|
|
|
destDT->PopClip();
|
|
|
|
}
|
2014-01-23 22:58:33 -08:00
|
|
|
ReturnDrawTargetToBuffer(destDT);
|
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-12-05 10:39:22 -08:00
|
|
|
void
|
2014-01-12 11:54:40 -08:00
|
|
|
ContentClientSingleBuffered::PrepareFrame()
|
2013-12-05 10:39:22 -08:00
|
|
|
{
|
|
|
|
if (!mFrontAndBackBufferDiffer) {
|
2014-01-23 06:26:59 -08:00
|
|
|
if (mTextureClient) {
|
|
|
|
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked);
|
|
|
|
}
|
|
|
|
if (mTextureClientOnWhite) {
|
|
|
|
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked);
|
|
|
|
}
|
2013-12-05 10:39:22 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<DrawTarget> backBuffer = GetDTBuffer();
|
|
|
|
if (!backBuffer && mTextureClient) {
|
2014-01-23 06:26:59 -08:00
|
|
|
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked);
|
2013-12-05 10:39:22 -08:00
|
|
|
backBuffer = mTextureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<DrawTarget> oldBuffer;
|
|
|
|
oldBuffer = SetDTBuffer(backBuffer,
|
|
|
|
mBufferRect,
|
|
|
|
mBufferRotation);
|
|
|
|
|
|
|
|
backBuffer = GetDTBufferOnWhite();
|
|
|
|
if (!backBuffer && mTextureClientOnWhite) {
|
2014-01-23 06:26:59 -08:00
|
|
|
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
|
|
|
|
MOZ_ASSERT(locked);
|
2013-12-05 10:39:22 -08:00
|
|
|
backBuffer = mTextureClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
|
|
|
|
}
|
|
|
|
|
|
|
|
oldBuffer = SetDTBufferOnWhite(backBuffer);
|
|
|
|
|
|
|
|
mIsNewBuffer = false;
|
|
|
|
mFrontAndBackBufferDiffer = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DeprecatedContentClientSingleBuffered::~DeprecatedContentClientSingleBuffered()
|
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-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClient) {
|
|
|
|
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
|
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-07-08 14:30:44 -07:00
|
|
|
if (mDeprecatedTextureClientOnWhite) {
|
|
|
|
mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
2013-04-21 19:40:52 -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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-05 10:39:22 -08:00
|
|
|
DeprecatedContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
|
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-12 00:28:55 -07:00
|
|
|
mForwarder->CreatedSingleBuffer(this,
|
2013-09-23 18:14:12 -07:00
|
|
|
*mDeprecatedTextureClient->LockSurfaceDescriptor(),
|
2013-04-21 19:40:52 -07:00
|
|
|
mTextureInfo,
|
2013-09-23 18:14:12 -07:00
|
|
|
mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->LockSurfaceDescriptor() : 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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-12 11:54:40 -08:00
|
|
|
DeprecatedContentClientSingleBuffered::PrepareFrame()
|
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-21 14:07:55 -08:00
|
|
|
mIsNewBuffer = false;
|
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 (!mFrontAndBackBufferDiffer) {
|
|
|
|
return;
|
|
|
|
}
|
2013-11-21 14:07:55 -08:00
|
|
|
mFrontAndBackBufferDiffer = false;
|
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-26 16:29:45 -08:00
|
|
|
DrawTarget* backBuffer = GetDTBuffer();
|
|
|
|
if (!backBuffer && mDeprecatedTextureClient) {
|
|
|
|
backBuffer = mDeprecatedTextureClient->LockDrawTarget();
|
|
|
|
}
|
|
|
|
if (!backBuffer) {
|
|
|
|
NS_WARNING("Could not lock texture client");
|
|
|
|
return;
|
|
|
|
}
|
2013-08-08 16:30:18 -07:00
|
|
|
|
2013-11-26 16:29:45 -08:00
|
|
|
RefPtr<DrawTarget> oldBuffer;
|
|
|
|
oldBuffer = SetDTBuffer(backBuffer,
|
2013-08-08 16:30:18 -07:00
|
|
|
mBufferRect,
|
|
|
|
mBufferRotation);
|
|
|
|
|
2013-11-26 16:29:45 -08:00
|
|
|
backBuffer = GetDTBufferOnWhite();
|
|
|
|
if (!backBuffer && mDeprecatedTextureClientOnWhite) {
|
|
|
|
backBuffer = mDeprecatedTextureClientOnWhite->LockDrawTarget();
|
|
|
|
}
|
|
|
|
if (!backBuffer) {
|
2013-12-03 20:33:16 -08:00
|
|
|
NS_WARN_IF_FALSE(!mDeprecatedTextureClientOnWhite,
|
|
|
|
"Could not lock texture client (on white)");
|
2013-11-26 16:29:45 -08:00
|
|
|
return;
|
2013-08-08 16:30:18 -07:00
|
|
|
}
|
2013-11-26 16:29:45 -08:00
|
|
|
|
|
|
|
oldBuffer = SetDTBufferOnWhite(backBuffer);
|
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-05-15 20:45:43 -07:00
|
|
|
static void
|
|
|
|
WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
|
|
|
|
{
|
|
|
|
if (*aRotationPoint < 0) {
|
|
|
|
*aRotationPoint += aSize;
|
|
|
|
} else if (*aRotationPoint >= aSize) {
|
|
|
|
*aRotationPoint -= aSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion,
|
|
|
|
const nsIntPoint& aOffset, const gfxRGBA& aColor)
|
|
|
|
{
|
|
|
|
nsRefPtr<gfxContext> ctx = new gfxContext(aSurface);
|
|
|
|
ctx->Translate(-gfxPoint(aOffset.x, aOffset.y));
|
|
|
|
gfxUtils::ClipToRegion(ctx, aRegion);
|
|
|
|
ctx->SetColor(aColor);
|
|
|
|
ctx->Paint();
|
|
|
|
}
|
|
|
|
|
2013-11-26 16:29:46 -08:00
|
|
|
RotatedContentBuffer::PaintState
|
2013-05-15 20:45:43 -07:00
|
|
|
ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
|
|
|
|
uint32_t aFlags)
|
|
|
|
{
|
2013-07-08 14:30:44 -07:00
|
|
|
mTextureInfo.mDeprecatedTextureHostFlags = 0;
|
2013-05-15 20:45:43 -07:00
|
|
|
PaintState result;
|
|
|
|
// We need to disable rotation if we're going to be resampled when
|
|
|
|
// drawing, because we might sample across the rotation boundary.
|
2013-11-26 16:29:46 -08:00
|
|
|
bool canHaveRotation = !(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE);
|
2013-05-15 20:45:43 -07:00
|
|
|
|
|
|
|
nsIntRegion validRegion = aLayer->GetValidRegion();
|
|
|
|
|
2014-01-12 11:54:40 -08:00
|
|
|
bool canUseOpaqueSurface = aLayer->CanUseOpaqueSurface();
|
|
|
|
ContentType contentType =
|
2014-01-23 10:26:40 -08:00
|
|
|
canUseOpaqueSurface ? gfxContentType::COLOR :
|
|
|
|
gfxContentType::COLOR_ALPHA;
|
2014-01-12 11:54:40 -08:00
|
|
|
|
2014-01-17 06:00:00 -08:00
|
|
|
SurfaceMode mode;
|
2013-05-15 20:45:43 -07:00
|
|
|
nsIntRegion neededRegion;
|
|
|
|
bool canReuseBuffer;
|
|
|
|
nsIntRect destBufferRect;
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
mode = aLayer->GetSurfaceMode();
|
|
|
|
neededRegion = aLayer->GetVisibleRegion();
|
|
|
|
// If we're going to resample, we need a buffer that's in clamp mode.
|
|
|
|
canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
|
|
|
|
mHasBuffer &&
|
2013-11-26 16:29:46 -08:00
|
|
|
(!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
|
2013-08-06 10:36:35 -07:00
|
|
|
!(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT));
|
2013-05-15 20:45:43 -07:00
|
|
|
|
|
|
|
if (canReuseBuffer) {
|
|
|
|
if (mBufferRect.Contains(neededRegion.GetBounds())) {
|
|
|
|
// We don't need to adjust mBufferRect.
|
|
|
|
destBufferRect = mBufferRect;
|
|
|
|
} else {
|
|
|
|
// The buffer's big enough but doesn't contain everything that's
|
|
|
|
// going to be visible. We'll move it.
|
|
|
|
destBufferRect = nsIntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
destBufferRect = neededRegion.GetBounds();
|
|
|
|
}
|
|
|
|
|
2014-01-23 10:26:41 -08:00
|
|
|
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
2013-08-08 16:30:19 -07:00
|
|
|
if (!gfxPlatform::ComponentAlphaEnabled() ||
|
|
|
|
!aLayer->GetParent() ||
|
|
|
|
!aLayer->GetParent()->SupportsComponentAlphaChildren()) {
|
2014-01-23 10:26:41 -08:00
|
|
|
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
|
2013-05-15 20:45:43 -07:00
|
|
|
} else {
|
2014-01-23 10:26:40 -08:00
|
|
|
contentType = gfxContentType::COLOR;
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-26 16:29:46 -08:00
|
|
|
if ((aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) &&
|
2013-05-15 20:45:43 -07:00
|
|
|
(!neededRegion.GetBounds().IsEqualInterior(destBufferRect) ||
|
|
|
|
neededRegion.GetNumRects() > 1)) {
|
|
|
|
// The area we add to neededRegion might not be painted opaquely
|
2014-01-23 10:26:41 -08:00
|
|
|
if (mode == SurfaceMode::SURFACE_OPAQUE) {
|
2014-01-23 10:26:40 -08:00
|
|
|
contentType = gfxContentType::COLOR_ALPHA;
|
2014-01-23 10:26:41 -08:00
|
|
|
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
2014-01-23 10:26:40 -08:00
|
|
|
// For component alpha layers, we leave contentType as gfxContentType::COLOR.
|
2013-05-15 20:45:43 -07:00
|
|
|
|
|
|
|
// We need to validate the entire buffer, to make sure that only valid
|
|
|
|
// pixels are sampled
|
|
|
|
neededRegion = destBufferRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mHasBuffer &&
|
|
|
|
(mContentType != contentType ||
|
2014-01-23 10:26:41 -08:00
|
|
|
(mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) != mHasBufferOnWhite)) {
|
2013-05-15 20:45:43 -07:00
|
|
|
// We're effectively clearing the valid region, so we need to draw
|
|
|
|
// the entire needed region now.
|
|
|
|
result.mRegionToInvalidate = aLayer->GetValidRegion();
|
|
|
|
validRegion.SetEmpty();
|
|
|
|
mHasBuffer = false;
|
|
|
|
mHasBufferOnWhite = false;
|
|
|
|
mBufferRect.SetRect(0, 0, 0, 0);
|
|
|
|
mBufferRotation.MoveTo(0, 0);
|
|
|
|
// Restart decision process with the cleared buffer. We can only go
|
|
|
|
// around the loop one more iteration, since mTexImage is null now.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
result.mRegionToDraw.Sub(neededRegion, validRegion);
|
|
|
|
if (result.mRegionToDraw.IsEmpty())
|
|
|
|
return result;
|
|
|
|
|
|
|
|
if (destBufferRect.width > mForwarder->GetMaxTextureSize() ||
|
|
|
|
destBufferRect.height > mForwarder->GetMaxTextureSize()) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// BlitTextureImage depends on the FBO texture target being
|
|
|
|
// TEXTURE_2D. This isn't the case on some older X1600-era Radeons.
|
|
|
|
if (!mForwarder->SupportsTextureBlitting() ||
|
|
|
|
!mForwarder->SupportsPartialUploads()) {
|
|
|
|
result.mRegionToDraw = neededRegion;
|
|
|
|
validRegion.SetEmpty();
|
|
|
|
mHasBuffer = false;
|
|
|
|
mHasBufferOnWhite = false;
|
|
|
|
mBufferRect.SetRect(0, 0, 0, 0);
|
|
|
|
mBufferRotation.MoveTo(0, 0);
|
|
|
|
canReuseBuffer = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
|
|
|
|
bool createdBuffer = false;
|
|
|
|
|
2013-08-06 10:36:35 -07:00
|
|
|
uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
|
2014-01-23 10:26:41 -08:00
|
|
|
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
2013-08-06 10:36:35 -07:00
|
|
|
bufferFlags |= TEXTURE_COMPONENT_ALPHA;
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
if (canReuseBuffer) {
|
|
|
|
nsIntRect keepArea;
|
|
|
|
if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
|
|
|
|
// Set mBufferRotation so that the pixels currently in mBuffer
|
|
|
|
// will still be rendered in the right place when mBufferRect
|
|
|
|
// changes to destBufferRect.
|
|
|
|
nsIntPoint newRotation = mBufferRotation +
|
|
|
|
(destBufferRect.TopLeft() - mBufferRect.TopLeft());
|
|
|
|
WrapRotationAxis(&newRotation.x, mBufferRect.width);
|
|
|
|
WrapRotationAxis(&newRotation.y, mBufferRect.height);
|
|
|
|
NS_ASSERTION(nsIntRect(nsIntPoint(0,0), mBufferRect.Size()).Contains(newRotation),
|
|
|
|
"newRotation out of bounds");
|
|
|
|
int32_t xBoundary = destBufferRect.XMost() - newRotation.x;
|
|
|
|
int32_t yBoundary = destBufferRect.YMost() - newRotation.y;
|
|
|
|
if ((drawBounds.x < xBoundary && xBoundary < drawBounds.XMost()) ||
|
|
|
|
(drawBounds.y < yBoundary && yBoundary < drawBounds.YMost()) ||
|
|
|
|
(newRotation != nsIntPoint(0,0) && !canHaveRotation)) {
|
|
|
|
// The stuff we need to redraw will wrap around an edge of the
|
|
|
|
// buffer, so we will need to do a self-copy
|
|
|
|
// If mBufferRotation == nsIntPoint(0,0) we could do a real
|
|
|
|
// self-copy but we're not going to do that in GL yet.
|
|
|
|
// We can't do a real self-copy because the buffer is rotated.
|
|
|
|
// So allocate a new buffer for the destination.
|
|
|
|
destBufferRect = neededRegion.GetBounds();
|
|
|
|
createdBuffer = true;
|
|
|
|
} else {
|
|
|
|
mBufferRect = destBufferRect;
|
|
|
|
mBufferRotation = newRotation;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No pixels are going to be kept. The whole visible region
|
|
|
|
// will be redrawn, so we don't need to copy anything, so we don't
|
|
|
|
// set destBuffer.
|
|
|
|
mBufferRect = destBufferRect;
|
|
|
|
mBufferRotation = nsIntPoint(0,0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// The buffer's not big enough, so allocate a new one
|
|
|
|
createdBuffer = true;
|
|
|
|
}
|
2013-11-26 16:29:46 -08:00
|
|
|
NS_ASSERTION(!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
|
2013-05-15 20:45:43 -07:00
|
|
|
destBufferRect == neededRegion.GetBounds(),
|
|
|
|
"If we're resampling, we need to validate the entire buffer");
|
|
|
|
|
|
|
|
if (!createdBuffer && !mHasBuffer) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (createdBuffer) {
|
|
|
|
if (mHasBuffer &&
|
2014-01-23 10:26:41 -08:00
|
|
|
(mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
|
2013-07-08 14:30:44 -07:00
|
|
|
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
mHasBuffer = true;
|
2014-01-23 10:26:41 -08:00
|
|
|
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
2013-05-15 20:45:43 -07:00
|
|
|
mHasBufferOnWhite = true;
|
|
|
|
}
|
|
|
|
mBufferRect = destBufferRect;
|
|
|
|
mBufferRotation = nsIntPoint(0,0);
|
|
|
|
NotifyBufferCreated(contentType, bufferFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(canHaveRotation || mBufferRotation == nsIntPoint(0,0),
|
|
|
|
"Rotation disabled, but we have nonzero rotation?");
|
|
|
|
|
|
|
|
nsIntRegion invalidate;
|
|
|
|
invalidate.Sub(aLayer->GetValidRegion(), destBufferRect);
|
|
|
|
result.mRegionToInvalidate.Or(result.mRegionToInvalidate, invalidate);
|
|
|
|
|
2014-01-12 12:06:45 -08:00
|
|
|
// If we do partial updates, we have to clip drawing to the regionToDraw.
|
|
|
|
// If we don't clip, background images will be fillrect'd to the region correctly,
|
|
|
|
// while text or lines will paint outside of the regionToDraw. This becomes apparent
|
|
|
|
// with concave regions. Right now the scrollbars invalidate a narrow strip of the bar
|
|
|
|
// although they never cover it. This leads to two draw rects, the narow strip and the actually
|
|
|
|
// newly exposed area. It would be wise to fix this glitch in any way to have simpler
|
|
|
|
// clip and draw regions.
|
2014-01-23 10:26:41 -08:00
|
|
|
result.mClip = DrawRegionClip::DRAW;
|
2014-01-12 11:54:36 -08:00
|
|
|
result.mMode = mode;
|
2014-01-12 12:06:45 -08:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawTarget*
|
|
|
|
ContentClientIncremental::BorrowDrawTargetForPainting(ThebesLayer* aLayer,
|
|
|
|
const PaintState& aPaintState)
|
|
|
|
{
|
2014-01-23 10:26:41 -08:00
|
|
|
if (aPaintState.mMode == SurfaceMode::SURFACE_NONE) {
|
2014-01-12 12:06:45 -08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawTarget* result = nullptr;
|
|
|
|
|
|
|
|
nsIntRect drawBounds = aPaintState.mRegionToDraw.GetBounds();
|
2014-01-07 13:09:34 -08:00
|
|
|
MOZ_ASSERT(!mLoanedDrawTarget);
|
|
|
|
|
2013-05-15 20:45:43 -07:00
|
|
|
// BeginUpdate is allowed to modify the given region,
|
|
|
|
// if it wants more to be repainted than we request.
|
2014-01-23 10:26:41 -08:00
|
|
|
if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
2014-01-12 12:06:45 -08:00
|
|
|
nsIntRegion drawRegionCopy = aPaintState.mRegionToDraw;
|
2013-05-15 20:45:43 -07:00
|
|
|
nsRefPtr<gfxASurface> onBlack = GetUpdateSurface(BUFFER_BLACK, drawRegionCopy);
|
2014-01-12 12:06:45 -08:00
|
|
|
nsRefPtr<gfxASurface> onWhite = GetUpdateSurface(BUFFER_WHITE, aPaintState.mRegionToDraw);
|
2013-05-15 20:45:43 -07:00
|
|
|
if (onBlack && onWhite) {
|
2014-01-12 12:06:45 -08:00
|
|
|
NS_ASSERTION(aPaintState.mRegionToDraw == drawRegionCopy,
|
2013-07-09 18:02:41 -07:00
|
|
|
"BeginUpdate should always modify the draw region in the same way!");
|
2014-01-12 12:06:45 -08:00
|
|
|
FillSurface(onBlack, aPaintState.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(0.0, 0.0, 0.0, 1.0));
|
|
|
|
FillSurface(onWhite, aPaintState.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(1.0, 1.0, 1.0, 1.0));
|
2013-11-26 16:29:45 -08:00
|
|
|
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
|
2013-12-31 01:06:12 -08:00
|
|
|
RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize().ToIntSize());
|
|
|
|
RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize().ToIntSize());
|
2014-01-07 13:09:34 -08:00
|
|
|
mLoanedDrawTarget = Factory::CreateDualDrawTarget(onBlackDT, onWhiteDT);
|
2013-05-15 20:45:43 -07:00
|
|
|
} else {
|
2014-01-07 13:09:34 -08:00
|
|
|
mLoanedDrawTarget = nullptr;
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
} else {
|
2014-01-12 12:06:45 -08:00
|
|
|
nsRefPtr<gfxASurface> surf = GetUpdateSurface(BUFFER_BLACK, aPaintState.mRegionToDraw);
|
2013-11-26 16:29:45 -08:00
|
|
|
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
|
2014-01-07 17:21:56 -08:00
|
|
|
mLoanedDrawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize().ToIntSize());
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
2014-01-07 13:09:34 -08:00
|
|
|
if (!mLoanedDrawTarget) {
|
2013-05-15 20:45:43 -07:00
|
|
|
NS_WARNING("unable to get context for update");
|
2014-01-12 12:06:45 -08:00
|
|
|
return nullptr;
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
2014-01-07 13:09:34 -08:00
|
|
|
|
2014-01-12 12:06:45 -08:00
|
|
|
result = mLoanedDrawTarget;
|
2014-01-07 13:09:34 -08:00
|
|
|
mLoanedTransform = mLoanedDrawTarget->GetTransform();
|
|
|
|
mLoanedTransform.Translate(-drawBounds.x, -drawBounds.y);
|
2014-01-12 12:06:45 -08:00
|
|
|
result->SetTransform(mLoanedTransform);
|
2014-01-07 13:09:34 -08:00
|
|
|
mLoanedTransform.Translate(drawBounds.x, drawBounds.y);
|
2013-05-15 20:45:43 -07:00
|
|
|
|
2014-01-23 10:26:40 -08:00
|
|
|
if (mContentType == gfxContentType::COLOR_ALPHA) {
|
2014-01-12 12:06:45 -08:00
|
|
|
gfxUtils::ClipToRegion(result, aPaintState.mRegionToDraw);
|
|
|
|
nsIntRect bounds = aPaintState.mRegionToDraw.GetBounds();
|
|
|
|
result->ClearRect(Rect(bounds.x, bounds.y, bounds.width, bounds.height));
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
|
|
|
|
const nsIntRegion& aVisibleRegion,
|
|
|
|
bool aDidSelfCopy)
|
|
|
|
{
|
|
|
|
if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
|
|
|
|
ShadowLayerForwarder::CloseDescriptor(mUpdateDescriptor);
|
|
|
|
|
|
|
|
mForwarder->UpdateTextureIncremental(this,
|
|
|
|
TextureFront,
|
|
|
|
mUpdateDescriptor,
|
|
|
|
aRegionToDraw,
|
|
|
|
mBufferRect,
|
|
|
|
mBufferRotation);
|
|
|
|
mUpdateDescriptor = SurfaceDescriptor();
|
|
|
|
}
|
|
|
|
if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
|
|
|
|
ShadowLayerForwarder::CloseDescriptor(mUpdateDescriptorOnWhite);
|
|
|
|
|
|
|
|
mForwarder->UpdateTextureIncremental(this,
|
|
|
|
TextureOnWhiteFront,
|
|
|
|
mUpdateDescriptorOnWhite,
|
|
|
|
aRegionToDraw,
|
|
|
|
mBufferRect,
|
|
|
|
mBufferRotation);
|
|
|
|
mUpdateDescriptorOnWhite = SurfaceDescriptor();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<gfxASurface>
|
|
|
|
ContentClientIncremental::GetUpdateSurface(BufferType aType,
|
2014-01-12 12:06:45 -08:00
|
|
|
const nsIntRegion& aUpdateRegion)
|
2013-05-15 20:45:43 -07:00
|
|
|
{
|
|
|
|
nsIntRect rgnSize = aUpdateRegion.GetBounds();
|
|
|
|
if (!mBufferRect.Contains(rgnSize)) {
|
|
|
|
NS_ERROR("update outside of image");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
SurfaceDescriptor desc;
|
2013-12-31 01:06:12 -08:00
|
|
|
if (!mForwarder->AllocSurfaceDescriptor(rgnSize.Size().ToIntSize(),
|
2013-05-15 20:45:43 -07:00
|
|
|
mContentType,
|
|
|
|
&desc)) {
|
|
|
|
NS_WARNING("creating SurfaceDescriptor failed!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> tmpASurface =
|
|
|
|
ShadowLayerForwarder::OpenDescriptor(OPEN_READ_WRITE, desc);
|
|
|
|
|
|
|
|
if (aType == BUFFER_BLACK) {
|
|
|
|
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptor));
|
|
|
|
mUpdateDescriptor = desc;
|
|
|
|
} else {
|
|
|
|
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite));
|
|
|
|
MOZ_ASSERT(aType == BUFFER_WHITE);
|
|
|
|
mUpdateDescriptorOnWhite = desc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return tmpASurface.forget();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|