Bug 959448 - Convert most of LayersTypes.h to typed enums - r=nrc

find content/media dom/ipc widget/ gfx/tests gfx/ipc/ gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)LAYERS_\(NONE\|BASIC\|OPENGL\|D3D9\|D3D10\|D3D11\|CLIENT\|LAST\)\($\|[^A-Za-z0-9_]\)/\1LayersBackend::LAYERS_\2\3/g'

find widget gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)BUFFER_\(NONE\)\($\|[^A-Za-z0-9_]\)/\1BufferMode::BUFFER_\2\3/g'

find widget gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)BUFFER_\(BUFFERED\)\($\|[^A-Za-z0-9_]\)/\1BufferMode::\2\3/g'

find gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)CLIP_\(DRAW\|DRAW_SNAPPED\)\($\|[^A-Za-z0-9_]\)/\1DrawRegionClip::\2\3/g'

find gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)CLIP_\(NONE\)\($\|[^A-Za-z0-9_]\)/\1DrawRegionClip::CLIP_\2\3/g'

find gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)SURFACE_\(NONE\|OPAQUE\|SINGLE_CHANNEL_ALPHA\|COMPONENT_ALPHA\)\($\|[^A-Za-z0-9_]\)/\1SurfaceMode::SURFACE_\2\3/g'

find gfx/ipc/ gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)SCALE_\(STRETCH\|SENTINEL\)\($\|[^A-Za-z0-9_]\)/\1ScaleMode::\2\3/g'

find gfx/ipc/ gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)SCALE_\(NONE\)\($\|[^A-Za-z0-9_]\)/\1ScaleMode::SCALE_\2\3/g'
This commit is contained in:
Benoit Jacob 2014-01-23 13:26:41 -05:00
parent 49fc171ad2
commit 61df69f208
68 changed files with 281 additions and 276 deletions

View File

@ -81,7 +81,7 @@ private:
MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder)
: MediaDecoderReader(aDecoder),
mLayersBackendType(layers::LAYERS_NONE),
mLayersBackendType(layers::LayersBackend::LAYERS_NONE),
mHasAudio(false),
mHasVideo(false)
{

View File

@ -2366,7 +2366,7 @@ TabChild::NotifyPainted()
// we need to notify content every change so that it can compute an invalidation
// region and send that to the widget.
if (UseDirectCompositor() &&
(!mNotified || mTextureFactoryIdentifier.mParentBackend == LAYERS_BASIC)) {
(!mNotified || mTextureFactoryIdentifier.mParentBackend == LayersBackend::LAYERS_BASIC)) {
mRemoteFrame->SendNotifyCompositorTransaction();
mNotified = true;
}

View File

@ -210,16 +210,16 @@ struct ParamTraits<mozilla::GraphicsFilterType>
template <>
struct ParamTraits<mozilla::layers::LayersBackend>
: public EnumSerializer<mozilla::layers::LayersBackend,
mozilla::layers::LAYERS_NONE,
mozilla::layers::LAYERS_LAST>
: public TypedEnumSerializer<mozilla::layers::LayersBackend,
mozilla::layers::LayersBackend::LAYERS_NONE,
mozilla::layers::LayersBackend::LAYERS_LAST>
{};
template <>
struct ParamTraits<mozilla::layers::ScaleMode>
: public EnumSerializer<mozilla::layers::ScaleMode,
mozilla::layers::SCALE_NONE,
mozilla::layers::SCALE_SENTINEL>
: public TypedEnumSerializer<mozilla::layers::ScaleMode,
mozilla::layers::ScaleMode::SCALE_NONE,
mozilla::layers::ScaleMode::SENTINEL>
{};
template <>

View File

@ -17,7 +17,7 @@ class Matrix4x4;
namespace layers {
/* static */ LayersBackend Compositor::sBackend = LAYERS_NONE;
/* static */ LayersBackend Compositor::sBackend = LayersBackend::LAYERS_NONE;
/* static */ LayersBackend
Compositor::GetBackend()
{

View File

@ -206,7 +206,7 @@ struct TextureFactoryIdentifier
bool mSupportsTextureBlitting;
bool mSupportsPartialUploads;
TextureFactoryIdentifier(LayersBackend aLayersBackend = LAYERS_NONE,
TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
GeckoProcessType aParentProcessId = GeckoProcessType_Default,
int32_t aMaxTextureSize = 0,
bool aSupportsTextureBlitting = false,

View File

@ -201,9 +201,9 @@ public:
}
ImageBackendData* GetBackendData(LayersBackend aBackend)
{ return mBackendData[aBackend]; }
{ return mBackendData[size_t(aBackend)]; }
void SetBackendData(LayersBackend aBackend, ImageBackendData* aData)
{ mBackendData[aBackend] = aData; }
{ mBackendData[size_t(aBackend)] = aData; }
int32_t GetSerial() { return mSerial; }
@ -220,7 +220,7 @@ protected:
mSent(false)
{}
nsAutoPtr<ImageBackendData> mBackendData[mozilla::layers::LAYERS_LAST];
nsAutoPtr<ImageBackendData> mBackendData[size_t(mozilla::layers::LayersBackend::LAYERS_LAST)];
void* mImplData;
int32_t mSerial;

View File

@ -16,7 +16,7 @@ namespace layers {
ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData), mFilter(GraphicsFilter::FILTER_GOOD)
, mScaleMode(SCALE_NONE), mDisallowBigImage(false)
, mScaleMode(ScaleMode::SCALE_NONE), mDisallowBigImage(false)
{}
ImageLayer::~ImageLayer()
@ -35,9 +35,9 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurfa
gfxRect sourceRect(0, 0, 0, 0);
if (mContainer) {
sourceRect.SizeTo(gfx::ThebesIntSize(mContainer->GetCurrentSize()));
if (mScaleMode != SCALE_NONE &&
if (mScaleMode != ScaleMode::SCALE_NONE &&
sourceRect.width != 0.0 && sourceRect.height != 0.0) {
NS_ASSERTION(mScaleMode == SCALE_STRETCH,
NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
"No other scalemodes than stretch and none supported yet.");
local.Scale(mScaleToSize.width / sourceRect.width,
mScaleToSize.height / sourceRect.height, 1.0);

View File

@ -295,7 +295,7 @@ public:
/**
* Returns true if this LayerManager can properly support layers with
* SURFACE_COMPONENT_ALPHA. This can include disabling component
* SurfaceMode::SURFACE_COMPONENT_ALPHA. This can include disabling component
* alpha if required.
*/
virtual bool AreComponentAlphaLayersEnabled() { return true; }
@ -585,9 +585,9 @@ public:
bool IsCompositingCheap(LayersBackend aBackend)
{
// LAYERS_NONE is an error state, but in that case we should try to
// LayersBackend::LAYERS_NONE is an error state, but in that case we should try to
// avoid loading the compositor!
return LAYERS_BASIC != aBackend && LAYERS_NONE != aBackend;
return LayersBackend::LAYERS_BASIC != aBackend && LayersBackend::LAYERS_NONE != aBackend;
}
virtual bool IsCompositingCheap() { return true; }
@ -1107,10 +1107,10 @@ public:
SurfaceMode GetSurfaceMode()
{
if (CanUseOpaqueSurface())
return SURFACE_OPAQUE;
return SurfaceMode::SURFACE_OPAQUE;
if (mContentFlags & CONTENT_COMPONENT_ALPHA)
return SURFACE_COMPONENT_ALPHA;
return SURFACE_SINGLE_CHANNEL_ALPHA;
return SurfaceMode::SURFACE_COMPONENT_ALPHA;
return SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
/**

View File

@ -10,6 +10,8 @@
#include "nsPoint.h" // for nsIntPoint
#include "nsRegion.h"
#include "mozilla/TypedEnum.h"
#ifdef MOZ_WIDGET_GONK
#include <ui/GraphicBuffer.h>
#endif
@ -39,7 +41,10 @@ namespace layers {
typedef uint32_t TextureFlags;
enum LayersBackend {
#undef NONE
#undef OPAQUE
MOZ_BEGIN_ENUM_CLASS(LayersBackend, int8_t)
LAYERS_NONE = 0,
LAYERS_BASIC,
LAYERS_OPENGL,
@ -48,25 +53,25 @@ enum LayersBackend {
LAYERS_D3D11,
LAYERS_CLIENT,
LAYERS_LAST
};
MOZ_END_ENUM_CLASS(LayersBackend)
enum BufferMode {
MOZ_BEGIN_ENUM_CLASS(BufferMode, int8_t)
BUFFER_NONE,
BUFFER_BUFFERED
};
BUFFERED
MOZ_END_ENUM_CLASS(BufferMode)
enum DrawRegionClip {
CLIP_DRAW,
CLIP_DRAW_SNAPPED,
CLIP_NONE,
};
MOZ_BEGIN_ENUM_CLASS(DrawRegionClip, int8_t)
DRAW,
DRAW_SNAPPED,
CLIP_NONE
MOZ_END_ENUM_CLASS(DrawRegionClip)
enum SurfaceMode {
MOZ_BEGIN_ENUM_CLASS(SurfaceMode, int8_t)
SURFACE_NONE = 0,
SURFACE_OPAQUE,
SURFACE_SINGLE_CHANNEL_ALPHA,
SURFACE_COMPONENT_ALPHA
};
MOZ_END_ENUM_CLASS(SurfaceMode)
// LayerRenderState for Composer2D
// We currently only support Composer2D using gralloc. If we want to be backed
@ -127,12 +132,12 @@ struct LayerRenderState {
bool mHasOwnOffset;
};
enum ScaleMode {
MOZ_BEGIN_ENUM_CLASS(ScaleMode, int8_t)
SCALE_NONE,
SCALE_STRETCH,
SCALE_SENTINEL
// Unimplemented - SCALE_PRESERVE_ASPECT_RATIO_CONTAIN
};
STRETCH,
SENTINEL
// Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
MOZ_END_ENUM_CLASS(ScaleMode)
struct EventRegions {
nsIntRegion mHitRegion;

View File

@ -443,9 +443,9 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
}
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
#if defined(MOZ_GFX_OPTIMIZE_MOBILE) || defined(MOZ_WIDGET_GONK)
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
#else
if (!aLayer->GetParent() ||
!aLayer->GetParent()->SupportsComponentAlphaChildren() ||
@ -453,7 +453,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
!aLayer->AsShadowableLayer() ||
!aLayer->AsShadowableLayer()->HasShadow() ||
!gfxPlatform::ComponentAlphaEnabled()) {
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
} else {
contentType = gfxContentType::COLOR;
}
@ -464,9 +464,9 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
(!neededRegion.GetBounds().IsEqualInterior(destBufferRect) ||
neededRegion.GetNumRects() > 1)) {
// The area we add to neededRegion might not be painted opaquely
if (mode == SURFACE_OPAQUE) {
if (mode == SurfaceMode::SURFACE_OPAQUE) {
contentType = gfxContentType::COLOR_ALPHA;
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
// We need to validate the entire buffer, to make sure that only valid
@ -478,7 +478,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
// have transitioned into/out of component alpha, then we need to recreate it.
if (HaveBuffer() &&
(contentType != BufferContentType() ||
(mode == SURFACE_COMPONENT_ALPHA) != HaveBufferOnWhite())) {
(mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) != HaveBufferOnWhite())) {
// We're effectively clearing the valid region, so we need to draw
// the entire needed region now.
@ -510,7 +510,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
RefPtr<DrawTarget> destDTBuffer;
RefPtr<DrawTarget> destDTBufferOnWhite;
uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0;
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
bufferFlags |= BUFFER_COMPONENT_ALPHA;
}
if (canReuseBuffer) {
@ -542,7 +542,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
MOZ_ASSERT(mDTBuffer);
mDTBuffer->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height),
IntPoint(dest.x, dest.y));
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
if (!EnsureBufferOnWhite()) {
return result;
}
@ -571,7 +571,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
newRotation.x * bytesPerPixel, newRotation.y);
mDTBuffer->ReleaseBits(data);
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
if (!EnsureBufferOnWhite()) {
return result;
}
@ -630,7 +630,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
bool isClear = !HaveBuffer();
if (destDTBuffer) {
if (!isClear && (mode != SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) {
if (!isClear && (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) {
// Copy the bits
nsIntPoint offset = -destBufferRect.TopLeft();
Matrix mat;
@ -643,7 +643,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
DrawBufferWithRotation(destDTBuffer, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
destDTBuffer->SetTransform(Matrix());
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
NS_ASSERTION(destDTBufferOnWhite, "Must have a white buffer!");
destDTBufferOnWhite->SetTransform(mat);
if (!EnsureBufferOnWhite()) {
@ -666,7 +666,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
nsIntRegion invalidate;
invalidate.Sub(aLayer->GetValidRegion(), destBufferRect);
result.mRegionToInvalidate.Or(result.mRegionToInvalidate, invalidate);
result.mClip = CLIP_DRAW_SNAPPED;
result.mClip = DrawRegionClip::DRAW_SNAPPED;
result.mMode = mode;
return result;
@ -676,7 +676,7 @@ DrawTarget*
RotatedContentBuffer::BorrowDrawTargetForPainting(ThebesLayer* aLayer,
const PaintState& aPaintState)
{
if (!aPaintState.mMode) {
if (aPaintState.mMode == SurfaceMode::SURFACE_NONE) {
return nullptr;
}
@ -688,7 +688,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(ThebesLayer* aLayer,
canUseOpaqueSurface ? gfxContentType::COLOR :
gfxContentType::COLOR_ALPHA;
if (aPaintState.mMode == SURFACE_COMPONENT_ALPHA) {
if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
MOZ_ASSERT(mDTBuffer && mDTBufferOnWhite);
nsIntRegionRectIterator iter(aPaintState.mRegionToDraw);
const nsIntRect *iterRect;

View File

@ -214,7 +214,7 @@ public:
*/
struct PaintState {
PaintState()
: mMode(SURFACE_NONE)
: mMode(SurfaceMode::SURFACE_NONE)
, mDidSelfCopy(false)
{}

View File

@ -227,7 +227,7 @@ BasicCompositor::BasicCompositor(nsIWidget *aWidget)
: mWidget(aWidget)
{
MOZ_COUNT_CTOR(BasicCompositor);
sBackend = LAYERS_BASIC;
sBackend = LayersBackend::LAYERS_BASIC;
}
BasicCompositor::~BasicCompositor()

View File

@ -51,7 +51,7 @@ public:
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
{
return TextureFactoryIdentifier(LAYERS_BASIC,
return TextureFactoryIdentifier(LayersBackend::LAYERS_BASIC,
XRE_GetProcessType(),
GetMaxTextureSize());
}

View File

@ -238,7 +238,7 @@ public:
BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
mPhase(PHASE_NONE),
mWidget(aWidget)
, mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false)
, mDoubleBuffering(BufferMode::BUFFER_NONE), mUsingDefaultTarget(false)
, mCachedSurfaceInUse(false)
, mTransactionIncomplete(false)
, mCompositorMightResample(false)
@ -250,7 +250,7 @@ BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
BasicLayerManager::BasicLayerManager() :
mPhase(PHASE_NONE),
mWidget(nullptr)
, mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false)
, mDoubleBuffering(BufferMode::BUFFER_NONE), mUsingDefaultTarget(false)
, mCachedSurfaceInUse(false)
, mTransactionIncomplete(false)
{
@ -620,7 +620,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
if (IsRetained()) {
nsIntRegion region;
MarkLayersHidden(mRoot, clipRect, clipRect, region, ALLOW_OPAQUE);
if (mUsingDefaultTarget && mDoubleBuffering != BUFFER_NONE) {
if (mUsingDefaultTarget && mDoubleBuffering != BufferMode::BUFFER_NONE) {
ApplyDoubleBuffering(mRoot, clipRect);
}
}

View File

@ -111,7 +111,7 @@ public:
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
virtual ImageFactory *GetImageFactory();
virtual LayersBackend GetBackendType() { return LAYERS_BASIC; }
virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Basic"); }
#ifdef DEBUG

View File

@ -99,7 +99,7 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext,
groupContext = aContext;
}
SetAntialiasingFlags(this, groupContext);
aCallback(this, groupContext, toDraw, CLIP_NONE, nsIntRegion(), aCallbackData);
aCallback(this, groupContext, toDraw, DrawRegionClip::CLIP_NONE, nsIntRegion(), aCallbackData);
if (needsGroup) {
BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext);
if (needsClipToVisibleRegion) {

View File

@ -37,7 +37,7 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
TextureFlags aFlags)
{
if (aType == CanvasClientGLContext &&
aForwarder->GetCompositorBackendType() == LAYERS_OPENGL) {
aForwarder->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) {
aFlags |= TEXTURE_DEALLOCATE_CLIENT;
return new CanvasClientSurfaceStream(aForwarder, aFlags);
}
@ -238,7 +238,7 @@ DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLaye
{
if (!mDeprecatedTextureClient) {
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL,
aLayer->GetSurfaceMode() == SURFACE_OPAQUE
aLayer->GetSurfaceMode() == SurfaceMode::SURFACE_OPAQUE
? gfxContentType::COLOR
: gfxContentType::COLOR_ALPHA);
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");

View File

@ -46,7 +46,7 @@ ClientCanvasLayer::Initialize(const Data& aData)
screen->PreserveBuffer());
SurfaceFactory_GL* factory = nullptr;
if (!mForceReadback) {
if (ClientManager()->AsShadowForwarder()->GetCompositorBackendType() == mozilla::layers::LAYERS_OPENGL) {
if (ClientManager()->AsShadowForwarder()->GetCompositorBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) {
if (mGLContext->GetContextType() == GLContextType::EGL) {
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);

View File

@ -451,11 +451,11 @@ void
ClientLayerManager::GetBackendName(nsAString& aName)
{
switch (mForwarder->GetCompositorBackendType()) {
case LAYERS_BASIC: aName.AssignLiteral("Basic"); return;
case LAYERS_OPENGL: aName.AssignLiteral("OpenGL"); return;
case LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return;
case LAYERS_D3D10: aName.AssignLiteral("Direct3D 10"); return;
case LAYERS_D3D11: aName.AssignLiteral("Direct3D 11"); return;
case LayersBackend::LAYERS_BASIC: aName.AssignLiteral("Basic"); return;
case LayersBackend::LAYERS_OPENGL: aName.AssignLiteral("OpenGL"); return;
case LayersBackend::LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return;
case LayersBackend::LAYERS_D3D10: aName.AssignLiteral("Direct3D 10"); return;
case LayersBackend::LAYERS_D3D11: aName.AssignLiteral("Direct3D 11"); return;
default: NS_RUNTIMEABORT("Invalid backend");
}
}

View File

@ -57,7 +57,7 @@ public:
void* aCallbackData,
EndTransactionFlags aFlags = END_DEFAULT);
virtual LayersBackend GetBackendType() { return LAYERS_CLIENT; }
virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_CLIENT; }
virtual void GetBackendName(nsAString& name);
virtual const char* Name() const { return "Client"; }

View File

@ -171,7 +171,7 @@ ClientLayerManager::CreateThebesLayerWithHint(ThebesLayerCreationHint aHint)
#ifdef MOZ_B2G
aHint == SCROLLABLE &&
#endif
gfxPlatform::GetPrefLayersEnableTiles() && AsShadowForwarder()->GetCompositorBackendType() == LAYERS_OPENGL) {
gfxPlatform::GetPrefLayersEnableTiles() && AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) {
nsRefPtr<ClientTiledThebesLayer> layer =
new ClientTiledThebesLayer(this);
CREATE_SHADOW(Thebes);

View File

@ -102,35 +102,35 @@ CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aD
switch (aDeprecatedTextureClientType) {
case TEXTURE_SHARED_GL:
if (parentBackend == LAYERS_OPENGL) {
if (parentBackend == LayersBackend::LAYERS_OPENGL) {
result = new DeprecatedTextureClientSharedOGL(GetForwarder(), GetTextureInfo());
}
break;
case TEXTURE_SHARED_GL_EXTERNAL:
if (parentBackend == LAYERS_OPENGL) {
if (parentBackend == LayersBackend::LAYERS_OPENGL) {
result = new DeprecatedTextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo());
}
break;
case TEXTURE_STREAM_GL:
if (parentBackend == LAYERS_OPENGL) {
if (parentBackend == LayersBackend::LAYERS_OPENGL) {
result = new DeprecatedTextureClientStreamOGL(GetForwarder(), GetTextureInfo());
}
break;
case TEXTURE_YCBCR:
if (parentBackend == LAYERS_OPENGL ||
parentBackend == LAYERS_D3D9 ||
parentBackend == LAYERS_D3D11 ||
parentBackend == LAYERS_BASIC) {
if (parentBackend == LayersBackend::LAYERS_OPENGL ||
parentBackend == LayersBackend::LAYERS_D3D9 ||
parentBackend == LayersBackend::LAYERS_D3D11 ||
parentBackend == LayersBackend::LAYERS_BASIC) {
result = new DeprecatedTextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
}
break;
case TEXTURE_CONTENT:
#ifdef XP_WIN
if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
if (parentBackend == LayersBackend::LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
result = new DeprecatedTextureClientD3D11(GetForwarder(), GetTextureInfo());
break;
}
if (parentBackend == LAYERS_D3D9 &&
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
!GetForwarder()->ForwardsToDifferentProcess()) {
// We can't use a d3d9 texture for an RGBA surface because we cannot get a DC for
// for a gfxWindowsSurface.
@ -153,8 +153,8 @@ CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aD
break;
case TEXTURE_FALLBACK:
#ifdef XP_WIN
if (parentBackend == LAYERS_D3D11 ||
parentBackend == LAYERS_D3D9) {
if (parentBackend == LayersBackend::LAYERS_D3D11 ||
parentBackend == LayersBackend::LAYERS_D3D9) {
result = new DeprecatedTextureClientShmem(GetForwarder(), GetTextureInfo());
}
#endif
@ -207,11 +207,11 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
#ifdef XP_WIN
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
if (parentBackend == LayersBackend::LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
result = new TextureClientD3D11(aFormat, aTextureFlags);
}
if (parentBackend == LAYERS_D3D9 &&
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
!GetForwarder()->ForwardsToDifferentProcess() &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
// non-DIB textures don't work with alpha, see notes in TextureD3D9.

View File

@ -41,10 +41,10 @@ namespace layers {
ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
{
LayersBackend backend = aForwarder->GetCompositorBackendType();
if (backend != LAYERS_OPENGL &&
backend != LAYERS_D3D9 &&
backend != LAYERS_D3D11 &&
backend != LAYERS_BASIC) {
if (backend != LayersBackend::LAYERS_OPENGL &&
backend != LayersBackend::LAYERS_D3D9 &&
backend != LayersBackend::LAYERS_D3D11 &&
backend != LayersBackend::LAYERS_BASIC) {
return nullptr;
}
@ -58,13 +58,13 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
#endif
#ifdef XP_WIN
if (backend == LAYERS_D3D11) {
if (backend == LayersBackend::LAYERS_D3D11) {
useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD2DDevice();
} else
#endif
{
useDoubleBuffering = LayerManagerComposite::SupportsDirectTexturing() ||
backend == LAYERS_BASIC;
backend == LayersBackend::LAYERS_BASIC;
}
if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
@ -75,7 +75,7 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
}
}
#ifdef XP_MACOSX
if (backend == LAYERS_OPENGL) {
if (backend == LayersBackend::LAYERS_OPENGL) {
return new ContentClientIncremental(aForwarder);
}
#endif
@ -1078,11 +1078,11 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
destBufferRect = neededRegion.GetBounds();
}
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
if (!gfxPlatform::ComponentAlphaEnabled() ||
!aLayer->GetParent() ||
!aLayer->GetParent()->SupportsComponentAlphaChildren()) {
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
} else {
contentType = gfxContentType::COLOR;
}
@ -1092,9 +1092,9 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
(!neededRegion.GetBounds().IsEqualInterior(destBufferRect) ||
neededRegion.GetNumRects() > 1)) {
// The area we add to neededRegion might not be painted opaquely
if (mode == SURFACE_OPAQUE) {
if (mode == SurfaceMode::SURFACE_OPAQUE) {
contentType = gfxContentType::COLOR_ALPHA;
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
// For component alpha layers, we leave contentType as gfxContentType::COLOR.
@ -1105,7 +1105,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
if (mHasBuffer &&
(mContentType != contentType ||
(mode == SURFACE_COMPONENT_ALPHA) != mHasBufferOnWhite)) {
(mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) != mHasBufferOnWhite)) {
// We're effectively clearing the valid region, so we need to draw
// the entire needed region now.
result.mRegionToInvalidate = aLayer->GetValidRegion();
@ -1148,7 +1148,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
bool createdBuffer = false;
uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
bufferFlags |= TEXTURE_COMPONENT_ALPHA;
}
if (canReuseBuffer) {
@ -1201,12 +1201,12 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
if (createdBuffer) {
if (mHasBuffer &&
(mode != SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
(mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
}
mHasBuffer = true;
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
mHasBufferOnWhite = true;
}
mBufferRect = destBufferRect;
@ -1228,7 +1228,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
// 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.
result.mClip = CLIP_DRAW;
result.mClip = DrawRegionClip::DRAW;
result.mMode = mode;
return result;
@ -1238,7 +1238,7 @@ DrawTarget*
ContentClientIncremental::BorrowDrawTargetForPainting(ThebesLayer* aLayer,
const PaintState& aPaintState)
{
if (!aPaintState.mMode) {
if (aPaintState.mMode == SurfaceMode::SURFACE_NONE) {
return nullptr;
}
@ -1249,7 +1249,7 @@ ContentClientIncremental::BorrowDrawTargetForPainting(ThebesLayer* aLayer,
// BeginUpdate is allowed to modify the given region,
// if it wants more to be repainted than we request.
if (aPaintState.mMode == SURFACE_COMPONENT_ALPHA) {
if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
nsIntRegion drawRegionCopy = aPaintState.mRegionToDraw;
nsRefPtr<gfxASurface> onBlack = GetUpdateSurface(BUFFER_BLACK, drawRegionCopy);
nsRefPtr<gfxASurface> onWhite = GetUpdateSurface(BUFFER_WHITE, aPaintState.mRegionToDraw);

View File

@ -404,7 +404,7 @@ BasicTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
#endif
PROFILER_LABEL("BasicTiledLayerBuffer", "PaintThebesSingleBufferDraw");
mCallback(mThebesLayer, ctxt, aPaintRegion, CLIP_NONE, nsIntRegion(), mCallbackData);
mCallback(mThebesLayer, ctxt, aPaintRegion, DrawRegionClip::CLIP_NONE, nsIntRegion(), mCallbackData);
}
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
@ -513,7 +513,7 @@ BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
mCallback(mThebesLayer, ctxt,
nsIntRegion(nsIntRect(a, nsIntSize(GetScaledTileLength(),
GetScaledTileLength()))),
CLIP_NONE,
DrawRegionClip::CLIP_NONE,
nsIntRegion(), mCallbackData);
}

View File

@ -119,9 +119,9 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS
mImageHost->GetAsTextureHost() ? mImageHost->GetAsTextureHost()->GetSize()
: mImageHost->GetDeprecatedTextureHost()->GetSize();
sourceRect.SizeTo(size.width, size.height);
if (mScaleMode != SCALE_NONE &&
if (mScaleMode != ScaleMode::SCALE_NONE &&
sourceRect.width != 0.0 && sourceRect.height != 0.0) {
NS_ASSERTION(mScaleMode == SCALE_STRETCH,
NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
"No other scalemodes than stretch and none supported yet.");
local.Scale(mScaleToSize.width / sourceRect.width,
mScaleToSize.height / sourceRect.height, 1.0);

View File

@ -152,7 +152,7 @@ LayerManagerComposite::BeginTransaction()
mIsCompositorReady = true;
if (Compositor::GetBackend() == LAYERS_BASIC) {
if (Compositor::GetBackend() == LayersBackend::LAYERS_BASIC) {
mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
}
}

View File

@ -111,7 +111,7 @@ DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescri
CompositableHost* aCompositableHost)
{
switch (Compositor::GetBackend()) {
case LAYERS_OPENGL:
case LayersBackend::LAYERS_OPENGL:
{
RefPtr<DeprecatedTextureHost> result;
result = CreateDeprecatedTextureHostOGL(aDescriptorType,
@ -123,16 +123,16 @@ DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescri
return result;
}
#ifdef XP_WIN
case LAYERS_D3D9:
case LayersBackend::LAYERS_D3D9:
return CreateDeprecatedTextureHostD3D9(aDescriptorType,
aDeprecatedTextureHostFlags,
aTextureFlags);
case LAYERS_D3D11:
case LayersBackend::LAYERS_D3D11:
return CreateDeprecatedTextureHostD3D11(aDescriptorType,
aDeprecatedTextureHostFlags,
aTextureFlags);
#endif
case LAYERS_BASIC:
case LayersBackend::LAYERS_BASIC:
return CreateBasicDeprecatedTextureHost(aDescriptorType,
aDeprecatedTextureHostFlags,
aTextureFlags);
@ -168,21 +168,21 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
TextureFlags aFlags)
{
switch (Compositor::GetBackend()) {
case LAYERS_OPENGL:
case LayersBackend::LAYERS_OPENGL:
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
case LAYERS_BASIC:
case LayersBackend::LAYERS_BASIC:
return CreateTextureHostBasic(aDesc, aDeallocator, aFlags);
#ifdef MOZ_WIDGET_GONK
case LAYERS_NONE:
case LayersBackend::LAYERS_NONE:
// Power on video reqests to allocate TextureHost,
// when Compositor is still not present. This is a very hacky workaround.
// See Bug 944420.
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
#endif
#ifdef XP_WIN
case LAYERS_D3D11:
case LayersBackend::LAYERS_D3D11:
return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags);
case LAYERS_D3D9:
case LayersBackend::LAYERS_D3D9:
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
#endif
default:

View File

@ -105,13 +105,13 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
RemoteBitmapImage *remoteImage =
static_cast<RemoteBitmapImage*>(aImage);
if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) {
if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
nsAutoPtr<TextureD3D10BackendData> dat(new TextureD3D10BackendData());
dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize);
if (dat->mTexture) {
device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget());
}
}
@ -132,19 +132,19 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
return nullptr;
}
if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) {
if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
nsAutoPtr<TextureD3D10BackendData> dat(new TextureD3D10BackendData());
dat->mTexture = SurfaceToTexture(device(), surf, cairoImage->GetSize());
if (dat->mTexture) {
device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget());
}
}
aHasAlpha = surf->GetContentType() == gfxContentType::COLOR_ALPHA;
} else if (aImage->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE) {
if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) {
if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
// Use resource sharing to open the D3D9 texture as a D3D10 texture,
HRESULT hr;
D3D9SurfaceImage* d3dImage = reinterpret_cast<D3D9SurfaceImage*>(aImage);
@ -160,7 +160,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
hr = device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
NS_ENSURE_TRUE(SUCCEEDED(hr) && dat->mSRView, nullptr);
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget());
}
aHasAlpha = false;
} else {
@ -169,7 +169,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
}
TextureD3D10BackendData *data =
static_cast<TextureD3D10BackendData*>(aImage->GetBackendData(mozilla::layers::LAYERS_D3D10));
static_cast<TextureD3D10BackendData*>(aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10));
if (!data) {
return nullptr;
@ -255,12 +255,12 @@ ImageLayerD3D10::RenderLayer()
return;
}
if (!yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) {
if (!yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
AllocateTexturesYCbCr(yuvImage);
}
PlanarYCbCrD3D10BackendData *data =
static_cast<PlanarYCbCrD3D10BackendData*>(yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D10));
static_cast<PlanarYCbCrD3D10BackendData*>(yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10));
if (!data) {
return;
@ -394,7 +394,7 @@ void ImageLayerD3D10::AllocateTexturesYCbCr(PlanarYCbCrImage *aImage)
device()->CreateShaderResourceView(backendData->mCbTexture, nullptr, getter_AddRefs(backendData->mCbView));
device()->CreateShaderResourceView(backendData->mCrTexture, nullptr, getter_AddRefs(backendData->mCrView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, backendData.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, backendData.forget());
}
already_AddRefed<ID3D10ShaderResourceView>
@ -497,9 +497,9 @@ RemoteDXGITextureImage::DeprecatedGetAsSurface()
TextureD3D10BackendData*
RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
{
if (GetBackendData(mozilla::layers::LAYERS_D3D10)) {
if (GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
TextureD3D10BackendData *data =
static_cast<TextureD3D10BackendData*>(GetBackendData(mozilla::layers::LAYERS_D3D10));
static_cast<TextureD3D10BackendData*>(GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10));
nsRefPtr<ID3D10Device> device;
data->mTexture->GetDevice(getter_AddRefs(device));
@ -522,7 +522,7 @@ RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
aDevice->CreateShaderResourceView(texture, nullptr, getter_AddRefs(data->mSRView));
SetBackendData(mozilla::layers::LAYERS_D3D10, data);
SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, data);
return data.forget();
}

View File

@ -120,7 +120,7 @@ public:
CreateDrawTarget(const gfx::IntSize &aSize,
mozilla::gfx::SurfaceFormat aFormat);
virtual LayersBackend GetBackendType() { return LAYERS_D3D10; }
virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_D3D10; }
virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 10"); }
virtual const char* Name() const { return "D3D10"; }

View File

@ -34,7 +34,7 @@ namespace layers {
ThebesLayerD3D10::ThebesLayerD3D10(LayerManagerD3D10 *aManager)
: ThebesLayer(aManager, nullptr)
, LayerD3D10(aManager)
, mCurrentSurfaceMode(SURFACE_OPAQUE)
, mCurrentSurfaceMode(SurfaceMode::SURFACE_OPAQUE)
{
mImplData = static_cast<LayerD3D10*>(this);
}
@ -94,13 +94,13 @@ ThebesLayerD3D10::RenderLayer()
ID3D10EffectTechnique *technique;
switch (mCurrentSurfaceMode) {
case SURFACE_COMPONENT_ALPHA:
case SurfaceMode::SURFACE_COMPONENT_ALPHA:
technique = SelectShader(SHADER_COMPONENT_ALPHA | LoadMaskTexture());
break;
case SURFACE_OPAQUE:
case SurfaceMode::SURFACE_OPAQUE:
technique = SelectShader(SHADER_RGB | SHADER_PREMUL | LoadMaskTexture());
break;
case SURFACE_SINGLE_CHANNEL_ALPHA:
case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA:
technique = SelectShader(SHADER_RGBA | SHADER_PREMUL | LoadMaskTexture());
break;
default:
@ -154,9 +154,9 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback)
nsIntRect newTextureRect = mVisibleRegion.GetBounds();
SurfaceMode mode = GetSurfaceMode();
if (mode == SURFACE_COMPONENT_ALPHA &&
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA &&
(!mParent || !mParent->SupportsComponentAlphaChildren())) {
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
// If we have a transform that requires resampling of our texture, then
// we need to make sure we don't sample pixels that haven't been drawn.
@ -168,11 +168,11 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback)
neededRegion.GetNumRects() > 1) {
if (MayResample()) {
neededRegion = newTextureRect;
if (mode == SURFACE_OPAQUE) {
if (mode == SurfaceMode::SURFACE_OPAQUE) {
// We're going to paint outside the visible region, but layout hasn't
// promised that it will paint opaquely there, so we'll have to
// treat this layer as transparent.
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
}
}
@ -226,7 +226,7 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback)
}
mTextureRect = newTextureRect;
if (!mTexture || (mode == SURFACE_COMPONENT_ALPHA && !mTextureOnWhite)) {
if (!mTexture || (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA && !mTextureOnWhite)) {
CreateNewTextures(gfx::IntSize(newTextureRect.width, newTextureRect.height), mode);
mValidRegion.SetEmpty();
}
@ -286,7 +286,7 @@ void
ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode)
{
if (mD2DSurface) {
gfxContentType type = aMode != SURFACE_SINGLE_CHANNEL_ALPHA ?
gfxContentType type = aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ?
gfxContentType::COLOR : gfxContentType::COLOR_ALPHA;
if (type != mD2DSurface->GetContentType()) {
@ -301,7 +301,7 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode)
mValidRegion.SetEmpty();
}
} else if (mDrawTarget) {
SurfaceFormat format = aMode != SURFACE_SINGLE_CHANNEL_ALPHA ?
SurfaceFormat format = aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ?
SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8;
if (format != mDrawTarget->GetFormat()) {
@ -316,7 +316,7 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode)
}
}
if (aMode != SURFACE_COMPONENT_ALPHA && mTextureOnWhite) {
if (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA && mTextureOnWhite) {
// If we've transitioned away from component alpha, we can delete those resources.
mD2DSurfaceOnWhite = nullptr;
mSRViewOnWhite = nullptr;
@ -400,7 +400,7 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode)
nsRefPtr<gfxASurface> destinationSurface;
if (aMode == SURFACE_COMPONENT_ALPHA) {
if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
FillTexturesBlackWhite(aRegion, visibleRect.TopLeft());
if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) {
gfxASurface* surfaces[2] = { mD2DSurface.get(), mD2DSurfaceOnWhite.get() };
@ -418,7 +418,7 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode)
nsRefPtr<gfxContext> context = new gfxContext(mDrawTarget);
context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y));
if (aMode == SURFACE_SINGLE_CHANNEL_ALPHA) {
if (aMode == SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA) {
nsIntRegionRectIterator iter(aRegion);
const nsIntRect *iterRect;
while ((iterRect = iter.Next())) {
@ -429,7 +429,7 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode)
mDrawTarget->SetPermitSubpixelAA(!(mContentFlags & CONTENT_COMPONENT_ALPHA));
LayerManagerD3D10::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
cbInfo.Callback(this, context, aRegion, CLIP_DRAW, nsIntRegion(), cbInfo.CallbackData);
cbInfo.Callback(this, context, aRegion, DrawRegionClip::DRAW, nsIntRegion(), cbInfo.CallbackData);
}
void
@ -460,7 +460,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode
}
if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) {
mD2DSurface = new gfxD2DSurface(mTexture, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ?
mD2DSurface = new gfxD2DSurface(mTexture, aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ?
gfxContentType::COLOR : gfxContentType::COLOR_ALPHA);
if (!mD2DSurface || mD2DSurface->CairoStatus()) {
@ -473,7 +473,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode
}
}
if (aMode == SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) {
if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) {
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTextureOnWhite));
if (FAILED(hr)) {
@ -501,10 +501,10 @@ ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode
}
if (gfxPlatform::GetPlatform()->SupportsAzureContent() && !mDrawTarget) {
if (aMode == SURFACE_COMPONENT_ALPHA) {
if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
mDrawTarget = Factory::CreateDualDrawTargetForD3D10Textures(mTexture, mTextureOnWhite, SurfaceFormat::B8G8R8X8);
} else {
mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ?
mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ?
SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8);
}

View File

@ -65,7 +65,7 @@ CompositorD3D11::CompositorD3D11(nsIWidget* aWidget)
, mHwnd(nullptr)
, mDisableSequenceForNextFrame(false)
{
sBackend = LAYERS_D3D11;
sBackend = LayersBackend::LAYERS_D3D11;
}
CompositorD3D11::~CompositorD3D11()
@ -352,7 +352,7 @@ CompositorD3D11::GetTextureFactoryIdentifier()
TextureFactoryIdentifier ident;
ident.mMaxTextureSize = GetMaxTextureSize();
ident.mParentProcessId = XRE_GetProcessType();
ident.mParentBackend = LAYERS_D3D11;
ident.mParentBackend = LayersBackend::LAYERS_D3D11;
return ident;
}

View File

@ -26,7 +26,7 @@ CompositorD3D9::CompositorD3D9(PCompositorParent* aParent, nsIWidget *aWidget)
, mWidget(aWidget)
, mDeviceResetCount(0)
{
sBackend = LAYERS_D3D9;
sBackend = LayersBackend::LAYERS_D3D9;
}
CompositorD3D9::~CompositorD3D9()
@ -63,7 +63,7 @@ CompositorD3D9::GetTextureFactoryIdentifier()
{
TextureFactoryIdentifier ident;
ident.mMaxTextureSize = GetMaxTextureSize();
ident.mParentBackend = LAYERS_D3D9;
ident.mParentBackend = LayersBackend::LAYERS_D3D9;
ident.mParentProcessId = XRE_GetProcessType();
return ident;
}

View File

@ -306,7 +306,7 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
backendData->mCrTexture->UnlockRect(0);
}
aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, backendData.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, backendData.forget());
}
Layer*
@ -331,11 +331,11 @@ ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha)
RemoteBitmapImage *remoteImage =
static_cast<RemoteBitmapImage*>(aImage);
if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) {
if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) {
nsAutoPtr<TextureD3D9BackendData> dat(new TextureD3D9BackendData());
dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize, D3DFMT_A8R8G8B8);
if (dat->mTexture) {
aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, dat.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, dat.forget());
}
}
@ -349,24 +349,24 @@ ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha)
return nullptr;
}
if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) {
if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) {
nsAutoPtr<TextureD3D9BackendData> dat(new TextureD3D9BackendData());
dat->mTexture = SurfaceToTexture(device(), surf, cairoImage->GetSize());
if (dat->mTexture) {
aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, dat.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, dat.forget());
}
}
aHasAlpha = surf->GetContentType() == gfxContentType::COLOR_ALPHA;
} else if (aImage->GetFormat() == D3D9_RGB32_TEXTURE) {
if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) {
if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) {
// The texture in which the frame is stored belongs to DXVA's D3D9 device.
// We need to open it on our device before we can use it.
nsAutoPtr<TextureD3D9BackendData> backendData(new TextureD3D9BackendData());
D3D9SurfaceImage* image = static_cast<D3D9SurfaceImage*>(aImage);
backendData->mTexture = OpenSharedTexture(image->GetDesc(), image->GetShareHandle(), device());
if (backendData->mTexture) {
aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, backendData.forget());
aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, backendData.forget());
}
}
aHasAlpha = false;
@ -376,7 +376,7 @@ ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha)
}
TextureD3D9BackendData *data =
static_cast<TextureD3D9BackendData*>(aImage->GetBackendData(mozilla::layers::LAYERS_D3D9));
static_cast<TextureD3D9BackendData*>(aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9));
if (!data) {
return nullptr;
@ -457,12 +457,12 @@ ImageLayerD3D9::RenderLayer()
return;
}
if (!yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) {
if (!yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) {
AllocateTexturesYCbCr(yuvImage, device(), mD3DManager);
}
PlanarYCbCrD3D9BackendData *data =
static_cast<PlanarYCbCrD3D9BackendData*>(yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D9));
static_cast<PlanarYCbCrD3D9BackendData*>(yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9));
if (!data) {
return;

View File

@ -103,7 +103,7 @@ public:
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
virtual LayersBackend GetBackendType() { return LAYERS_D3D9; }
virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_D3D9; }
virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 9"); }
bool DeviceWasRemoved() { return deviceManager()->DeviceWasRemoved(); }

View File

@ -131,7 +131,7 @@ ThebesLayerD3D9::UpdateTextures(SurfaceMode aMode)
} else {
CopyRegion(oldTexture, mTextureRect.TopLeft(), mTexture, visibleRect.TopLeft(),
retainRegion, &mValidRegion);
if (aMode == SURFACE_COMPONENT_ALPHA) {
if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
CopyRegion(oldTextureOnWhite, mTextureRect.TopLeft(), mTextureOnWhite, visibleRect.TopLeft(),
retainRegion, &mValidRegion);
}
@ -182,9 +182,9 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback)
nsIntRect newTextureRect = mVisibleRegion.GetBounds();
SurfaceMode mode = GetSurfaceMode();
if (mode == SURFACE_COMPONENT_ALPHA &&
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA &&
(!mParent || !mParent->SupportsComponentAlphaChildren())) {
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
// If we have a transform that requires resampling of our texture, then
// we need to make sure we don't sample pixels that haven't been drawn.
@ -196,11 +196,11 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback)
neededRegion.GetNumRects() > 1) {
if (MayResample()) {
neededRegion = newTextureRect;
if (mode == SURFACE_OPAQUE) {
if (mode == SurfaceMode::SURFACE_OPAQUE) {
// We're going to paint outside the visible region, but layout hasn't
// promised that it will paint opaquely there, so we'll have to
// treat this layer as transparent.
mode = SURFACE_SINGLE_CHANNEL_ALPHA;
mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
}
}
}
@ -246,7 +246,7 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback)
SetShaderTransformAndOpacity();
if (mode == SURFACE_COMPONENT_ALPHA) {
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
mD3DManager->SetShaderMode(DeviceManagerD3D9::COMPONENTLAYERPASS1,
GetMaskLayer());
device()->SetTexture(0, mTexture);
@ -315,17 +315,17 @@ ThebesLayerD3D9::VerifyContentType(SurfaceMode aMode)
mTexture->GetLevelDesc(0, &desc);
switch (aMode) {
case SURFACE_OPAQUE:
case SurfaceMode::SURFACE_OPAQUE:
if (desc.Format == D3DFMT_X8R8G8B8 && !mTextureOnWhite)
return;
break;
case SURFACE_SINGLE_CHANNEL_ALPHA:
case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA:
if (desc.Format == D3DFMT_A8R8G8B8 && !mTextureOnWhite)
return;
break;
case SURFACE_COMPONENT_ALPHA:
case SurfaceMode::SURFACE_COMPONENT_ALPHA:
if (mTextureOnWhite) {
NS_ASSERTION(desc.Format == D3DFMT_X8R8G8B8, "Wrong format for component alpha texture");
return;
@ -432,11 +432,11 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
switch (aMode)
{
case SURFACE_OPAQUE:
case SurfaceMode::SURFACE_OPAQUE:
destinationSurface = opaqueRenderer.Begin(this);
break;
case SURFACE_SINGLE_CHANNEL_ALPHA: {
case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA: {
hr = device()->CreateTexture(bounds.width, bounds.height, 1,
0, D3DFMT_A8R8G8B8,
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), nullptr);
@ -459,7 +459,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
break;
}
case SURFACE_COMPONENT_ALPHA: {
case SurfaceMode::SURFACE_COMPONENT_ALPHA: {
nsRefPtr<gfxWindowsSurface> onBlack = opaqueRenderer.Begin(this);
nsRefPtr<gfxWindowsSurface> onWhite = opaqueRendererOnWhite.Begin(this);
if (onBlack && onWhite) {
@ -493,10 +493,10 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
context->Translate(gfxPoint(-bounds.x, -bounds.y));
LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
cbInfo.Callback(this, context, aRegion, CLIP_NONE, nsIntRegion(), cbInfo.CallbackData);
cbInfo.Callback(this, context, aRegion, DrawRegionClip::CLIP_NONE, nsIntRegion(), cbInfo.CallbackData);
for (uint32_t i = 0; i < aReadbackUpdates.Length(); ++i) {
NS_ASSERTION(aMode == SURFACE_OPAQUE,
NS_ASSERTION(aMode == SurfaceMode::SURFACE_OPAQUE,
"Transparent surfaces should not be used for readback");
const ReadbackProcessor::Update& update = aReadbackUpdates[i];
nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset();
@ -518,7 +518,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
nsAutoTArray<IDirect3DTexture9*,2> destTextures;
switch (aMode)
{
case SURFACE_OPAQUE:
case SurfaceMode::SURFACE_OPAQUE:
// Must release reference to dest surface before ending drawing
destinationSurface = nullptr;
opaqueRenderer.End();
@ -526,7 +526,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
destTextures.AppendElement(mTexture);
break;
case SURFACE_SINGLE_CHANNEL_ALPHA: {
case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA: {
LockTextureRectD3D9 textureLock(tmpTexture);
if (!textureLock.HasLock()) {
NS_WARNING("Failed to lock ThebesLayer tmpTexture texture.");
@ -557,7 +557,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
break;
}
case SURFACE_COMPONENT_ALPHA: {
case SurfaceMode::SURFACE_COMPONENT_ALPHA: {
// Must release reference to dest surface before ending drawing
destinationSurface = nullptr;
opaqueRenderer.End();
@ -610,7 +610,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfx::IntSize &aSize,
mTextureOnWhite = nullptr;
HRESULT hr = device()->CreateTexture(aSize.width, aSize.height, 1,
D3DUSAGE_RENDERTARGET,
aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture"),
@ -618,7 +618,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfx::IntSize &aSize,
return;
}
if (aMode == SURFACE_COMPONENT_ALPHA) {
if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
hr = device()->CreateTexture(aSize.width, aSize.height, 1,
D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8,

View File

@ -51,7 +51,7 @@ private:
bool HaveTextures(SurfaceMode aMode)
{
return mTexture && (aMode != SURFACE_COMPONENT_ALPHA || mTextureOnWhite);
return mTexture && (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mTextureOnWhite);
}
/* Checks if our surface has the right content type */

View File

@ -725,24 +725,24 @@ CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackend
for (size_t i = 0; i < aBackendHints.Length(); ++i) {
RefPtr<Compositor> compositor;
if (aBackendHints[i] == LAYERS_OPENGL) {
if (aBackendHints[i] == LayersBackend::LAYERS_OPENGL) {
compositor = new CompositorOGL(mWidget,
mEGLSurfaceSize.width,
mEGLSurfaceSize.height,
mUseExternalSurfaceSize);
} else if (aBackendHints[i] == LAYERS_BASIC) {
} else if (aBackendHints[i] == LayersBackend::LAYERS_BASIC) {
compositor = new BasicCompositor(mWidget);
#ifdef XP_WIN
} else if (aBackendHints[i] == LAYERS_D3D11) {
} else if (aBackendHints[i] == LayersBackend::LAYERS_D3D11) {
compositor = new CompositorD3D11(mWidget);
} else if (aBackendHints[i] == LAYERS_D3D9) {
} else if (aBackendHints[i] == LayersBackend::LAYERS_D3D9) {
compositor = new CompositorD3D9(this, mWidget);
#endif
}
if (!compositor) {
// We passed a backend hint for which we can't create a compositor.
// For example, we sometime pass LAYERS_NONE as filler in aBackendHints.
// For example, we sometime pass LayersBackend::LAYERS_NONE as filler in aBackendHints.
continue;
}

View File

@ -71,7 +71,7 @@ ImageBridgeParent::RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply)
{
// If we don't actually have a compositor, then don't bother
// creating any textures.
if (Compositor::GetBackend() == LAYERS_NONE) {
if (Compositor::GetBackend() == LayersBackend::LAYERS_NONE) {
return true;
}

View File

@ -78,7 +78,7 @@ parent:
returns (float[] intervals);
// layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LAYERS_NONE
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored.
sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id)
returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success);

View File

@ -253,7 +253,7 @@ CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth,
, mHeight(0)
{
MOZ_COUNT_CTOR(CompositorOGL);
sBackend = LAYERS_OPENGL;
sBackend = LayersBackend::LAYERS_OPENGL;
}
CompositorOGL::~CompositorOGL()

View File

@ -76,7 +76,7 @@ public:
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
{
return TextureFactoryIdentifier(LAYERS_OPENGL,
return TextureFactoryIdentifier(LayersBackend::LAYERS_OPENGL,
XRE_GetProcessType(),
GetMaxTextureSize(),
mFBOTextureTarget == LOCAL_GL_TEXTURE_2D,

View File

@ -50,7 +50,7 @@ private:
GLManager::CreateGLManager(LayerManagerComposite* aManager)
{
if (aManager &&
Compositor::GetBackend() == LAYERS_OPENGL) {
Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
return new GLManagerCompositor(static_cast<CompositorOGL*>(
aManager->GetCompositor()));
}

View File

@ -19,7 +19,7 @@ public:
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) { return false; }
virtual already_AddRefed<ContainerLayer> CreateContainerLayer() { return nullptr; }
virtual void GetBackendName(nsAString& aName) {}
virtual LayersBackend GetBackendType() { return LAYERS_BASIC; }
virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
virtual void BeginTransaction() {}
virtual already_AddRefed<ImageLayer> CreateImageLayer() { return nullptr; }
virtual void SetRoot(Layer* aLayer) {}

View File

@ -3513,7 +3513,7 @@ static bool ShouldDrawRectsSeparately(gfxContext* aContext, DrawRegionClip aClip
if (!sPaintRectsSeparately ||
aContext->IsCairo() ||
aClip == CLIP_NONE) {
aClip == DrawRegionClip::CLIP_NONE) {
return false;
}
@ -3594,9 +3594,9 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
bool shouldDrawRectsSeparately = ShouldDrawRectsSeparately(aContext, aClip);
if (!shouldDrawRectsSeparately) {
if (aClip == CLIP_DRAW_SNAPPED) {
if (aClip == DrawRegionClip::DRAW_SNAPPED) {
gfxUtils::ClipToRegionSnapped(aContext, aRegionToDraw);
} else if (aClip == CLIP_DRAW) {
} else if (aClip == DrawRegionClip::DRAW) {
gfxUtils::ClipToRegion(aContext, aRegionToDraw);
}
@ -3623,7 +3623,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
while (const nsIntRect* iterRect = it.Next()) {
gfxContextAutoSaveRestore save(aContext);
aContext->NewPath();
aContext->Rectangle(*iterRect, aClip == CLIP_DRAW_SNAPPED);
aContext->Rectangle(*iterRect, aClip == DrawRegionClip::DRAW_SNAPPED);
aContext->Clip();
DrawForcedBackgroundColor(aContext, aLayer, userData->mForcedBackgroundColor);

View File

@ -5804,7 +5804,7 @@ PresShell::Paint(nsView* aViewToPaint,
NotifySubDocInvalidationFunc computeInvalidFunc =
presContext->MayHavePaintEventListenerInSubDocument() ? nsPresContext::NotifySubDocInvalidation : 0;
bool computeInvalidRect = computeInvalidFunc ||
(layerManager->GetBackendType() == LAYERS_BASIC);
(layerManager->GetBackendType() == LayersBackend::LAYERS_BASIC);
nsAutoPtr<LayerProperties> props(computeInvalidRect ?
LayerProperties::CloneFrom(layerManager->GetRoot()) :

View File

@ -4905,7 +4905,7 @@ nsIFrame::InvalidateLayer(uint32_t aDisplayItemKey,
// If the layer is being updated asynchronously, and it's being forwarded
// to a compositor, then we don't need to invalidate.
if ((aFlags & UPDATE_IS_ASYNC) && layer &&
layer->Manager()->GetBackendType() == LAYERS_CLIENT) {
layer->Manager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
return layer;
}

View File

@ -1562,7 +1562,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
}
#endif
imglayer->SetScaleToSize(size, SCALE_STRETCH);
imglayer->SetScaleToSize(size, ScaleMode::STRETCH);
imglayer->SetContainer(container);
GraphicsFilter filter =
nsLayoutUtils::GetGraphicsFilterForFrame(this);

View File

@ -102,7 +102,7 @@ AssertInTopLevelChromeDoc(ContainerLayer* aContainer,
nsIFrame* aContainedFrame)
{
NS_ASSERTION(
(aContainer->Manager()->GetBackendType() != mozilla::layers::LAYERS_BASIC) ||
(aContainer->Manager()->GetBackendType() != mozilla::layers::LayersBackend::LAYERS_BASIC) ||
(aContainedFrame->GetNearestWidget() ==
static_cast<BasicLayerManager*>(aContainer->Manager())->GetRetainerWidget()),
"Expected frame to be in top-level chrome document");
@ -354,7 +354,7 @@ ClearContainer(ContainerLayer* aContainer)
inline static bool
IsTempLayerManager(LayerManager* aManager)
{
return (mozilla::layers::LAYERS_BASIC == aManager->GetBackendType() &&
return (mozilla::layers::LayersBackend::LAYERS_BASIC == aManager->GetBackendType() &&
!static_cast<BasicLayerManager*>(aManager)->IsRetained());
}
@ -705,7 +705,7 @@ RenderFrameParent::Init(nsFrameLoader* aFrameLoader,
nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
// Perhaps the document containing this frame currently has no presentation?
if (lm && lm->GetBackendType() == LAYERS_CLIENT) {
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
*aTextureFactoryIdentifier =
static_cast<ClientLayerManager*>(lm.get())->GetTextureFactoryIdentifier();
} else {
@ -723,7 +723,7 @@ RenderFrameParent::Init(nsFrameLoader* aFrameLoader,
// Our remote frame will push layers updates to the compositor,
// and we'll keep an indirect reference to that tree.
*aId = mLayersId = CompositorParent::AllocateLayerTreeId();
if (lm && lm->GetBackendType() == LAYERS_CLIENT) {
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
ClientLayerManager *clientManager = static_cast<ClientLayerManager*>(lm.get());
clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
}

View File

@ -984,21 +984,21 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
mWidgetListener->WillPaintWindow(this);
switch (GetLayerManager(nullptr)->GetBackendType()) {
case mozilla::layers::LAYERS_BASIC: {
case mozilla::layers::LayersBackend::LAYERS_BASIC: {
nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
{
mozilla::layers::RenderTraceScope trace2("Basic DrawTo", "727272");
AutoLayerManagerSetup
setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE);
setupLayerManager(this, ctx, mozilla::layers::BufferMode::BUFFER_NONE);
mWidgetListener->PaintWindow(this, region);
}
break;
}
case mozilla::layers::LAYERS_CLIENT: {
case mozilla::layers::LayersBackend::LAYERS_CLIENT: {
mWidgetListener->PaintWindow(this, region);
break;
}

View File

@ -146,7 +146,7 @@ public:
virtual nsIMEUpdatePreference GetIMEUpdatePreference();
LayerManager* GetLayerManager (PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);

View File

@ -1564,7 +1564,7 @@ NS_IMETHODIMP nsChildView::Invalidate(const nsIntRect &aRect)
if (!mView || !mVisible)
return NS_OK;
NS_ASSERTION(GetLayerManager()->GetBackendType() != LAYERS_CLIENT,
NS_ASSERTION(GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_CLIENT,
"Shouldn't need to invalidate with accelerated OMTC layers!");
if ([NSView focusView]) {
@ -3570,11 +3570,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
nsAutoRetainCocoaObject kungFuDeathGrip(self);
bool painted = false;
if (mGeckoChild->GetLayerManager()->GetBackendType() == LAYERS_BASIC) {
if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
nsBaseWidget::AutoLayerManagerSetup
setupLayerManager(mGeckoChild, targetContext, BUFFER_NONE);
setupLayerManager(mGeckoChild, targetContext, BufferMode::BUFFER_NONE);
painted = mGeckoChild->PaintWindow(region);
} else if (mGeckoChild->GetLayerManager()->GetBackendType() == LAYERS_CLIENT) {
} else if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
// We only need this so that we actually get DidPaintWindow fired
painted = mGeckoChild->PaintWindow(region);
}
@ -3622,7 +3622,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
if (!mGeckoChild || ![self window])
return NO;
return mGeckoChild->GetLayerManager(nullptr)->GetBackendType() == mozilla::layers::LAYERS_OPENGL;
return mGeckoChild->GetLayerManager(nullptr)->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL;
}
- (BOOL)isUsingOpenGL
@ -3831,7 +3831,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
// So we notify our nsChildView about any areas needing repainting.
mGeckoChild->NotifyDirtyRegion([self nativeDirtyRegionWithBoundingRect:[self bounds]]);
if (mGeckoChild->GetLayerManager()->GetBackendType() == LAYERS_CLIENT) {
if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
ClientLayerManager *manager = static_cast<ClientLayerManager*>(mGeckoChild->GetLayerManager());
manager->AsShadowForwarder()->WindowOverlayChanged();
}

View File

@ -290,7 +290,7 @@ public:
NS_IMETHOD Invalidate(const nsIntRect &aRect);
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,

View File

@ -199,9 +199,9 @@ nsWindow::DoDraw(void)
}
LayerManager* lm = gWindowToRedraw->GetLayerManager();
if (mozilla::layers::LAYERS_CLIENT == lm->GetBackendType()) {
if (mozilla::layers::LayersBackend::LAYERS_CLIENT == lm->GetBackendType()) {
// No need to do anything, the compositor will handle drawing
} else if (mozilla::layers::LAYERS_BASIC == lm->GetBackendType()) {
} else if (mozilla::layers::LayersBackend::LAYERS_BASIC == lm->GetBackendType()) {
MOZ_ASSERT(sFramebufferOpen || sUsingOMTC);
nsRefPtr<gfxASurface> targetSurface;
@ -217,7 +217,7 @@ nsWindow::DoDraw(void)
// No double-buffering needed.
AutoLayerManagerSetup setupLayerManager(
gWindowToRedraw, ctx, mozilla::layers::BUFFER_NONE,
gWindowToRedraw, ctx, mozilla::layers::BufferMode::BUFFER_NONE,
ScreenRotation(EffectiveScreenRotation()));
listener = gWindowToRedraw->GetWidgetListener();
@ -544,15 +544,15 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
if (mLayerManager) {
// This layer manager might be used for painting outside of DoDraw(), so we need
// to set the correct rotation on it.
if (mLayerManager->GetBackendType() == LAYERS_BASIC) {
if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) {
BasicLayerManager* manager =
static_cast<BasicLayerManager*>(mLayerManager.get());
manager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE,
manager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE,
ScreenRotation(EffectiveScreenRotation()));
} else if (mLayerManager->GetBackendType() == LAYERS_CLIENT) {
} else if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
ClientLayerManager* manager =
static_cast<ClientLayerManager*>(mLayerManager.get());
manager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE,
manager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE,
ScreenRotation(EffectiveScreenRotation()));
}
return mLayerManager;
@ -646,7 +646,7 @@ uint32_t
nsWindow::GetGLFrameBufferFormat()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) {
// We directly map the hardware fb on Gonk. The hardware fb
// has RGB format.
return LOCAL_GL_RGB;

View File

@ -98,7 +98,7 @@ public:
virtual double GetDefaultScaleInternal();
virtual mozilla::layers::LayerManager*
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);
gfxASurface* GetThebesSurface();

View File

@ -2054,7 +2054,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
nsIntRegion &region = exposeRegion.mRegion;
ClientLayerManager *clientLayers =
(GetLayerManager()->GetBackendType() == LAYERS_CLIENT)
(GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT)
? static_cast<ClientLayerManager*>(GetLayerManager())
: nullptr;
@ -2139,7 +2139,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
}
// If this widget uses OMTC...
if (GetLayerManager()->GetBackendType() == LAYERS_CLIENT) {
if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
listener->PaintWindow(this, region);
listener->DidPaintWindow();
return TRUE;
@ -2192,16 +2192,16 @@ nsWindow::OnExposeEvent(cairo_t *cr)
// The double buffering is done here to extract the shape mask.
// (The shape mask won't be necessary when a visual with an alpha
// channel is used on compositing window managers.)
layerBuffering = mozilla::layers::BUFFER_NONE;
layerBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
ctx->PushGroup(gfxContentType::COLOR_ALPHA);
#ifdef MOZ_HAVE_SHMIMAGE
} else if (nsShmImage::UseShm()) {
// We're using an xshm mapping as a back buffer.
layerBuffering = mozilla::layers::BUFFER_NONE;
layerBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
#endif // MOZ_HAVE_SHMIMAGE
} else {
// Get the layer manager to do double buffering (if necessary).
layerBuffering = mozilla::layers::BUFFER_BUFFERED;
layerBuffering = mozilla::layers::BufferMode::BUFFERED;
}
#if 0
@ -2219,7 +2219,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
bool painted = false;
{
if (GetLayerManager()->GetBackendType() == LAYERS_BASIC) {
if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
AutoLayerManagerSetup setupLayerManager(this, ctx, layerBuffering);
painted = listener->PaintWindow(this, region);
}
@ -6212,7 +6212,7 @@ void
nsWindow::ClearCachedResources()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) {
mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_BASIC) {
mLayerManager->ClearCachedResources();
}

View File

@ -441,7 +441,7 @@ private:
// nsBaseWidget
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr) MOZ_OVERRIDE;

View File

@ -1202,21 +1202,21 @@ class nsIWidget : public nsISupports {
*/
inline LayerManager* GetLayerManager(bool* aAllowRetaining = nullptr)
{
return GetLayerManager(nullptr, mozilla::layers::LAYERS_NONE,
return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE,
LAYER_MANAGER_CURRENT, aAllowRetaining);
}
inline LayerManager* GetLayerManager(LayerManagerPersistence aPersistence,
bool* aAllowRetaining = nullptr)
{
return GetLayerManager(nullptr, mozilla::layers::LAYERS_NONE,
return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE,
aPersistence, aAllowRetaining);
}
/**
* Like GetLayerManager(), but prefers creating a layer manager of
* type |aBackendHint| instead of what would normally be created.
* LAYERS_NONE means "no hint".
* LayersBackend::LAYERS_NONE means "no hint".
*/
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager,
LayersBackend aBackendHint,

View File

@ -2086,7 +2086,7 @@ do {
// Init the Layers manager then dispatch the event.
// If it returns false there's nothing to paint, so exit.
AutoLayerManagerSetup
setupLayerManager(this, thebesContext, BasicLayerManager::BUFFER_NONE);
setupLayerManager(this, thebesContext, BasicLayerManager::BufferMode::BUFFER_NONE);
if (!DispatchWindowEvent(&event, eventStatus)) {
break;
}

View File

@ -434,7 +434,7 @@ void
nsWindow::ClearCachedResources()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) {
mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_BASIC) {
statimLayerManager->ClearCachedResources();
}
for (nsIWidget* kid = mFirstChild; kid; ) {
@ -1077,7 +1077,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
{
AutoLayerManagerSetup
setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE);
setupLayerManager(this, ctx, mozilla::layers::BufferMode::BUFFER_NONE);
if (mWidgetListener) {
nsIntRegion region(rect);
painted = mWidgetListener->PaintWindow(this, region);
@ -3139,7 +3139,7 @@ uint32_t
nsWindow::GetGLFrameBufferFormat()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) {
return MozQGLWidgetWrapper::isRGBAContext() ? LOCAL_GL_RGBA : LOCAL_GL_RGB;
}
return LOCAL_GL_NONE;

View File

@ -1379,7 +1379,7 @@ NS_METHOD nsWindow::Move(double aX, double aY)
// region, some drivers or OSes may incorrectly copy into the clipped-out
// area.
if (mWindowType == eWindowType_plugin &&
(!mLayerManager || mLayerManager->GetBackendType() == LAYERS_D3D9) &&
(!mLayerManager || mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D9) &&
mClipRects &&
(mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(nsIntRect(0, 0, mBounds.width, mBounds.height)))) {
flags |= SWP_NOCOPYBITS;
@ -3252,7 +3252,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
#ifdef MOZ_ENABLE_D3D10_LAYER
if (mLayerManager) {
if (mLayerManager->GetBackendType() == LAYERS_D3D10)
if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D10)
{
LayerManagerD3D10 *layerManagerD3D10 =
static_cast<LayerManagerD3D10*>(mLayerManager.get());
@ -3281,7 +3281,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
if (!mLayerManager ||
(!sAllowD3D9 && aPersistence == LAYER_MANAGER_PERSISTENT &&
mLayerManager->GetBackendType() == LAYERS_BASIC &&
mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC &&
!ShouldUseOffMainThreadCompositing())) {
// If D3D9 is not currently allowed but the permanent manager is required,
// -and- we're currently using basic layers, run through this check.
@ -6372,7 +6372,7 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() ==
gfxWindowsPlatform::RENDER_DIRECT2D ||
GetLayerManager()->GetBackendType() != LAYERS_BASIC) {
GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_BASIC) {
// XXX - Workaround for Bug 587508. This will invalidate the part of the
// plugin window that might be touched by moving content somehow. The
// underlying problem should be found and fixed!
@ -6673,14 +6673,14 @@ nsWindow::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
if (!(prefs.mDisableAcceleration ||
mTransparencyMode == eTransparencyTransparent)) {
if (prefs.mPreferOpenGL) {
aHints.AppendElement(LAYERS_OPENGL);
aHints.AppendElement(LayersBackend::LAYERS_OPENGL);
}
if (!prefs.mPreferD3D9) {
aHints.AppendElement(LAYERS_D3D11);
aHints.AppendElement(LayersBackend::LAYERS_D3D11);
}
aHints.AppendElement(LAYERS_D3D9);
aHints.AppendElement(LayersBackend::LAYERS_D3D9);
}
aHints.AppendElement(LAYERS_BASIC);
aHints.AppendElement(LayersBackend::LAYERS_BASIC);
}
void
@ -7253,7 +7253,7 @@ nsWindow::ClearCachedResources()
mD2DWindowSurface = nullptr;
#endif
if (mLayerManager &&
mLayerManager->GetBackendType() == LAYERS_BASIC) {
mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) {
mLayerManager->ClearCachedResources();
}
::EnumChildWindows(mWnd, nsWindow::ClearResourcesCallback, 0);

View File

@ -153,7 +153,7 @@ public:
NS_IMETHOD GetAttention(int32_t aCycleCount);
virtual bool HasPendingInputEvent();
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);
gfxASurface *GetThebesSurface();

View File

@ -214,7 +214,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
}
ClientLayerManager *clientLayerManager =
(GetLayerManager()->GetBackendType() == LAYERS_CLIENT)
(GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT)
? static_cast<ClientLayerManager*>(GetLayerManager())
: nullptr;
@ -308,7 +308,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
#endif // WIDGET_DEBUG_OUTPUT
switch (GetLayerManager()->GetBackendType()) {
case LAYERS_BASIC:
case LayersBackend::LAYERS_BASIC:
{
nsRefPtr<gfxASurface> targetSurface;
@ -412,7 +412,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
}
// don't need to double buffer with anything but GDI
BufferMode doubleBuffering = mozilla::layers::BUFFER_NONE;
BufferMode doubleBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) {
#ifdef MOZ_XUL
switch (mTransparencyMode) {
@ -420,7 +420,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
case eTransparencyBorderlessGlass:
default:
// If we're not doing translucency, then double buffer
doubleBuffering = mozilla::layers::BUFFER_BUFFERED;
doubleBuffering = mozilla::layers::BufferMode::BUFFERED;
break;
case eTransparencyTransparent:
// If we're rendering with translucency, we're going to be
@ -431,7 +431,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
break;
}
#else
doubleBuffering = mozilla::layers::BUFFER_BUFFERED;
doubleBuffering = mozilla::layers::BufferMode::BUFFERED;
#endif
}
@ -551,7 +551,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
}
break;
#ifdef MOZ_ENABLE_D3D9_LAYER
case LAYERS_D3D9:
case LayersBackend::LAYERS_D3D9:
{
nsRefPtr<LayerManagerD3D9> layerManagerD3D9 =
static_cast<mozilla::layers::LayerManagerD3D9*>(GetLayerManager());
@ -569,7 +569,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
break;
#endif
#ifdef MOZ_ENABLE_D3D10_LAYER
case LAYERS_D3D10:
case LayersBackend::LAYERS_D3D10:
{
gfxWindowsPlatform::GetPlatform()->UpdateRenderMode();
LayerManagerD3D10 *layerManagerD3D10 = static_cast<mozilla::layers::LayerManagerD3D10*>(GetLayerManager());
@ -581,7 +581,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
}
break;
#endif
case LAYERS_CLIENT:
case LayersBackend::LAYERS_CLIENT:
result = listener->PaintWindow(this, region);
break;
default:

View File

@ -1131,7 +1131,7 @@ MetroWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
// If the backend device has changed, create a new manager (pulled from nswindow)
if (mLayerManager) {
if (mLayerManager->GetBackendType() == LAYERS_D3D10) {
if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D10) {
LayerManagerD3D10 *layerManagerD3D10 =
static_cast<LayerManagerD3D10*>(mLayerManager.get());
if (layerManagerD3D10->device() !=

View File

@ -151,10 +151,10 @@ public:
bool ShouldUseBasicManager();
bool ShouldUseAPZC();
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);
virtual void GetPreferredCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aHints) { aHints.AppendElement(mozilla::layers::LAYERS_D3D11); }
virtual void GetPreferredCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aHints) { aHints.AppendElement(mozilla::layers::LayersBackend::LAYERS_D3D11); }
// IME related interfaces
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,

View File

@ -317,7 +317,7 @@ PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
// The backend hint is a temporary placeholder until Azure, when
// all content-process layer managers will be BasicLayerManagers.
#if defined(MOZ_ENABLE_D3D10_LAYER)
if (mozilla::layers::LAYERS_D3D10 == aBackendHint) {
if (mozilla::layers::LayersBackend::LAYERS_D3D10 == aBackendHint) {
nsRefPtr<LayerManagerD3D10> m = new LayerManagerD3D10(this);
m->AsShadowForwarder()->SetShadowManager(aShadowManager);
if (m->Initialize()) {
@ -613,9 +613,9 @@ PuppetWidget::Paint()
nsAutoCString("PuppetWidget"), 0);
#endif
if (mozilla::layers::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
if (mozilla::layers::LayersBackend::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
mAttachedWidgetListener->PaintWindow(this, region);
} else if (mozilla::layers::LAYERS_CLIENT == mLayerManager->GetBackendType()) {
} else if (mozilla::layers::LayersBackend::LAYERS_CLIENT == mLayerManager->GetBackendType()) {
// Do nothing, the compositor will handle drawing
if (mTabChild) {
mTabChild->NotifyPainted();
@ -625,7 +625,7 @@ PuppetWidget::Paint()
ctx->Rectangle(gfxRect(0,0,0,0));
ctx->Clip();
AutoLayerManagerSetup setupLayerManager(this, ctx,
BUFFER_NONE);
BufferMode::BUFFER_NONE);
mAttachedWidgetListener->PaintWindow(this, region);
if (mTabChild) {
mTabChild->NotifyPainted();

View File

@ -144,7 +144,7 @@ public:
virtual LayerManager*
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);
virtual gfxASurface* GetThebesSurface();

View File

@ -202,7 +202,7 @@ void nsBaseWidget::DestroyCompositor()
nsBaseWidget::~nsBaseWidget()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == LAYERS_BASIC) {
mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) {
static_cast<BasicLayerManager*>(mLayerManager.get())->ClearRetainerWidget();
}
@ -802,7 +802,7 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
{
mLayerManager = static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
if (mLayerManager) {
NS_ASSERTION(mLayerManager->GetBackendType() == LAYERS_BASIC,
NS_ASSERTION(mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC,
"AutoLayerManagerSetup instantiated for non-basic layer backend!");
mLayerManager->SetDefaultTarget(aTarget);
mLayerManager->SetDefaultTargetConfiguration(aDoubleBuffering, aRotation);
@ -812,10 +812,10 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup()
{
if (mLayerManager) {
NS_ASSERTION(mLayerManager->GetBackendType() == LAYERS_BASIC,
NS_ASSERTION(mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC,
"AutoLayerManagerSetup instantiated for non-basic layer backend!");
mLayerManager->SetDefaultTarget(nullptr);
mLayerManager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE, ROTATION_0);
mLayerManager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE, ROTATION_0);
}
}
@ -927,21 +927,21 @@ void
nsBaseWidget::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
{
if (mUseLayersAcceleration) {
aHints.AppendElement(LAYERS_OPENGL);
aHints.AppendElement(LayersBackend::LAYERS_OPENGL);
}
aHints.AppendElement(LAYERS_BASIC);
aHints.AppendElement(LayersBackend::LAYERS_BASIC);
}
static void
CheckForBasicBackends(nsTArray<LayersBackend>& aHints)
{
for (size_t i = 0; i < aHints.Length(); ++i) {
if (aHints[i] == LAYERS_BASIC &&
if (aHints[i] == LayersBackend::LAYERS_BASIC &&
!Preferences::GetBool("layers.offmainthreadcomposition.force-basic", false) &&
!BrowserTabsRemote()) {
// basic compositor is not stable enough for regular use
aHints[i] = LAYERS_NONE;
aHints[i] = LayersBackend::LAYERS_NONE;
}
}
}

View File

@ -132,7 +132,7 @@ public:
NS_IMETHOD MakeFullScreen(bool aFullScreen);
virtual nsDeviceContext* GetDeviceContext();
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr);