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 "CompositableHost.h"
|
2013-08-11 16:17:23 -07: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
|
|
|
|
#include "ImageHost.h" // for DeprecatedImageHostBuffered, etc
|
|
|
|
#include "TiledContentHost.h" // for TiledContentHost
|
|
|
|
#include "gfxImageSurface.h" // for gfxImageSurface
|
|
|
|
#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
|
|
|
|
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class Matrix4x4;
|
|
|
|
class Compositor;
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
|
|
|
|
: mTextureInfo(aTextureInfo)
|
|
|
|
, mCompositor(nullptr)
|
|
|
|
, mLayer(nullptr)
|
2013-08-04 00:46:17 -07:00
|
|
|
, mAttached(false)
|
2013-08-20 18:28:53 -07:00
|
|
|
, mKeepAttached(false)
|
2013-07-30 02:59:51 -07:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableHost::~CompositableHost()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableHost);
|
|
|
|
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (it) {
|
|
|
|
if (it->GetFlags() & TEXTURE_DEALLOCATE_HOST) {
|
|
|
|
it->DeallocateSharedData();
|
|
|
|
}
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableHost::AddTextureHost(TextureHost* aTexture)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aTexture);
|
|
|
|
MOZ_ASSERT(GetTextureHost(aTexture->GetID()) == nullptr,
|
|
|
|
"A texture is already present with this ID");
|
|
|
|
RefPtr<TextureHost> second = mFirstTexture;
|
|
|
|
mFirstTexture = aTexture;
|
|
|
|
aTexture->SetNextSibling(second);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableHost::RemoveTextureHost(uint64_t aTextureID)
|
|
|
|
{
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (it) {
|
|
|
|
if (it->GetNextSibling() &&
|
|
|
|
it->GetNextSibling()->GetID() == aTextureID) {
|
|
|
|
it->SetNextSibling(it->GetNextSibling()->GetNextSibling());
|
|
|
|
}
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureHost*
|
|
|
|
CompositableHost::GetTextureHost(uint64_t aTextureID)
|
|
|
|
{
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (it) {
|
|
|
|
if (it->GetID() == aTextureID) {
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableHost::SetCompositor(Compositor* aCompositor)
|
|
|
|
{
|
|
|
|
mCompositor = aCompositor;
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (!!it) {
|
|
|
|
it->SetCompositor(aCompositor);
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
bool
|
|
|
|
CompositableHost::Update(const SurfaceDescriptor& aImage,
|
|
|
|
SurfaceDescriptor* aResult)
|
|
|
|
{
|
2013-07-08 14:30:44 -07:00
|
|
|
if (!GetDeprecatedTextureHost()) {
|
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
|
|
|
*aResult = aImage;
|
|
|
|
return false;
|
|
|
|
}
|
2013-07-08 14:30:44 -07:00
|
|
|
MOZ_ASSERT(!GetDeprecatedTextureHost()->GetBuffer(),
|
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
|
|
|
"This path not suitable for texture-level double buffering.");
|
2013-07-08 14:30:44 -07:00
|
|
|
GetDeprecatedTextureHost()->Update(aImage);
|
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
|
|
|
*aResult = aImage;
|
2013-07-08 14:30:44 -07:00
|
|
|
return GetDeprecatedTextureHost()->IsValid();
|
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
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
bool aIs3D)
|
|
|
|
{
|
2013-08-01 18:12:16 -07:00
|
|
|
RefPtr<TextureSource> source;
|
|
|
|
RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
|
|
|
|
if (oldHost) {
|
|
|
|
oldHost->Lock();
|
|
|
|
source = oldHost;
|
|
|
|
} else {
|
|
|
|
RefPtr<TextureHost> host = GetTextureHost();
|
|
|
|
if (host) {
|
|
|
|
host->Lock();
|
|
|
|
source = host->GetTextureSources();
|
|
|
|
}
|
|
|
|
}
|
2013-04-16 22:10:50 -07: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 02:20:52 -07:00
|
|
|
RefPtr<EffectMask> effect = new EffectMask(source,
|
|
|
|
source->GetSize(),
|
|
|
|
aTransform);
|
|
|
|
effect->mIs3D = aIs3D;
|
|
|
|
aEffects.mSecondaryEffects[EFFECT_MASK] = effect;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-01 18:12:16 -07:00
|
|
|
void
|
|
|
|
CompositableHost::RemoveMaskEffect()
|
|
|
|
{
|
|
|
|
RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
|
|
|
|
if (oldHost) {
|
|
|
|
oldHost->Unlock();
|
|
|
|
} else {
|
|
|
|
RefPtr<TextureHost> host = GetTextureHost();
|
|
|
|
if (host) {
|
|
|
|
host->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
|
|
|
/* static */ TemporaryRef<CompositableHost>
|
2013-04-16 14:36:06 -07: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 02:20:52 -07:00
|
|
|
{
|
|
|
|
RefPtr<CompositableHost> result;
|
2013-04-12 00:28:55 -07:00
|
|
|
switch (aTextureInfo.mCompositableType) {
|
2013-07-30 02:59:51 -07:00
|
|
|
case COMPOSITABLE_IMAGE:
|
|
|
|
result = new ImageHost(aTextureInfo);
|
|
|
|
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 02:20:52 -07:00
|
|
|
case BUFFER_IMAGE_BUFFERED:
|
2013-07-24 09:08:35 -07:00
|
|
|
result = new DeprecatedImageHostBuffered(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 02:20:52 -07:00
|
|
|
return result;
|
|
|
|
case BUFFER_IMAGE_SINGLE:
|
2013-07-24 09:08:35 -07:00
|
|
|
result = new DeprecatedImageHostSingle(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 02:20:52 -07:00
|
|
|
return result;
|
|
|
|
case BUFFER_TILED:
|
2013-04-16 14:36:06 -07:00
|
|
|
result = new TiledContentHost(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 02:20:52 -07:00
|
|
|
return result;
|
|
|
|
case BUFFER_CONTENT:
|
2013-04-16 14:36:06 -07:00
|
|
|
result = new ContentHostSingleBuffered(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 02:20:52 -07:00
|
|
|
return result;
|
|
|
|
case BUFFER_CONTENT_DIRECT:
|
2013-04-16 14:36:06 -07:00
|
|
|
result = new ContentHostDoubleBuffered(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 02:20:52 -07:00
|
|
|
return result;
|
2013-05-15 20:45:43 -07:00
|
|
|
case BUFFER_CONTENT_INC:
|
|
|
|
result = new ContentHostIncremental(aTextureInfo);
|
|
|
|
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 02:20:52 -07:00
|
|
|
default:
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("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 02:20:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:53:12 -07:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2013-05-25 19:44:24 -07:00
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
CompositableHost::DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture)
|
2013-05-25 19:44:24 -07:00
|
|
|
{
|
|
|
|
if (!aTexture) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRefPtr<gfxImageSurface> surf = aTexture->GetAsSurface();
|
|
|
|
if (!surf) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
surf->DumpAsDataURL(aFile ? aFile : stderr);
|
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
void
|
|
|
|
CompositableHost::DumpTextureHost(FILE* aFile, TextureHost* aTexture)
|
|
|
|
{
|
|
|
|
if (!aTexture) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRefPtr<gfxImageSurface> surf = aTexture->GetAsSurface();
|
|
|
|
if (!surf) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
surf->DumpAsDataURL(aFile ? aFile : stderr);
|
|
|
|
}
|
2013-08-08 05:53:12 -07:00
|
|
|
#endif
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-04-11 03:14:29 -07:00
|
|
|
void
|
|
|
|
CompositableParent::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
|
|
|
if (mHost) {
|
|
|
|
mHost->Detach();
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
|
|
|
CompositableParent::CompositableParent(CompositableParentManager* aMgr,
|
2013-04-12 00:28:55 -07:00
|
|
|
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 02:20:52 -07:00
|
|
|
uint64_t aID)
|
|
|
|
: mManager(aMgr)
|
2013-04-12 00:28:55 -07:00
|
|
|
, mType(aTextureInfo.mCompositableType)
|
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
|
|
|
, mID(aID)
|
|
|
|
, mCompositorID(0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableParent);
|
2013-04-12 00:28:55 -07:00
|
|
|
mHost = CompositableHost::Create(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 02:20:52 -07:00
|
|
|
if (aID) {
|
|
|
|
CompositableMap::Set(aID, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableParent::~CompositableParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableParent);
|
|
|
|
CompositableMap::Erase(mID);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CompositableMap {
|
|
|
|
|
|
|
|
typedef std::map<uint64_t, CompositableParent*> CompositableMap_t;
|
|
|
|
static CompositableMap_t* sCompositableMap = nullptr;
|
|
|
|
bool IsCreated() {
|
|
|
|
return sCompositableMap != nullptr;
|
|
|
|
}
|
|
|
|
CompositableParent* Get(uint64_t aID)
|
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
CompositableMap_t::iterator it = sCompositableMap->find(aID);
|
|
|
|
if (it == sCompositableMap->end()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
void Set(uint64_t aID, CompositableParent* aParent)
|
|
|
|
{
|
|
|
|
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
|