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
Родитель 49fc171ad2
Коммит 61df69f208
68 изменённых файлов: 281 добавлений и 276 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -295,7 +295,7 @@ public:
/** /**
* Returns true if this LayerManager can properly support layers with * 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. * alpha if required.
*/ */
virtual bool AreComponentAlphaLayersEnabled() { return true; } virtual bool AreComponentAlphaLayersEnabled() { return true; }
@ -585,9 +585,9 @@ public:
bool IsCompositingCheap(LayersBackend aBackend) 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! // 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; } virtual bool IsCompositingCheap() { return true; }
@ -1107,10 +1107,10 @@ public:
SurfaceMode GetSurfaceMode() SurfaceMode GetSurfaceMode()
{ {
if (CanUseOpaqueSurface()) if (CanUseOpaqueSurface())
return SURFACE_OPAQUE; return SurfaceMode::SURFACE_OPAQUE;
if (mContentFlags & CONTENT_COMPONENT_ALPHA) if (mContentFlags & CONTENT_COMPONENT_ALPHA)
return SURFACE_COMPONENT_ALPHA; return SurfaceMode::SURFACE_COMPONENT_ALPHA;
return SURFACE_SINGLE_CHANNEL_ALPHA; return SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
} }
/** /**

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -51,7 +51,7 @@ private:
bool HaveTextures(SurfaceMode aMode) 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 */ /* Checks if our surface has the right content type */

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -78,7 +78,7 @@ parent:
returns (float[] intervals); returns (float[] intervals);
// layersBackendHints is an ordered list of preffered backends where // 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. // that hint is ignored.
sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id) sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id)
returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success); returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success);

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -151,10 +151,10 @@ public:
bool ShouldUseBasicManager(); bool ShouldUseBasicManager();
bool ShouldUseAPZC(); bool ShouldUseAPZC();
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr); 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 // IME related interfaces
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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