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 09:20:52 +00: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 "CompositableHost.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include <map> // for _Rb_tree_iterator, map, etc
|
|
|
|
#include <utility> // for pair
|
|
|
|
#include "ContentHost.h" // for ContentHostDoubleBuffered, etc
|
|
|
|
#include "Effects.h" // for EffectMask, Effect, etc
|
2014-04-03 06:04:04 +00:00
|
|
|
#include "ImageHost.h" // for ImageHostBuffered, etc
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "TiledContentHost.h" // for TiledContentHost
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
|
|
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsDebug.h" // for NS_WARNING
|
2014-02-26 21:36:35 +00:00
|
|
|
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
2013-11-30 22:20:57 +00:00
|
|
|
#include "gfxPlatform.h" // for gfxPlatform
|
2014-04-28 11:29:13 +00:00
|
|
|
#include "mozilla/layers/PCompositableParent.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 09:20:52 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
class Compositor;
|
|
|
|
|
2014-04-25 15:15:58 +00:00
|
|
|
/**
|
|
|
|
* IPDL actor used by CompositableHost to match with its corresponding
|
|
|
|
* CompositableClient on the content side.
|
|
|
|
*
|
|
|
|
* CompositableParent is owned by the IPDL system. It's deletion is triggered
|
|
|
|
* by either the CompositableChild's deletion, or by the IPDL communication
|
|
|
|
* goind down.
|
|
|
|
*/
|
|
|
|
class CompositableParent : public PCompositableParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CompositableParent(CompositableParentManager* aMgr,
|
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
uint64_t aID = 0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableParent);
|
|
|
|
mHost = CompositableHost::Create(aTextureInfo);
|
|
|
|
mHost->SetAsyncID(aID);
|
|
|
|
if (aID) {
|
|
|
|
CompositableMap::Set(aID, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~CompositableParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableParent);
|
|
|
|
CompositableMap::Erase(mHost->GetAsyncID());
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
if (mHost) {
|
|
|
|
mHost->Detach(nullptr, CompositableHost::FORCE_DETACH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<CompositableHost> mHost;
|
|
|
|
};
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
|
|
|
|
: mTextureInfo(aTextureInfo)
|
2014-04-25 15:15:58 +00:00
|
|
|
, mAsyncID(0)
|
|
|
|
, mCompositorID(0)
|
2013-07-30 09:59:51 +00:00
|
|
|
, mCompositor(nullptr)
|
|
|
|
, mLayer(nullptr)
|
2014-03-25 16:54:39 +00:00
|
|
|
, mFlashCounter(0)
|
2013-08-04 07:46:17 +00:00
|
|
|
, mAttached(false)
|
2013-08-21 01:28:53 +00:00
|
|
|
, mKeepAttached(false)
|
2013-07-30 09:59:51 +00:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableHost::~CompositableHost()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableHost);
|
2014-02-25 04:23:41 +00:00
|
|
|
if (mBackendData) {
|
|
|
|
mBackendData->ClearData();
|
|
|
|
}
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
2014-04-25 15:15:58 +00:00
|
|
|
PCompositableParent*
|
|
|
|
CompositableHost::CreateIPDLActor(CompositableParentManager* aMgr,
|
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
uint64_t aID)
|
|
|
|
{
|
|
|
|
return new CompositableParent(aMgr, aTextureInfo, aID);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CompositableHost::DestroyIPDLActor(PCompositableParent* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableHost*
|
|
|
|
CompositableHost::FromIPDLActor(PCompositableParent* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
return static_cast<CompositableParent*>(aActor)->mHost;
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:41 +00:00
|
|
|
void
|
|
|
|
CompositableHost::UseTextureHost(TextureHost* aTexture)
|
|
|
|
{
|
|
|
|
if (!aTexture) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
aTexture->SetCompositor(GetCompositor());
|
2013-12-12 01:44:45 +00:00
|
|
|
aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
|
2013-12-12 01:44:41 +00:00
|
|
|
}
|
|
|
|
|
2014-02-06 11:28:29 +00:00
|
|
|
void
|
|
|
|
CompositableHost::UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
|
|
|
|
TextureHost* aTextureOnWhite)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aTextureOnBlack && aTextureOnWhite);
|
|
|
|
aTextureOnBlack->SetCompositor(GetCompositor());
|
|
|
|
aTextureOnBlack->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
|
|
|
|
aTextureOnWhite->SetCompositor(GetCompositor());
|
|
|
|
aTextureOnWhite->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
|
|
|
|
}
|
|
|
|
|
2014-02-10 20:52:35 +00:00
|
|
|
void
|
|
|
|
CompositableHost::RemoveTextureHost(TextureHost* aTexture)
|
|
|
|
{
|
2014-02-25 04:23:41 +00:00
|
|
|
// Clear strong refrence to CompositableBackendSpecificData
|
|
|
|
aTexture->SetCompositableBackendSpecificData(nullptr);
|
2014-02-10 20:52:35 +00:00
|
|
|
}
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
void
|
|
|
|
CompositableHost::SetCompositor(Compositor* aCompositor)
|
|
|
|
{
|
|
|
|
mCompositor = aCompositor;
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
bool
|
|
|
|
CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
bool aIs3D)
|
|
|
|
{
|
2013-08-02 01:12:16 +00:00
|
|
|
RefPtr<TextureSource> source;
|
2014-04-03 06:04:04 +00:00
|
|
|
RefPtr<TextureHost> host = GetAsTextureHost();
|
|
|
|
if (host && host->Lock()) {
|
|
|
|
source = host->GetTextureSources();
|
2013-08-02 01:12:16 +00:00
|
|
|
}
|
2013-04-17 05:10:50 +00:00
|
|
|
|
|
|
|
if (!source) {
|
|
|
|
NS_WARNING("Using compositable with no texture host as mask layer");
|
|
|
|
return 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 09:20:52 +00:00
|
|
|
RefPtr<EffectMask> effect = new EffectMask(source,
|
|
|
|
source->GetSize(),
|
|
|
|
aTransform);
|
|
|
|
effect->mIs3D = aIs3D;
|
2014-04-26 02:34:06 +00:00
|
|
|
aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;
|
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 09:20:52 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-02 01:12:16 +00:00
|
|
|
void
|
|
|
|
CompositableHost::RemoveMaskEffect()
|
|
|
|
{
|
2014-04-03 06:04:04 +00:00
|
|
|
RefPtr<TextureHost> host = GetAsTextureHost();
|
|
|
|
if (host) {
|
|
|
|
host->Unlock();
|
2013-08-02 01:12:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-13 02:39:26 +00:00
|
|
|
// implemented in TextureHostOGL.cpp
|
2013-09-30 12:14:38 +00:00
|
|
|
TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
|
2013-09-13 02:39:26 +00: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 09:20:52 +00:00
|
|
|
/* static */ TemporaryRef<CompositableHost>
|
2013-04-16 21:36:06 +00:00
|
|
|
CompositableHost::Create(const TextureInfo& aTextureInfo)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
RefPtr<CompositableHost> result;
|
2013-04-12 07:28:55 +00:00
|
|
|
switch (aTextureInfo.mCompositableType) {
|
2014-04-26 02:34:06 +00:00
|
|
|
case CompositableType::BUFFER_BRIDGE:
|
2014-04-23 14:41:18 +00:00
|
|
|
NS_ERROR("Cannot create an image bridge compositable this way");
|
2013-11-27 21:16:34 +00:00
|
|
|
break;
|
2014-04-26 02:34:06 +00:00
|
|
|
case CompositableType::BUFFER_CONTENT_INC:
|
2013-12-04 17:19:50 +00:00
|
|
|
result = new ContentHostIncremental(aTextureInfo);
|
|
|
|
break;
|
2014-04-26 02:34:06 +00:00
|
|
|
case CompositableType::BUFFER_TILED:
|
|
|
|
case CompositableType::BUFFER_SIMPLE_TILED:
|
2013-12-05 18:39:22 +00:00
|
|
|
result = new TiledContentHost(aTextureInfo);
|
|
|
|
break;
|
2014-04-26 02:34:06 +00:00
|
|
|
case CompositableType::IMAGE:
|
2013-12-05 18:39:22 +00:00
|
|
|
result = new ImageHost(aTextureInfo);
|
|
|
|
break;
|
2014-04-26 02:34:06 +00:00
|
|
|
case CompositableType::CONTENT_SINGLE:
|
2013-12-05 18:39:22 +00:00
|
|
|
result = new ContentHostSingleBuffered(aTextureInfo);
|
|
|
|
break;
|
2014-04-26 02:34:06 +00:00
|
|
|
case CompositableType::CONTENT_DOUBLE:
|
2013-12-05 18:39:22 +00:00
|
|
|
result = new ContentHostDoubleBuffered(aTextureInfo);
|
|
|
|
break;
|
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 09:20:52 +00:00
|
|
|
default:
|
2014-04-23 14:41:18 +00:00
|
|
|
NS_ERROR("Unknown CompositableType");
|
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 09:20:52 +00:00
|
|
|
}
|
2014-03-07 21:34:04 +00:00
|
|
|
// We know that Tiled buffers don't use the compositable backend-specific
|
|
|
|
// data, so don't bother creating it.
|
2014-04-26 02:34:06 +00:00
|
|
|
if (result && aTextureInfo.mCompositableType != CompositableType::BUFFER_TILED) {
|
2013-09-30 12:14:38 +00:00
|
|
|
RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
|
|
|
|
result->SetCompositableBackendSpecificData(data);
|
2013-09-13 02:39:26 +00:00
|
|
|
}
|
|
|
|
return result;
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 12:53:12 +00:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2013-07-30 09:59:51 +00:00
|
|
|
void
|
|
|
|
CompositableHost::DumpTextureHost(FILE* aFile, TextureHost* aTexture)
|
|
|
|
{
|
|
|
|
if (!aTexture) {
|
|
|
|
return;
|
|
|
|
}
|
2013-11-27 09:59:01 +00:00
|
|
|
RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();
|
2014-03-31 23:46:00 +00:00
|
|
|
if (!dSurf) {
|
|
|
|
return;
|
|
|
|
}
|
2013-11-27 09:59:01 +00:00
|
|
|
gfxPlatform *platform = gfxPlatform::GetPlatform();
|
|
|
|
RefPtr<gfx::DrawTarget> dt = platform->CreateDrawTargetForData(dSurf->GetData(),
|
|
|
|
dSurf->GetSize(),
|
|
|
|
dSurf->Stride(),
|
|
|
|
dSurf->GetFormat());
|
|
|
|
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
|
2013-07-30 09:59:51 +00:00
|
|
|
if (!surf) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
surf->DumpAsDataURL(aFile ? aFile : stderr);
|
|
|
|
}
|
2013-08-08 12:53:12 +00:00
|
|
|
#endif
|
2013-07-30 09:59:51 +00: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 09:20:52 +00:00
|
|
|
namespace CompositableMap {
|
|
|
|
|
2014-04-25 15:15:58 +00:00
|
|
|
typedef std::map<uint64_t, PCompositableParent*> CompositableMap_t;
|
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 09:20:52 +00:00
|
|
|
static CompositableMap_t* sCompositableMap = nullptr;
|
|
|
|
bool IsCreated() {
|
|
|
|
return sCompositableMap != nullptr;
|
|
|
|
}
|
2014-04-25 15:15:58 +00:00
|
|
|
PCompositableParent* Get(uint64_t aID)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
CompositableMap_t::iterator it = sCompositableMap->find(aID);
|
|
|
|
if (it == sCompositableMap->end()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return it->second;
|
|
|
|
}
|
2014-04-25 15:15:58 +00:00
|
|
|
void Set(uint64_t aID, PCompositableParent* aParent)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
(*sCompositableMap)[aID] = aParent;
|
|
|
|
}
|
|
|
|
void Erase(uint64_t aID)
|
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CompositableMap_t::iterator it = sCompositableMap->find(aID);
|
|
|
|
if (it != sCompositableMap->end()) {
|
|
|
|
sCompositableMap->erase(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
if (!IsCreated()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sCompositableMap->clear();
|
|
|
|
}
|
|
|
|
void Create()
|
|
|
|
{
|
|
|
|
if (sCompositableMap == nullptr) {
|
|
|
|
sCompositableMap = new CompositableMap_t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Destroy()
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
delete sCompositableMap;
|
|
|
|
sCompositableMap = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace CompositableMap
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|