diff --git a/content/media/fmp4/MP4Reader.cpp b/content/media/fmp4/MP4Reader.cpp index 9ac386ce2abf..45b0f6fb9a25 100644 --- a/content/media/fmp4/MP4Reader.cpp +++ b/content/media/fmp4/MP4Reader.cpp @@ -81,7 +81,7 @@ private: MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder) : MediaDecoderReader(aDecoder), - mLayersBackendType(layers::LAYERS_NONE), + mLayersBackendType(layers::LayersBackend::LAYERS_NONE), mHasAudio(false), mHasVideo(false) { diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index c6fc451f30df..0bbd345a017b 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2366,7 +2366,7 @@ TabChild::NotifyPainted() // we need to notify content every change so that it can compute an invalidation // region and send that to the widget. if (UseDirectCompositor() && - (!mNotified || mTextureFactoryIdentifier.mParentBackend == LAYERS_BASIC)) { + (!mNotified || mTextureFactoryIdentifier.mParentBackend == LayersBackend::LAYERS_BASIC)) { mRemoteFrame->SendNotifyCompositorTransaction(); mNotified = true; } diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index 2ac0076c7fd8..fafb452dc347 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -210,16 +210,16 @@ struct ParamTraits template <> struct ParamTraits - : public EnumSerializer + : public TypedEnumSerializer {}; template <> struct ParamTraits - : public EnumSerializer + : public TypedEnumSerializer {}; template <> diff --git a/gfx/layers/Compositor.cpp b/gfx/layers/Compositor.cpp index 88ff365cd4a5..0b6e6e0e674d 100644 --- a/gfx/layers/Compositor.cpp +++ b/gfx/layers/Compositor.cpp @@ -17,7 +17,7 @@ class Matrix4x4; namespace layers { -/* static */ LayersBackend Compositor::sBackend = LAYERS_NONE; +/* static */ LayersBackend Compositor::sBackend = LayersBackend::LAYERS_NONE; /* static */ LayersBackend Compositor::GetBackend() { diff --git a/gfx/layers/CompositorTypes.h b/gfx/layers/CompositorTypes.h index aa6632010db4..2850a88a37e3 100644 --- a/gfx/layers/CompositorTypes.h +++ b/gfx/layers/CompositorTypes.h @@ -206,7 +206,7 @@ struct TextureFactoryIdentifier bool mSupportsTextureBlitting; bool mSupportsPartialUploads; - TextureFactoryIdentifier(LayersBackend aLayersBackend = LAYERS_NONE, + TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE, GeckoProcessType aParentProcessId = GeckoProcessType_Default, int32_t aMaxTextureSize = 0, bool aSupportsTextureBlitting = false, diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index c5105f88f0cb..24925bf0998a 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -201,9 +201,9 @@ public: } ImageBackendData* GetBackendData(LayersBackend aBackend) - { return mBackendData[aBackend]; } + { return mBackendData[size_t(aBackend)]; } void SetBackendData(LayersBackend aBackend, ImageBackendData* aData) - { mBackendData[aBackend] = aData; } + { mBackendData[size_t(aBackend)] = aData; } int32_t GetSerial() { return mSerial; } @@ -220,7 +220,7 @@ protected: mSent(false) {} - nsAutoPtr mBackendData[mozilla::layers::LAYERS_LAST]; + nsAutoPtr mBackendData[size_t(mozilla::layers::LayersBackend::LAYERS_LAST)]; void* mImplData; int32_t mSerial; diff --git a/gfx/layers/ImageLayers.cpp b/gfx/layers/ImageLayers.cpp index 3d3c87f66f60..08b3788c01c9 100644 --- a/gfx/layers/ImageLayers.cpp +++ b/gfx/layers/ImageLayers.cpp @@ -16,7 +16,7 @@ namespace layers { ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData) : Layer(aManager, aImplData), mFilter(GraphicsFilter::FILTER_GOOD) -, mScaleMode(SCALE_NONE), mDisallowBigImage(false) +, mScaleMode(ScaleMode::SCALE_NONE), mDisallowBigImage(false) {} ImageLayer::~ImageLayer() @@ -35,9 +35,9 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurfa gfxRect sourceRect(0, 0, 0, 0); if (mContainer) { sourceRect.SizeTo(gfx::ThebesIntSize(mContainer->GetCurrentSize())); - if (mScaleMode != SCALE_NONE && + if (mScaleMode != ScaleMode::SCALE_NONE && sourceRect.width != 0.0 && sourceRect.height != 0.0) { - NS_ASSERTION(mScaleMode == SCALE_STRETCH, + NS_ASSERTION(mScaleMode == ScaleMode::STRETCH, "No other scalemodes than stretch and none supported yet."); local.Scale(mScaleToSize.width / sourceRect.width, mScaleToSize.height / sourceRect.height, 1.0); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 10b8bbc9b618..9a917018c3eb 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -295,7 +295,7 @@ public: /** * Returns true if this LayerManager can properly support layers with - * SURFACE_COMPONENT_ALPHA. This can include disabling component + * SurfaceMode::SURFACE_COMPONENT_ALPHA. This can include disabling component * alpha if required. */ virtual bool AreComponentAlphaLayersEnabled() { return true; } @@ -585,9 +585,9 @@ public: bool IsCompositingCheap(LayersBackend aBackend) { - // LAYERS_NONE is an error state, but in that case we should try to + // LayersBackend::LAYERS_NONE is an error state, but in that case we should try to // avoid loading the compositor! - return LAYERS_BASIC != aBackend && LAYERS_NONE != aBackend; + return LayersBackend::LAYERS_BASIC != aBackend && LayersBackend::LAYERS_NONE != aBackend; } virtual bool IsCompositingCheap() { return true; } @@ -1107,10 +1107,10 @@ public: SurfaceMode GetSurfaceMode() { if (CanUseOpaqueSurface()) - return SURFACE_OPAQUE; + return SurfaceMode::SURFACE_OPAQUE; if (mContentFlags & CONTENT_COMPONENT_ALPHA) - return SURFACE_COMPONENT_ALPHA; - return SURFACE_SINGLE_CHANNEL_ALPHA; + return SurfaceMode::SURFACE_COMPONENT_ALPHA; + return SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } /** diff --git a/gfx/layers/LayersTypes.h b/gfx/layers/LayersTypes.h index ac3e08c70d69..66367bc87989 100644 --- a/gfx/layers/LayersTypes.h +++ b/gfx/layers/LayersTypes.h @@ -10,6 +10,8 @@ #include "nsPoint.h" // for nsIntPoint #include "nsRegion.h" +#include "mozilla/TypedEnum.h" + #ifdef MOZ_WIDGET_GONK #include #endif @@ -39,7 +41,10 @@ namespace layers { typedef uint32_t TextureFlags; -enum LayersBackend { +#undef NONE +#undef OPAQUE + +MOZ_BEGIN_ENUM_CLASS(LayersBackend, int8_t) LAYERS_NONE = 0, LAYERS_BASIC, LAYERS_OPENGL, @@ -48,25 +53,25 @@ enum LayersBackend { LAYERS_D3D11, LAYERS_CLIENT, LAYERS_LAST -}; +MOZ_END_ENUM_CLASS(LayersBackend) -enum BufferMode { +MOZ_BEGIN_ENUM_CLASS(BufferMode, int8_t) BUFFER_NONE, - BUFFER_BUFFERED -}; + BUFFERED +MOZ_END_ENUM_CLASS(BufferMode) -enum DrawRegionClip { - CLIP_DRAW, - CLIP_DRAW_SNAPPED, - CLIP_NONE, -}; +MOZ_BEGIN_ENUM_CLASS(DrawRegionClip, int8_t) + DRAW, + DRAW_SNAPPED, + CLIP_NONE +MOZ_END_ENUM_CLASS(DrawRegionClip) -enum SurfaceMode { +MOZ_BEGIN_ENUM_CLASS(SurfaceMode, int8_t) SURFACE_NONE = 0, SURFACE_OPAQUE, SURFACE_SINGLE_CHANNEL_ALPHA, SURFACE_COMPONENT_ALPHA -}; +MOZ_END_ENUM_CLASS(SurfaceMode) // LayerRenderState for Composer2D // We currently only support Composer2D using gralloc. If we want to be backed @@ -127,12 +132,12 @@ struct LayerRenderState { bool mHasOwnOffset; }; -enum ScaleMode { +MOZ_BEGIN_ENUM_CLASS(ScaleMode, int8_t) SCALE_NONE, - SCALE_STRETCH, - SCALE_SENTINEL -// Unimplemented - SCALE_PRESERVE_ASPECT_RATIO_CONTAIN -}; + STRETCH, + SENTINEL +// Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN +MOZ_END_ENUM_CLASS(ScaleMode) struct EventRegions { nsIntRegion mHitRegion; diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index 07d6b455cf68..e211c419a614 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -443,9 +443,9 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, destBufferRect = ComputeBufferRect(neededRegion.GetBounds()); } - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { #if defined(MOZ_GFX_OPTIMIZE_MOBILE) || defined(MOZ_WIDGET_GONK) - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; #else if (!aLayer->GetParent() || !aLayer->GetParent()->SupportsComponentAlphaChildren() || @@ -453,7 +453,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, !aLayer->AsShadowableLayer() || !aLayer->AsShadowableLayer()->HasShadow() || !gfxPlatform::ComponentAlphaEnabled()) { - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } else { contentType = gfxContentType::COLOR; } @@ -464,9 +464,9 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, (!neededRegion.GetBounds().IsEqualInterior(destBufferRect) || neededRegion.GetNumRects() > 1)) { // The area we add to neededRegion might not be painted opaquely - if (mode == SURFACE_OPAQUE) { + if (mode == SurfaceMode::SURFACE_OPAQUE) { contentType = gfxContentType::COLOR_ALPHA; - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } // We need to validate the entire buffer, to make sure that only valid @@ -478,7 +478,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, // have transitioned into/out of component alpha, then we need to recreate it. if (HaveBuffer() && (contentType != BufferContentType() || - (mode == SURFACE_COMPONENT_ALPHA) != HaveBufferOnWhite())) { + (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) != HaveBufferOnWhite())) { // We're effectively clearing the valid region, so we need to draw // the entire needed region now. @@ -510,7 +510,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, RefPtr destDTBuffer; RefPtr destDTBufferOnWhite; uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0; - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { bufferFlags |= BUFFER_COMPONENT_ALPHA; } if (canReuseBuffer) { @@ -542,7 +542,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, MOZ_ASSERT(mDTBuffer); mDTBuffer->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height), IntPoint(dest.x, dest.y)); - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { if (!EnsureBufferOnWhite()) { return result; } @@ -571,7 +571,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, newRotation.x * bytesPerPixel, newRotation.y); mDTBuffer->ReleaseBits(data); - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { if (!EnsureBufferOnWhite()) { return result; } @@ -630,7 +630,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, bool isClear = !HaveBuffer(); if (destDTBuffer) { - if (!isClear && (mode != SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) { + if (!isClear && (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) { // Copy the bits nsIntPoint offset = -destBufferRect.TopLeft(); Matrix mat; @@ -643,7 +643,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, DrawBufferWithRotation(destDTBuffer, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE); destDTBuffer->SetTransform(Matrix()); - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { NS_ASSERTION(destDTBufferOnWhite, "Must have a white buffer!"); destDTBufferOnWhite->SetTransform(mat); if (!EnsureBufferOnWhite()) { @@ -666,7 +666,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, nsIntRegion invalidate; invalidate.Sub(aLayer->GetValidRegion(), destBufferRect); result.mRegionToInvalidate.Or(result.mRegionToInvalidate, invalidate); - result.mClip = CLIP_DRAW_SNAPPED; + result.mClip = DrawRegionClip::DRAW_SNAPPED; result.mMode = mode; return result; @@ -676,7 +676,7 @@ DrawTarget* RotatedContentBuffer::BorrowDrawTargetForPainting(ThebesLayer* aLayer, const PaintState& aPaintState) { - if (!aPaintState.mMode) { + if (aPaintState.mMode == SurfaceMode::SURFACE_NONE) { return nullptr; } @@ -688,7 +688,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(ThebesLayer* aLayer, canUseOpaqueSurface ? gfxContentType::COLOR : gfxContentType::COLOR_ALPHA; - if (aPaintState.mMode == SURFACE_COMPONENT_ALPHA) { + if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { MOZ_ASSERT(mDTBuffer && mDTBufferOnWhite); nsIntRegionRectIterator iter(aPaintState.mRegionToDraw); const nsIntRect *iterRect; diff --git a/gfx/layers/RotatedBuffer.h b/gfx/layers/RotatedBuffer.h index 5f8fdc565609..32b518a6fce7 100644 --- a/gfx/layers/RotatedBuffer.h +++ b/gfx/layers/RotatedBuffer.h @@ -214,7 +214,7 @@ public: */ struct PaintState { PaintState() - : mMode(SURFACE_NONE) + : mMode(SurfaceMode::SURFACE_NONE) , mDidSelfCopy(false) {} diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index c46da3be632f..1962ddfb9cfc 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -227,7 +227,7 @@ BasicCompositor::BasicCompositor(nsIWidget *aWidget) : mWidget(aWidget) { MOZ_COUNT_CTOR(BasicCompositor); - sBackend = LAYERS_BASIC; + sBackend = LayersBackend::LAYERS_BASIC; } BasicCompositor::~BasicCompositor() diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h index b38dfe4e8d17..8e807f235201 100644 --- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -51,7 +51,7 @@ public: virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE { - return TextureFactoryIdentifier(LAYERS_BASIC, + return TextureFactoryIdentifier(LayersBackend::LAYERS_BASIC, XRE_GetProcessType(), GetMaxTextureSize()); } diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index bb19ea24f3b5..47a36d52958e 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -238,7 +238,7 @@ public: BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) : mPhase(PHASE_NONE), mWidget(aWidget) - , mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false) + , mDoubleBuffering(BufferMode::BUFFER_NONE), mUsingDefaultTarget(false) , mCachedSurfaceInUse(false) , mTransactionIncomplete(false) , mCompositorMightResample(false) @@ -250,7 +250,7 @@ BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) : BasicLayerManager::BasicLayerManager() : mPhase(PHASE_NONE), mWidget(nullptr) - , mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false) + , mDoubleBuffering(BufferMode::BUFFER_NONE), mUsingDefaultTarget(false) , mCachedSurfaceInUse(false) , mTransactionIncomplete(false) { @@ -620,7 +620,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, if (IsRetained()) { nsIntRegion region; MarkLayersHidden(mRoot, clipRect, clipRect, region, ALLOW_OPAQUE); - if (mUsingDefaultTarget && mDoubleBuffering != BUFFER_NONE) { + if (mUsingDefaultTarget && mDoubleBuffering != BufferMode::BUFFER_NONE) { ApplyDoubleBuffering(mRoot, clipRect); } } diff --git a/gfx/layers/basic/BasicLayers.h b/gfx/layers/basic/BasicLayers.h index 7b4bcfd2c9da..b52ea4367b73 100644 --- a/gfx/layers/basic/BasicLayers.h +++ b/gfx/layers/basic/BasicLayers.h @@ -111,7 +111,7 @@ public: virtual already_AddRefed CreateReadbackLayer(); virtual ImageFactory *GetImageFactory(); - virtual LayersBackend GetBackendType() { return LAYERS_BASIC; } + virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; } virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Basic"); } #ifdef DEBUG diff --git a/gfx/layers/basic/BasicThebesLayer.cpp b/gfx/layers/basic/BasicThebesLayer.cpp index 2d694744a545..ce81e67312ad 100644 --- a/gfx/layers/basic/BasicThebesLayer.cpp +++ b/gfx/layers/basic/BasicThebesLayer.cpp @@ -99,7 +99,7 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext, groupContext = aContext; } SetAntialiasingFlags(this, groupContext); - aCallback(this, groupContext, toDraw, CLIP_NONE, nsIntRegion(), aCallbackData); + aCallback(this, groupContext, toDraw, DrawRegionClip::CLIP_NONE, nsIntRegion(), aCallbackData); if (needsGroup) { BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext); if (needsClipToVisibleRegion) { diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index dfe5466954f2..127f4c2a45f5 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -37,7 +37,7 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType, TextureFlags aFlags) { if (aType == CanvasClientGLContext && - aForwarder->GetCompositorBackendType() == LAYERS_OPENGL) { + aForwarder->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) { aFlags |= TEXTURE_DEALLOCATE_CLIENT; return new CanvasClientSurfaceStream(aForwarder, aFlags); } @@ -238,7 +238,7 @@ DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLaye { if (!mDeprecatedTextureClient) { mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL, - aLayer->GetSurfaceMode() == SURFACE_OPAQUE + aLayer->GetSurfaceMode() == SurfaceMode::SURFACE_OPAQUE ? gfxContentType::COLOR : gfxContentType::COLOR_ALPHA); MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client"); diff --git a/gfx/layers/client/ClientCanvasLayer.cpp b/gfx/layers/client/ClientCanvasLayer.cpp index f3d3d8b244f2..1955030b362c 100644 --- a/gfx/layers/client/ClientCanvasLayer.cpp +++ b/gfx/layers/client/ClientCanvasLayer.cpp @@ -46,7 +46,7 @@ ClientCanvasLayer::Initialize(const Data& aData) screen->PreserveBuffer()); SurfaceFactory_GL* factory = nullptr; if (!mForceReadback) { - if (ClientManager()->AsShadowForwarder()->GetCompositorBackendType() == mozilla::layers::LAYERS_OPENGL) { + if (ClientManager()->AsShadowForwarder()->GetCompositorBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) { if (mGLContext->GetContextType() == GLContextType::EGL) { bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default); diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 9f0f20148102..e60a8b679858 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -451,11 +451,11 @@ void ClientLayerManager::GetBackendName(nsAString& aName) { switch (mForwarder->GetCompositorBackendType()) { - case LAYERS_BASIC: aName.AssignLiteral("Basic"); return; - case LAYERS_OPENGL: aName.AssignLiteral("OpenGL"); return; - case LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return; - case LAYERS_D3D10: aName.AssignLiteral("Direct3D 10"); return; - case LAYERS_D3D11: aName.AssignLiteral("Direct3D 11"); return; + case LayersBackend::LAYERS_BASIC: aName.AssignLiteral("Basic"); return; + case LayersBackend::LAYERS_OPENGL: aName.AssignLiteral("OpenGL"); return; + case LayersBackend::LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return; + case LayersBackend::LAYERS_D3D10: aName.AssignLiteral("Direct3D 10"); return; + case LayersBackend::LAYERS_D3D11: aName.AssignLiteral("Direct3D 11"); return; default: NS_RUNTIMEABORT("Invalid backend"); } } diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 1a6e8b3404fe..5848ba1962d4 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -57,7 +57,7 @@ public: void* aCallbackData, EndTransactionFlags aFlags = END_DEFAULT); - virtual LayersBackend GetBackendType() { return LAYERS_CLIENT; } + virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_CLIENT; } virtual void GetBackendName(nsAString& name); virtual const char* Name() const { return "Client"; } diff --git a/gfx/layers/client/ClientThebesLayer.cpp b/gfx/layers/client/ClientThebesLayer.cpp index 83120206491a..d2dc64de9c29 100644 --- a/gfx/layers/client/ClientThebesLayer.cpp +++ b/gfx/layers/client/ClientThebesLayer.cpp @@ -171,7 +171,7 @@ ClientLayerManager::CreateThebesLayerWithHint(ThebesLayerCreationHint aHint) #ifdef MOZ_B2G aHint == SCROLLABLE && #endif - gfxPlatform::GetPrefLayersEnableTiles() && AsShadowForwarder()->GetCompositorBackendType() == LAYERS_OPENGL) { + gfxPlatform::GetPrefLayersEnableTiles() && AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) { nsRefPtr layer = new ClientTiledThebesLayer(this); CREATE_SHADOW(Thebes); diff --git a/gfx/layers/client/CompositableClient.cpp b/gfx/layers/client/CompositableClient.cpp index dd802b0950d3..04ad2ee6d03b 100644 --- a/gfx/layers/client/CompositableClient.cpp +++ b/gfx/layers/client/CompositableClient.cpp @@ -102,35 +102,35 @@ CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aD switch (aDeprecatedTextureClientType) { case TEXTURE_SHARED_GL: - if (parentBackend == LAYERS_OPENGL) { + if (parentBackend == LayersBackend::LAYERS_OPENGL) { result = new DeprecatedTextureClientSharedOGL(GetForwarder(), GetTextureInfo()); } break; case TEXTURE_SHARED_GL_EXTERNAL: - if (parentBackend == LAYERS_OPENGL) { + if (parentBackend == LayersBackend::LAYERS_OPENGL) { result = new DeprecatedTextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo()); } break; case TEXTURE_STREAM_GL: - if (parentBackend == LAYERS_OPENGL) { + if (parentBackend == LayersBackend::LAYERS_OPENGL) { result = new DeprecatedTextureClientStreamOGL(GetForwarder(), GetTextureInfo()); } break; case TEXTURE_YCBCR: - if (parentBackend == LAYERS_OPENGL || - parentBackend == LAYERS_D3D9 || - parentBackend == LAYERS_D3D11 || - parentBackend == LAYERS_BASIC) { + if (parentBackend == LayersBackend::LAYERS_OPENGL || + parentBackend == LayersBackend::LAYERS_D3D9 || + parentBackend == LayersBackend::LAYERS_D3D11 || + parentBackend == LayersBackend::LAYERS_BASIC) { result = new DeprecatedTextureClientShmemYCbCr(GetForwarder(), GetTextureInfo()); } break; case TEXTURE_CONTENT: #ifdef XP_WIN - if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) { + if (parentBackend == LayersBackend::LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) { result = new DeprecatedTextureClientD3D11(GetForwarder(), GetTextureInfo()); break; } - if (parentBackend == LAYERS_D3D9 && + if (parentBackend == LayersBackend::LAYERS_D3D9 && !GetForwarder()->ForwardsToDifferentProcess()) { // We can't use a d3d9 texture for an RGBA surface because we cannot get a DC for // for a gfxWindowsSurface. @@ -153,8 +153,8 @@ CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aD break; case TEXTURE_FALLBACK: #ifdef XP_WIN - if (parentBackend == LAYERS_D3D11 || - parentBackend == LAYERS_D3D9) { + if (parentBackend == LayersBackend::LAYERS_D3D11 || + parentBackend == LayersBackend::LAYERS_D3D9) { result = new DeprecatedTextureClientShmem(GetForwarder(), GetTextureInfo()); } #endif @@ -207,11 +207,11 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat, #ifdef XP_WIN LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType(); - if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() && + if (parentBackend == LayersBackend::LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() && !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) { result = new TextureClientD3D11(aFormat, aTextureFlags); } - if (parentBackend == LAYERS_D3D9 && + if (parentBackend == LayersBackend::LAYERS_D3D9 && !GetForwarder()->ForwardsToDifferentProcess() && !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) { // non-DIB textures don't work with alpha, see notes in TextureD3D9. diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 2233891a8dac..e09bbce9d9ab 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -41,10 +41,10 @@ namespace layers { ContentClient::CreateContentClient(CompositableForwarder* aForwarder) { LayersBackend backend = aForwarder->GetCompositorBackendType(); - if (backend != LAYERS_OPENGL && - backend != LAYERS_D3D9 && - backend != LAYERS_D3D11 && - backend != LAYERS_BASIC) { + if (backend != LayersBackend::LAYERS_OPENGL && + backend != LayersBackend::LAYERS_D3D9 && + backend != LayersBackend::LAYERS_D3D11 && + backend != LayersBackend::LAYERS_BASIC) { return nullptr; } @@ -58,13 +58,13 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder) #endif #ifdef XP_WIN - if (backend == LAYERS_D3D11) { + if (backend == LayersBackend::LAYERS_D3D11) { useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD2DDevice(); } else #endif { useDoubleBuffering = LayerManagerComposite::SupportsDirectTexturing() || - backend == LAYERS_BASIC; + backend == LayersBackend::LAYERS_BASIC; } if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) { @@ -75,7 +75,7 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder) } } #ifdef XP_MACOSX - if (backend == LAYERS_OPENGL) { + if (backend == LayersBackend::LAYERS_OPENGL) { return new ContentClientIncremental(aForwarder); } #endif @@ -1078,11 +1078,11 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, destBufferRect = neededRegion.GetBounds(); } - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { if (!gfxPlatform::ComponentAlphaEnabled() || !aLayer->GetParent() || !aLayer->GetParent()->SupportsComponentAlphaChildren()) { - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } else { contentType = gfxContentType::COLOR; } @@ -1092,9 +1092,9 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, (!neededRegion.GetBounds().IsEqualInterior(destBufferRect) || neededRegion.GetNumRects() > 1)) { // The area we add to neededRegion might not be painted opaquely - if (mode == SURFACE_OPAQUE) { + if (mode == SurfaceMode::SURFACE_OPAQUE) { contentType = gfxContentType::COLOR_ALPHA; - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } // For component alpha layers, we leave contentType as gfxContentType::COLOR. @@ -1105,7 +1105,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, if (mHasBuffer && (mContentType != contentType || - (mode == SURFACE_COMPONENT_ALPHA) != mHasBufferOnWhite)) { + (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) != mHasBufferOnWhite)) { // We're effectively clearing the valid region, so we need to draw // the entire needed region now. result.mRegionToInvalidate = aLayer->GetValidRegion(); @@ -1148,7 +1148,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, bool createdBuffer = false; uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0; - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { bufferFlags |= TEXTURE_COMPONENT_ALPHA; } if (canReuseBuffer) { @@ -1201,12 +1201,12 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, if (createdBuffer) { if (mHasBuffer && - (mode != SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) { + (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) { mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS; } mHasBuffer = true; - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { mHasBufferOnWhite = true; } mBufferRect = destBufferRect; @@ -1228,7 +1228,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, // although they never cover it. This leads to two draw rects, the narow strip and the actually // newly exposed area. It would be wise to fix this glitch in any way to have simpler // clip and draw regions. - result.mClip = CLIP_DRAW; + result.mClip = DrawRegionClip::DRAW; result.mMode = mode; return result; @@ -1238,7 +1238,7 @@ DrawTarget* ContentClientIncremental::BorrowDrawTargetForPainting(ThebesLayer* aLayer, const PaintState& aPaintState) { - if (!aPaintState.mMode) { + if (aPaintState.mMode == SurfaceMode::SURFACE_NONE) { return nullptr; } @@ -1249,7 +1249,7 @@ ContentClientIncremental::BorrowDrawTargetForPainting(ThebesLayer* aLayer, // BeginUpdate is allowed to modify the given region, // if it wants more to be repainted than we request. - if (aPaintState.mMode == SURFACE_COMPONENT_ALPHA) { + if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { nsIntRegion drawRegionCopy = aPaintState.mRegionToDraw; nsRefPtr onBlack = GetUpdateSurface(BUFFER_BLACK, drawRegionCopy); nsRefPtr onWhite = GetUpdateSurface(BUFFER_WHITE, aPaintState.mRegionToDraw); diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index d77ece563ac5..131c293d740f 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -404,7 +404,7 @@ BasicTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion, #endif PROFILER_LABEL("BasicTiledLayerBuffer", "PaintThebesSingleBufferDraw"); - mCallback(mThebesLayer, ctxt, aPaintRegion, CLIP_NONE, nsIntRegion(), mCallbackData); + mCallback(mThebesLayer, ctxt, aPaintRegion, DrawRegionClip::CLIP_NONE, nsIntRegion(), mCallbackData); } #ifdef GFX_TILEDLAYER_PREF_WARNINGS @@ -513,7 +513,7 @@ BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile, mCallback(mThebesLayer, ctxt, nsIntRegion(nsIntRect(a, nsIntSize(GetScaledTileLength(), GetScaledTileLength()))), - CLIP_NONE, + DrawRegionClip::CLIP_NONE, nsIntRegion(), mCallbackData); } diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index 6475948cd828..bd126d6f33f9 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -119,9 +119,9 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS mImageHost->GetAsTextureHost() ? mImageHost->GetAsTextureHost()->GetSize() : mImageHost->GetDeprecatedTextureHost()->GetSize(); sourceRect.SizeTo(size.width, size.height); - if (mScaleMode != SCALE_NONE && + if (mScaleMode != ScaleMode::SCALE_NONE && sourceRect.width != 0.0 && sourceRect.height != 0.0) { - NS_ASSERTION(mScaleMode == SCALE_STRETCH, + NS_ASSERTION(mScaleMode == ScaleMode::STRETCH, "No other scalemodes than stretch and none supported yet."); local.Scale(mScaleToSize.width / sourceRect.width, mScaleToSize.height / sourceRect.height, 1.0); diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 8fc68babbc4a..070f7b990913 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -152,7 +152,7 @@ LayerManagerComposite::BeginTransaction() mIsCompositorReady = true; - if (Compositor::GetBackend() == LAYERS_BASIC) { + if (Compositor::GetBackend() == LayersBackend::LAYERS_BASIC) { mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot()); } } diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 5cec17560edc..88a16340f7c4 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -111,7 +111,7 @@ DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescri CompositableHost* aCompositableHost) { switch (Compositor::GetBackend()) { - case LAYERS_OPENGL: + case LayersBackend::LAYERS_OPENGL: { RefPtr result; result = CreateDeprecatedTextureHostOGL(aDescriptorType, @@ -123,16 +123,16 @@ DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescri return result; } #ifdef XP_WIN - case LAYERS_D3D9: + case LayersBackend::LAYERS_D3D9: return CreateDeprecatedTextureHostD3D9(aDescriptorType, aDeprecatedTextureHostFlags, aTextureFlags); - case LAYERS_D3D11: + case LayersBackend::LAYERS_D3D11: return CreateDeprecatedTextureHostD3D11(aDescriptorType, aDeprecatedTextureHostFlags, aTextureFlags); #endif - case LAYERS_BASIC: + case LayersBackend::LAYERS_BASIC: return CreateBasicDeprecatedTextureHost(aDescriptorType, aDeprecatedTextureHostFlags, aTextureFlags); @@ -168,21 +168,21 @@ TextureHost::Create(const SurfaceDescriptor& aDesc, TextureFlags aFlags) { switch (Compositor::GetBackend()) { - case LAYERS_OPENGL: + case LayersBackend::LAYERS_OPENGL: return CreateTextureHostOGL(aDesc, aDeallocator, aFlags); - case LAYERS_BASIC: + case LayersBackend::LAYERS_BASIC: return CreateTextureHostBasic(aDesc, aDeallocator, aFlags); #ifdef MOZ_WIDGET_GONK - case LAYERS_NONE: + case LayersBackend::LAYERS_NONE: // Power on video reqests to allocate TextureHost, // when Compositor is still not present. This is a very hacky workaround. // See Bug 944420. return CreateTextureHostOGL(aDesc, aDeallocator, aFlags); #endif #ifdef XP_WIN - case LAYERS_D3D11: + case LayersBackend::LAYERS_D3D11: return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags); - case LAYERS_D3D9: + case LayersBackend::LAYERS_D3D9: return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags); #endif default: diff --git a/gfx/layers/d3d10/ImageLayerD3D10.cpp b/gfx/layers/d3d10/ImageLayerD3D10.cpp index 989cdfb26509..9968065611f5 100644 --- a/gfx/layers/d3d10/ImageLayerD3D10.cpp +++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp @@ -105,13 +105,13 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex RemoteBitmapImage *remoteImage = static_cast(aImage); - if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) { + if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) { nsAutoPtr dat(new TextureD3D10BackendData()); dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize); if (dat->mTexture) { device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView)); - aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget()); } } @@ -132,19 +132,19 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex return nullptr; } - if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) { + if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) { nsAutoPtr dat(new TextureD3D10BackendData()); dat->mTexture = SurfaceToTexture(device(), surf, cairoImage->GetSize()); if (dat->mTexture) { device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView)); - aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget()); } } aHasAlpha = surf->GetContentType() == gfxContentType::COLOR_ALPHA; } else if (aImage->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE) { - if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) { + if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) { // Use resource sharing to open the D3D9 texture as a D3D10 texture, HRESULT hr; D3D9SurfaceImage* d3dImage = reinterpret_cast(aImage); @@ -160,7 +160,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex hr = device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView)); NS_ENSURE_TRUE(SUCCEEDED(hr) && dat->mSRView, nullptr); - aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget()); } aHasAlpha = false; } else { @@ -169,7 +169,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex } TextureD3D10BackendData *data = - static_cast(aImage->GetBackendData(mozilla::layers::LAYERS_D3D10)); + static_cast(aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)); if (!data) { return nullptr; @@ -255,12 +255,12 @@ ImageLayerD3D10::RenderLayer() return; } - if (!yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D10)) { + if (!yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) { AllocateTexturesYCbCr(yuvImage); } PlanarYCbCrD3D10BackendData *data = - static_cast(yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D10)); + static_cast(yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)); if (!data) { return; @@ -394,7 +394,7 @@ void ImageLayerD3D10::AllocateTexturesYCbCr(PlanarYCbCrImage *aImage) device()->CreateShaderResourceView(backendData->mCbTexture, nullptr, getter_AddRefs(backendData->mCbView)); device()->CreateShaderResourceView(backendData->mCrTexture, nullptr, getter_AddRefs(backendData->mCrView)); - aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, backendData.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, backendData.forget()); } already_AddRefed @@ -497,9 +497,9 @@ RemoteDXGITextureImage::DeprecatedGetAsSurface() TextureD3D10BackendData* RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice) { - if (GetBackendData(mozilla::layers::LAYERS_D3D10)) { + if (GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) { TextureD3D10BackendData *data = - static_cast(GetBackendData(mozilla::layers::LAYERS_D3D10)); + static_cast(GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)); nsRefPtr device; data->mTexture->GetDevice(getter_AddRefs(device)); @@ -522,7 +522,7 @@ RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice) aDevice->CreateShaderResourceView(texture, nullptr, getter_AddRefs(data->mSRView)); - SetBackendData(mozilla::layers::LAYERS_D3D10, data); + SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, data); return data.forget(); } diff --git a/gfx/layers/d3d10/LayerManagerD3D10.h b/gfx/layers/d3d10/LayerManagerD3D10.h index fcc0fe38c290..295ef9a6ecc0 100644 --- a/gfx/layers/d3d10/LayerManagerD3D10.h +++ b/gfx/layers/d3d10/LayerManagerD3D10.h @@ -120,7 +120,7 @@ public: CreateDrawTarget(const gfx::IntSize &aSize, mozilla::gfx::SurfaceFormat aFormat); - virtual LayersBackend GetBackendType() { return LAYERS_D3D10; } + virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_D3D10; } virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 10"); } virtual const char* Name() const { return "D3D10"; } diff --git a/gfx/layers/d3d10/ThebesLayerD3D10.cpp b/gfx/layers/d3d10/ThebesLayerD3D10.cpp index af45289ad9fc..19718138a4e6 100644 --- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp +++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp @@ -34,7 +34,7 @@ namespace layers { ThebesLayerD3D10::ThebesLayerD3D10(LayerManagerD3D10 *aManager) : ThebesLayer(aManager, nullptr) , LayerD3D10(aManager) - , mCurrentSurfaceMode(SURFACE_OPAQUE) + , mCurrentSurfaceMode(SurfaceMode::SURFACE_OPAQUE) { mImplData = static_cast(this); } @@ -94,13 +94,13 @@ ThebesLayerD3D10::RenderLayer() ID3D10EffectTechnique *technique; switch (mCurrentSurfaceMode) { - case SURFACE_COMPONENT_ALPHA: + case SurfaceMode::SURFACE_COMPONENT_ALPHA: technique = SelectShader(SHADER_COMPONENT_ALPHA | LoadMaskTexture()); break; - case SURFACE_OPAQUE: + case SurfaceMode::SURFACE_OPAQUE: technique = SelectShader(SHADER_RGB | SHADER_PREMUL | LoadMaskTexture()); break; - case SURFACE_SINGLE_CHANNEL_ALPHA: + case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA: technique = SelectShader(SHADER_RGBA | SHADER_PREMUL | LoadMaskTexture()); break; default: @@ -154,9 +154,9 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback) nsIntRect newTextureRect = mVisibleRegion.GetBounds(); SurfaceMode mode = GetSurfaceMode(); - if (mode == SURFACE_COMPONENT_ALPHA && + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA && (!mParent || !mParent->SupportsComponentAlphaChildren())) { - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } // If we have a transform that requires resampling of our texture, then // we need to make sure we don't sample pixels that haven't been drawn. @@ -168,11 +168,11 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback) neededRegion.GetNumRects() > 1) { if (MayResample()) { neededRegion = newTextureRect; - if (mode == SURFACE_OPAQUE) { + if (mode == SurfaceMode::SURFACE_OPAQUE) { // We're going to paint outside the visible region, but layout hasn't // promised that it will paint opaquely there, so we'll have to // treat this layer as transparent. - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } } } @@ -226,7 +226,7 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback) } mTextureRect = newTextureRect; - if (!mTexture || (mode == SURFACE_COMPONENT_ALPHA && !mTextureOnWhite)) { + if (!mTexture || (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA && !mTextureOnWhite)) { CreateNewTextures(gfx::IntSize(newTextureRect.width, newTextureRect.height), mode); mValidRegion.SetEmpty(); } @@ -286,7 +286,7 @@ void ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode) { if (mD2DSurface) { - gfxContentType type = aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? + gfxContentType type = aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? gfxContentType::COLOR : gfxContentType::COLOR_ALPHA; if (type != mD2DSurface->GetContentType()) { @@ -301,7 +301,7 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode) mValidRegion.SetEmpty(); } } else if (mDrawTarget) { - SurfaceFormat format = aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? + SurfaceFormat format = aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8; if (format != mDrawTarget->GetFormat()) { @@ -316,7 +316,7 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode) } } - if (aMode != SURFACE_COMPONENT_ALPHA && mTextureOnWhite) { + if (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA && mTextureOnWhite) { // If we've transitioned away from component alpha, we can delete those resources. mD2DSurfaceOnWhite = nullptr; mSRViewOnWhite = nullptr; @@ -400,7 +400,7 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode) nsRefPtr destinationSurface; - if (aMode == SURFACE_COMPONENT_ALPHA) { + if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { FillTexturesBlackWhite(aRegion, visibleRect.TopLeft()); if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) { gfxASurface* surfaces[2] = { mD2DSurface.get(), mD2DSurfaceOnWhite.get() }; @@ -418,7 +418,7 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode) nsRefPtr context = new gfxContext(mDrawTarget); context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y)); - if (aMode == SURFACE_SINGLE_CHANNEL_ALPHA) { + if (aMode == SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA) { nsIntRegionRectIterator iter(aRegion); const nsIntRect *iterRect; while ((iterRect = iter.Next())) { @@ -429,7 +429,7 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode) mDrawTarget->SetPermitSubpixelAA(!(mContentFlags & CONTENT_COMPONENT_ALPHA)); LayerManagerD3D10::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo(); - cbInfo.Callback(this, context, aRegion, CLIP_DRAW, nsIntRegion(), cbInfo.CallbackData); + cbInfo.Callback(this, context, aRegion, DrawRegionClip::DRAW, nsIntRegion(), cbInfo.CallbackData); } void @@ -460,7 +460,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode } if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) { - mD2DSurface = new gfxD2DSurface(mTexture, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? + mD2DSurface = new gfxD2DSurface(mTexture, aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? gfxContentType::COLOR : gfxContentType::COLOR_ALPHA); if (!mD2DSurface || mD2DSurface->CairoStatus()) { @@ -473,7 +473,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode } } - if (aMode == SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) { + if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) { hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTextureOnWhite)); if (FAILED(hr)) { @@ -501,10 +501,10 @@ ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode } if (gfxPlatform::GetPlatform()->SupportsAzureContent() && !mDrawTarget) { - if (aMode == SURFACE_COMPONENT_ALPHA) { + if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { mDrawTarget = Factory::CreateDualDrawTargetForD3D10Textures(mTexture, mTextureOnWhite, SurfaceFormat::B8G8R8X8); } else { - mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? + mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8); } diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index bfd0b6b2b8a6..00ff3d571b72 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -65,7 +65,7 @@ CompositorD3D11::CompositorD3D11(nsIWidget* aWidget) , mHwnd(nullptr) , mDisableSequenceForNextFrame(false) { - sBackend = LAYERS_D3D11; + sBackend = LayersBackend::LAYERS_D3D11; } CompositorD3D11::~CompositorD3D11() @@ -352,7 +352,7 @@ CompositorD3D11::GetTextureFactoryIdentifier() TextureFactoryIdentifier ident; ident.mMaxTextureSize = GetMaxTextureSize(); ident.mParentProcessId = XRE_GetProcessType(); - ident.mParentBackend = LAYERS_D3D11; + ident.mParentBackend = LayersBackend::LAYERS_D3D11; return ident; } diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp index 7cec31540abc..07b67caa208e 100644 --- a/gfx/layers/d3d9/CompositorD3D9.cpp +++ b/gfx/layers/d3d9/CompositorD3D9.cpp @@ -26,7 +26,7 @@ CompositorD3D9::CompositorD3D9(PCompositorParent* aParent, nsIWidget *aWidget) , mWidget(aWidget) , mDeviceResetCount(0) { - sBackend = LAYERS_D3D9; + sBackend = LayersBackend::LAYERS_D3D9; } CompositorD3D9::~CompositorD3D9() @@ -63,7 +63,7 @@ CompositorD3D9::GetTextureFactoryIdentifier() { TextureFactoryIdentifier ident; ident.mMaxTextureSize = GetMaxTextureSize(); - ident.mParentBackend = LAYERS_D3D9; + ident.mParentBackend = LayersBackend::LAYERS_D3D9; ident.mParentProcessId = XRE_GetProcessType(); return ident; } diff --git a/gfx/layers/d3d9/ImageLayerD3D9.cpp b/gfx/layers/d3d9/ImageLayerD3D9.cpp index df05b0e11fa2..aacd25d2dcb5 100644 --- a/gfx/layers/d3d9/ImageLayerD3D9.cpp +++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp @@ -306,7 +306,7 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage, backendData->mCrTexture->UnlockRect(0); } - aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, backendData.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, backendData.forget()); } Layer* @@ -331,11 +331,11 @@ ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha) RemoteBitmapImage *remoteImage = static_cast(aImage); - if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) { + if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) { nsAutoPtr dat(new TextureD3D9BackendData()); dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize, D3DFMT_A8R8G8B8); if (dat->mTexture) { - aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, dat.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, dat.forget()); } } @@ -349,24 +349,24 @@ ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha) return nullptr; } - if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) { + if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) { nsAutoPtr dat(new TextureD3D9BackendData()); dat->mTexture = SurfaceToTexture(device(), surf, cairoImage->GetSize()); if (dat->mTexture) { - aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, dat.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, dat.forget()); } } aHasAlpha = surf->GetContentType() == gfxContentType::COLOR_ALPHA; } else if (aImage->GetFormat() == D3D9_RGB32_TEXTURE) { - if (!aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) { + if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) { // The texture in which the frame is stored belongs to DXVA's D3D9 device. // We need to open it on our device before we can use it. nsAutoPtr backendData(new TextureD3D9BackendData()); D3D9SurfaceImage* image = static_cast(aImage); backendData->mTexture = OpenSharedTexture(image->GetDesc(), image->GetShareHandle(), device()); if (backendData->mTexture) { - aImage->SetBackendData(mozilla::layers::LAYERS_D3D9, backendData.forget()); + aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, backendData.forget()); } } aHasAlpha = false; @@ -376,7 +376,7 @@ ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha) } TextureD3D9BackendData *data = - static_cast(aImage->GetBackendData(mozilla::layers::LAYERS_D3D9)); + static_cast(aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)); if (!data) { return nullptr; @@ -457,12 +457,12 @@ ImageLayerD3D9::RenderLayer() return; } - if (!yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D9)) { + if (!yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) { AllocateTexturesYCbCr(yuvImage, device(), mD3DManager); } PlanarYCbCrD3D9BackendData *data = - static_cast(yuvImage->GetBackendData(mozilla::layers::LAYERS_D3D9)); + static_cast(yuvImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)); if (!data) { return; diff --git a/gfx/layers/d3d9/LayerManagerD3D9.h b/gfx/layers/d3d9/LayerManagerD3D9.h index a1bf2b686d9c..5cab3135cee6 100644 --- a/gfx/layers/d3d9/LayerManagerD3D9.h +++ b/gfx/layers/d3d9/LayerManagerD3D9.h @@ -103,7 +103,7 @@ public: virtual already_AddRefed CreateReadbackLayer(); - virtual LayersBackend GetBackendType() { return LAYERS_D3D9; } + virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_D3D9; } virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 9"); } bool DeviceWasRemoved() { return deviceManager()->DeviceWasRemoved(); } diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.cpp b/gfx/layers/d3d9/ThebesLayerD3D9.cpp index 38efc6f706e6..cfb0ee92e88b 100644 --- a/gfx/layers/d3d9/ThebesLayerD3D9.cpp +++ b/gfx/layers/d3d9/ThebesLayerD3D9.cpp @@ -131,7 +131,7 @@ ThebesLayerD3D9::UpdateTextures(SurfaceMode aMode) } else { CopyRegion(oldTexture, mTextureRect.TopLeft(), mTexture, visibleRect.TopLeft(), retainRegion, &mValidRegion); - if (aMode == SURFACE_COMPONENT_ALPHA) { + if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { CopyRegion(oldTextureOnWhite, mTextureRect.TopLeft(), mTextureOnWhite, visibleRect.TopLeft(), retainRegion, &mValidRegion); } @@ -182,9 +182,9 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback) nsIntRect newTextureRect = mVisibleRegion.GetBounds(); SurfaceMode mode = GetSurfaceMode(); - if (mode == SURFACE_COMPONENT_ALPHA && + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA && (!mParent || !mParent->SupportsComponentAlphaChildren())) { - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } // If we have a transform that requires resampling of our texture, then // we need to make sure we don't sample pixels that haven't been drawn. @@ -196,11 +196,11 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback) neededRegion.GetNumRects() > 1) { if (MayResample()) { neededRegion = newTextureRect; - if (mode == SURFACE_OPAQUE) { + if (mode == SurfaceMode::SURFACE_OPAQUE) { // We're going to paint outside the visible region, but layout hasn't // promised that it will paint opaquely there, so we'll have to // treat this layer as transparent. - mode = SURFACE_SINGLE_CHANNEL_ALPHA; + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; } } } @@ -246,7 +246,7 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback) SetShaderTransformAndOpacity(); - if (mode == SURFACE_COMPONENT_ALPHA) { + if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { mD3DManager->SetShaderMode(DeviceManagerD3D9::COMPONENTLAYERPASS1, GetMaskLayer()); device()->SetTexture(0, mTexture); @@ -315,17 +315,17 @@ ThebesLayerD3D9::VerifyContentType(SurfaceMode aMode) mTexture->GetLevelDesc(0, &desc); switch (aMode) { - case SURFACE_OPAQUE: + case SurfaceMode::SURFACE_OPAQUE: if (desc.Format == D3DFMT_X8R8G8B8 && !mTextureOnWhite) return; break; - case SURFACE_SINGLE_CHANNEL_ALPHA: + case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA: if (desc.Format == D3DFMT_A8R8G8B8 && !mTextureOnWhite) return; break; - case SURFACE_COMPONENT_ALPHA: + case SurfaceMode::SURFACE_COMPONENT_ALPHA: if (mTextureOnWhite) { NS_ASSERTION(desc.Format == D3DFMT_X8R8G8B8, "Wrong format for component alpha texture"); return; @@ -432,11 +432,11 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, switch (aMode) { - case SURFACE_OPAQUE: + case SurfaceMode::SURFACE_OPAQUE: destinationSurface = opaqueRenderer.Begin(this); break; - case SURFACE_SINGLE_CHANNEL_ALPHA: { + case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA: { hr = device()->CreateTexture(bounds.width, bounds.height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), nullptr); @@ -459,7 +459,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, break; } - case SURFACE_COMPONENT_ALPHA: { + case SurfaceMode::SURFACE_COMPONENT_ALPHA: { nsRefPtr onBlack = opaqueRenderer.Begin(this); nsRefPtr onWhite = opaqueRendererOnWhite.Begin(this); if (onBlack && onWhite) { @@ -493,10 +493,10 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, context->Translate(gfxPoint(-bounds.x, -bounds.y)); LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo(); - cbInfo.Callback(this, context, aRegion, CLIP_NONE, nsIntRegion(), cbInfo.CallbackData); + cbInfo.Callback(this, context, aRegion, DrawRegionClip::CLIP_NONE, nsIntRegion(), cbInfo.CallbackData); for (uint32_t i = 0; i < aReadbackUpdates.Length(); ++i) { - NS_ASSERTION(aMode == SURFACE_OPAQUE, + NS_ASSERTION(aMode == SurfaceMode::SURFACE_OPAQUE, "Transparent surfaces should not be used for readback"); const ReadbackProcessor::Update& update = aReadbackUpdates[i]; nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset(); @@ -518,7 +518,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, nsAutoTArray destTextures; switch (aMode) { - case SURFACE_OPAQUE: + case SurfaceMode::SURFACE_OPAQUE: // Must release reference to dest surface before ending drawing destinationSurface = nullptr; opaqueRenderer.End(); @@ -526,7 +526,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, destTextures.AppendElement(mTexture); break; - case SURFACE_SINGLE_CHANNEL_ALPHA: { + case SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA: { LockTextureRectD3D9 textureLock(tmpTexture); if (!textureLock.HasLock()) { NS_WARNING("Failed to lock ThebesLayer tmpTexture texture."); @@ -557,7 +557,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, break; } - case SURFACE_COMPONENT_ALPHA: { + case SurfaceMode::SURFACE_COMPONENT_ALPHA: { // Must release reference to dest surface before ending drawing destinationSurface = nullptr; opaqueRenderer.End(); @@ -610,7 +610,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfx::IntSize &aSize, mTextureOnWhite = nullptr; HRESULT hr = device()->CreateTexture(aSize.width, aSize.height, 1, D3DUSAGE_RENDERTARGET, - aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8, + aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, getter_AddRefs(mTexture), nullptr); if (FAILED(hr)) { ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture"), @@ -618,7 +618,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfx::IntSize &aSize, return; } - if (aMode == SURFACE_COMPONENT_ALPHA) { + if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { hr = device()->CreateTexture(aSize.width, aSize.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.h b/gfx/layers/d3d9/ThebesLayerD3D9.h index 0abada704286..3f891e3a08c8 100644 --- a/gfx/layers/d3d9/ThebesLayerD3D9.h +++ b/gfx/layers/d3d9/ThebesLayerD3D9.h @@ -51,7 +51,7 @@ private: bool HaveTextures(SurfaceMode aMode) { - return mTexture && (aMode != SURFACE_COMPONENT_ALPHA || mTextureOnWhite); + return mTexture && (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mTextureOnWhite); } /* Checks if our surface has the right content type */ diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 2332930ccc77..a9a438f8fa4e 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -725,24 +725,24 @@ CompositorParent::InitializeLayerManager(const nsTArray& aBackend for (size_t i = 0; i < aBackendHints.Length(); ++i) { RefPtr compositor; - if (aBackendHints[i] == LAYERS_OPENGL) { + if (aBackendHints[i] == LayersBackend::LAYERS_OPENGL) { compositor = new CompositorOGL(mWidget, mEGLSurfaceSize.width, mEGLSurfaceSize.height, mUseExternalSurfaceSize); - } else if (aBackendHints[i] == LAYERS_BASIC) { + } else if (aBackendHints[i] == LayersBackend::LAYERS_BASIC) { compositor = new BasicCompositor(mWidget); #ifdef XP_WIN - } else if (aBackendHints[i] == LAYERS_D3D11) { + } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D11) { compositor = new CompositorD3D11(mWidget); - } else if (aBackendHints[i] == LAYERS_D3D9) { + } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D9) { compositor = new CompositorD3D9(this, mWidget); #endif } if (!compositor) { // We passed a backend hint for which we can't create a compositor. - // For example, we sometime pass LAYERS_NONE as filler in aBackendHints. + // For example, we sometime pass LayersBackend::LAYERS_NONE as filler in aBackendHints. continue; } diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index f8880a31b901..45fca882cb22 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -71,7 +71,7 @@ ImageBridgeParent::RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply) { // If we don't actually have a compositor, then don't bother // creating any textures. - if (Compositor::GetBackend() == LAYERS_NONE) { + if (Compositor::GetBackend() == LayersBackend::LAYERS_NONE) { return true; } diff --git a/gfx/layers/ipc/PCompositor.ipdl b/gfx/layers/ipc/PCompositor.ipdl index 84668917328d..af2c3422b6e6 100644 --- a/gfx/layers/ipc/PCompositor.ipdl +++ b/gfx/layers/ipc/PCompositor.ipdl @@ -78,7 +78,7 @@ parent: returns (float[] intervals); // layersBackendHints is an ordered list of preffered backends where - // layersBackendHints[0] is the best backend. If any hints are LAYERS_NONE + // layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE // that hint is ignored. sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id) returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success); diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 06a5b2bfb2c2..307b398fd47d 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -253,7 +253,7 @@ CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth, , mHeight(0) { MOZ_COUNT_CTOR(CompositorOGL); - sBackend = LAYERS_OPENGL; + sBackend = LayersBackend::LAYERS_OPENGL; } CompositorOGL::~CompositorOGL() diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index 97b4aba291ec..ea9bd34e7b6d 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -76,7 +76,7 @@ public: virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE { - return TextureFactoryIdentifier(LAYERS_OPENGL, + return TextureFactoryIdentifier(LayersBackend::LAYERS_OPENGL, XRE_GetProcessType(), GetMaxTextureSize(), mFBOTextureTarget == LOCAL_GL_TEXTURE_2D, diff --git a/gfx/layers/opengl/GLManager.cpp b/gfx/layers/opengl/GLManager.cpp index 6aaa1eb99160..9e49767492d1 100644 --- a/gfx/layers/opengl/GLManager.cpp +++ b/gfx/layers/opengl/GLManager.cpp @@ -50,7 +50,7 @@ private: GLManager::CreateGLManager(LayerManagerComposite* aManager) { if (aManager && - Compositor::GetBackend() == LAYERS_OPENGL) { + Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) { return new GLManagerCompositor(static_cast( aManager->GetCompositor())); } diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp index c1364f069354..85b0bf9a003a 100644 --- a/gfx/tests/gtest/TestLayers.cpp +++ b/gfx/tests/gtest/TestLayers.cpp @@ -19,7 +19,7 @@ public: virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) { return false; } virtual already_AddRefed CreateContainerLayer() { return nullptr; } virtual void GetBackendName(nsAString& aName) {} - virtual LayersBackend GetBackendType() { return LAYERS_BASIC; } + virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; } virtual void BeginTransaction() {} virtual already_AddRefed CreateImageLayer() { return nullptr; } virtual void SetRoot(Layer* aLayer) {} diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 5fffb9dbcea1..21752e9a9802 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -3513,7 +3513,7 @@ static bool ShouldDrawRectsSeparately(gfxContext* aContext, DrawRegionClip aClip if (!sPaintRectsSeparately || aContext->IsCairo() || - aClip == CLIP_NONE) { + aClip == DrawRegionClip::CLIP_NONE) { return false; } @@ -3594,9 +3594,9 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, bool shouldDrawRectsSeparately = ShouldDrawRectsSeparately(aContext, aClip); if (!shouldDrawRectsSeparately) { - if (aClip == CLIP_DRAW_SNAPPED) { + if (aClip == DrawRegionClip::DRAW_SNAPPED) { gfxUtils::ClipToRegionSnapped(aContext, aRegionToDraw); - } else if (aClip == CLIP_DRAW) { + } else if (aClip == DrawRegionClip::DRAW) { gfxUtils::ClipToRegion(aContext, aRegionToDraw); } @@ -3623,7 +3623,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, while (const nsIntRect* iterRect = it.Next()) { gfxContextAutoSaveRestore save(aContext); aContext->NewPath(); - aContext->Rectangle(*iterRect, aClip == CLIP_DRAW_SNAPPED); + aContext->Rectangle(*iterRect, aClip == DrawRegionClip::DRAW_SNAPPED); aContext->Clip(); DrawForcedBackgroundColor(aContext, aLayer, userData->mForcedBackgroundColor); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 4e3848a10312..ceefdb30d6ae 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5804,7 +5804,7 @@ PresShell::Paint(nsView* aViewToPaint, NotifySubDocInvalidationFunc computeInvalidFunc = presContext->MayHavePaintEventListenerInSubDocument() ? nsPresContext::NotifySubDocInvalidation : 0; bool computeInvalidRect = computeInvalidFunc || - (layerManager->GetBackendType() == LAYERS_BASIC); + (layerManager->GetBackendType() == LayersBackend::LAYERS_BASIC); nsAutoPtr props(computeInvalidRect ? LayerProperties::CloneFrom(layerManager->GetRoot()) : diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 5bced56145ca..8b53338dd450 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4905,7 +4905,7 @@ nsIFrame::InvalidateLayer(uint32_t aDisplayItemKey, // If the layer is being updated asynchronously, and it's being forwarded // to a compositor, then we don't need to invalidate. if ((aFlags & UPDATE_IS_ASYNC) && layer && - layer->Manager()->GetBackendType() == LAYERS_CLIENT) { + layer->Manager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) { return layer; } diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index d71b01cfe03b..508f02062c84 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1562,7 +1562,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder, } #endif - imglayer->SetScaleToSize(size, SCALE_STRETCH); + imglayer->SetScaleToSize(size, ScaleMode::STRETCH); imglayer->SetContainer(container); GraphicsFilter filter = nsLayoutUtils::GetGraphicsFilterForFrame(this); diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 3356b95bfe75..3a0a93164cf7 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -102,7 +102,7 @@ AssertInTopLevelChromeDoc(ContainerLayer* aContainer, nsIFrame* aContainedFrame) { NS_ASSERTION( - (aContainer->Manager()->GetBackendType() != mozilla::layers::LAYERS_BASIC) || + (aContainer->Manager()->GetBackendType() != mozilla::layers::LayersBackend::LAYERS_BASIC) || (aContainedFrame->GetNearestWidget() == static_cast(aContainer->Manager())->GetRetainerWidget()), "Expected frame to be in top-level chrome document"); @@ -354,7 +354,7 @@ ClearContainer(ContainerLayer* aContainer) inline static bool IsTempLayerManager(LayerManager* aManager) { - return (mozilla::layers::LAYERS_BASIC == aManager->GetBackendType() && + return (mozilla::layers::LayersBackend::LAYERS_BASIC == aManager->GetBackendType() && !static_cast(aManager)->IsRetained()); } @@ -705,7 +705,7 @@ RenderFrameParent::Init(nsFrameLoader* aFrameLoader, nsRefPtr lm = GetFrom(mFrameLoader); // Perhaps the document containing this frame currently has no presentation? - if (lm && lm->GetBackendType() == LAYERS_CLIENT) { + if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) { *aTextureFactoryIdentifier = static_cast(lm.get())->GetTextureFactoryIdentifier(); } else { @@ -723,7 +723,7 @@ RenderFrameParent::Init(nsFrameLoader* aFrameLoader, // Our remote frame will push layers updates to the compositor, // and we'll keep an indirect reference to that tree. *aId = mLayersId = CompositorParent::AllocateLayerTreeId(); - if (lm && lm->GetBackendType() == LAYERS_CLIENT) { + if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) { ClientLayerManager *clientManager = static_cast(lm.get()); clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId); } diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index cc8ae09537d5..e9d12b8c8a62 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -984,21 +984,21 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect) mWidgetListener->WillPaintWindow(this); switch (GetLayerManager(nullptr)->GetBackendType()) { - case mozilla::layers::LAYERS_BASIC: { + case mozilla::layers::LayersBackend::LAYERS_BASIC: { nsRefPtr ctx = new gfxContext(targetSurface); { mozilla::layers::RenderTraceScope trace2("Basic DrawTo", "727272"); AutoLayerManagerSetup - setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE); + setupLayerManager(this, ctx, mozilla::layers::BufferMode::BUFFER_NONE); mWidgetListener->PaintWindow(this, region); } break; } - case mozilla::layers::LAYERS_CLIENT: { + case mozilla::layers::LayersBackend::LAYERS_CLIENT: { mWidgetListener->PaintWindow(this, region); break; } diff --git a/widget/android/nsWindow.h b/widget/android/nsWindow.h index 28ce60a3bff2..7b940a5edbf4 100644 --- a/widget/android/nsWindow.h +++ b/widget/android/nsWindow.h @@ -146,7 +146,7 @@ public: virtual nsIMEUpdatePreference GetIMEUpdatePreference(); LayerManager* GetLayerManager (PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 0cea475cafd8..47398315d956 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -1564,7 +1564,7 @@ NS_IMETHODIMP nsChildView::Invalidate(const nsIntRect &aRect) if (!mView || !mVisible) return NS_OK; - NS_ASSERTION(GetLayerManager()->GetBackendType() != LAYERS_CLIENT, + NS_ASSERTION(GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_CLIENT, "Shouldn't need to invalidate with accelerated OMTC layers!"); if ([NSView focusView]) { @@ -3570,11 +3570,11 @@ NSEvent* gLastDragMouseDownEvent = nil; nsAutoRetainCocoaObject kungFuDeathGrip(self); bool painted = false; - if (mGeckoChild->GetLayerManager()->GetBackendType() == LAYERS_BASIC) { + if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) { nsBaseWidget::AutoLayerManagerSetup - setupLayerManager(mGeckoChild, targetContext, BUFFER_NONE); + setupLayerManager(mGeckoChild, targetContext, BufferMode::BUFFER_NONE); painted = mGeckoChild->PaintWindow(region); - } else if (mGeckoChild->GetLayerManager()->GetBackendType() == LAYERS_CLIENT) { + } else if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) { // We only need this so that we actually get DidPaintWindow fired painted = mGeckoChild->PaintWindow(region); } @@ -3622,7 +3622,7 @@ NSEvent* gLastDragMouseDownEvent = nil; if (!mGeckoChild || ![self window]) return NO; - return mGeckoChild->GetLayerManager(nullptr)->GetBackendType() == mozilla::layers::LAYERS_OPENGL; + return mGeckoChild->GetLayerManager(nullptr)->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL; } - (BOOL)isUsingOpenGL @@ -3831,7 +3831,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // So we notify our nsChildView about any areas needing repainting. mGeckoChild->NotifyDirtyRegion([self nativeDirtyRegionWithBoundingRect:[self bounds]]); - if (mGeckoChild->GetLayerManager()->GetBackendType() == LAYERS_CLIENT) { + if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) { ClientLayerManager *manager = static_cast(mGeckoChild->GetLayerManager()); manager->AsShadowForwarder()->WindowOverlayChanged(); } diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h index 1039893bf0f9..82b5750028db 100644 --- a/widget/cocoa/nsCocoaWindow.h +++ b/widget/cocoa/nsCocoaWindow.h @@ -290,7 +290,7 @@ public: NS_IMETHOD Invalidate(const nsIntRect &aRect); virtual nsresult ConfigureChildren(const nsTArray& aConfigurations); virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index 68943d29fd9c..d689899c5db3 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -199,9 +199,9 @@ nsWindow::DoDraw(void) } LayerManager* lm = gWindowToRedraw->GetLayerManager(); - if (mozilla::layers::LAYERS_CLIENT == lm->GetBackendType()) { + if (mozilla::layers::LayersBackend::LAYERS_CLIENT == lm->GetBackendType()) { // No need to do anything, the compositor will handle drawing - } else if (mozilla::layers::LAYERS_BASIC == lm->GetBackendType()) { + } else if (mozilla::layers::LayersBackend::LAYERS_BASIC == lm->GetBackendType()) { MOZ_ASSERT(sFramebufferOpen || sUsingOMTC); nsRefPtr targetSurface; @@ -217,7 +217,7 @@ nsWindow::DoDraw(void) // No double-buffering needed. AutoLayerManagerSetup setupLayerManager( - gWindowToRedraw, ctx, mozilla::layers::BUFFER_NONE, + gWindowToRedraw, ctx, mozilla::layers::BufferMode::BUFFER_NONE, ScreenRotation(EffectiveScreenRotation())); listener = gWindowToRedraw->GetWidgetListener(); @@ -544,15 +544,15 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager, if (mLayerManager) { // This layer manager might be used for painting outside of DoDraw(), so we need // to set the correct rotation on it. - if (mLayerManager->GetBackendType() == LAYERS_BASIC) { + if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) { BasicLayerManager* manager = static_cast(mLayerManager.get()); - manager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE, + manager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE, ScreenRotation(EffectiveScreenRotation())); - } else if (mLayerManager->GetBackendType() == LAYERS_CLIENT) { + } else if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_CLIENT) { ClientLayerManager* manager = static_cast(mLayerManager.get()); - manager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE, + manager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE, ScreenRotation(EffectiveScreenRotation())); } return mLayerManager; @@ -646,7 +646,7 @@ uint32_t nsWindow::GetGLFrameBufferFormat() { if (mLayerManager && - mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) { + mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) { // We directly map the hardware fb on Gonk. The hardware fb // has RGB format. return LOCAL_GL_RGB; diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index 1bfdc608b2fc..3f71b7c758e2 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -98,7 +98,7 @@ public: virtual double GetDefaultScaleInternal(); virtual mozilla::layers::LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); gfxASurface* GetThebesSurface(); diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 54e4940f5670..5e7a4223b323 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -2054,7 +2054,7 @@ nsWindow::OnExposeEvent(cairo_t *cr) nsIntRegion ®ion = exposeRegion.mRegion; ClientLayerManager *clientLayers = - (GetLayerManager()->GetBackendType() == LAYERS_CLIENT) + (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) ? static_cast(GetLayerManager()) : nullptr; @@ -2139,7 +2139,7 @@ nsWindow::OnExposeEvent(cairo_t *cr) } // If this widget uses OMTC... - if (GetLayerManager()->GetBackendType() == LAYERS_CLIENT) { + if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) { listener->PaintWindow(this, region); listener->DidPaintWindow(); return TRUE; @@ -2192,16 +2192,16 @@ nsWindow::OnExposeEvent(cairo_t *cr) // The double buffering is done here to extract the shape mask. // (The shape mask won't be necessary when a visual with an alpha // channel is used on compositing window managers.) - layerBuffering = mozilla::layers::BUFFER_NONE; + layerBuffering = mozilla::layers::BufferMode::BUFFER_NONE; ctx->PushGroup(gfxContentType::COLOR_ALPHA); #ifdef MOZ_HAVE_SHMIMAGE } else if (nsShmImage::UseShm()) { // We're using an xshm mapping as a back buffer. - layerBuffering = mozilla::layers::BUFFER_NONE; + layerBuffering = mozilla::layers::BufferMode::BUFFER_NONE; #endif // MOZ_HAVE_SHMIMAGE } else { // Get the layer manager to do double buffering (if necessary). - layerBuffering = mozilla::layers::BUFFER_BUFFERED; + layerBuffering = mozilla::layers::BufferMode::BUFFERED; } #if 0 @@ -2219,7 +2219,7 @@ nsWindow::OnExposeEvent(cairo_t *cr) bool painted = false; { - if (GetLayerManager()->GetBackendType() == LAYERS_BASIC) { + if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) { AutoLayerManagerSetup setupLayerManager(this, ctx, layerBuffering); painted = listener->PaintWindow(this, region); } @@ -6212,7 +6212,7 @@ void nsWindow::ClearCachedResources() { if (mLayerManager && - mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) { + mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_BASIC) { mLayerManager->ClearCachedResources(); } diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 273281f8e658..80ba6143a300 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -441,7 +441,7 @@ private: // nsBaseWidget virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr) MOZ_OVERRIDE; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 12b34d79ae49..2665a21684a3 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1202,21 +1202,21 @@ class nsIWidget : public nsISupports { */ inline LayerManager* GetLayerManager(bool* aAllowRetaining = nullptr) { - return GetLayerManager(nullptr, mozilla::layers::LAYERS_NONE, + return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE, LAYER_MANAGER_CURRENT, aAllowRetaining); } inline LayerManager* GetLayerManager(LayerManagerPersistence aPersistence, bool* aAllowRetaining = nullptr) { - return GetLayerManager(nullptr, mozilla::layers::LAYERS_NONE, + return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE, aPersistence, aAllowRetaining); } /** * Like GetLayerManager(), but prefers creating a layer manager of * type |aBackendHint| instead of what would normally be created. - * LAYERS_NONE means "no hint". + * LayersBackend::LAYERS_NONE means "no hint". */ virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager, LayersBackend aBackendHint, diff --git a/widget/os2/nsWindow.cpp b/widget/os2/nsWindow.cpp index bc26f18d5c6b..fd58db35b071 100644 --- a/widget/os2/nsWindow.cpp +++ b/widget/os2/nsWindow.cpp @@ -2086,7 +2086,7 @@ do { // Init the Layers manager then dispatch the event. // If it returns false there's nothing to paint, so exit. AutoLayerManagerSetup - setupLayerManager(this, thebesContext, BasicLayerManager::BUFFER_NONE); + setupLayerManager(this, thebesContext, BasicLayerManager::BufferMode::BUFFER_NONE); if (!DispatchWindowEvent(&event, eventStatus)) { break; } diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 7c6bcc09d1a5..55c20ee864aa 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -434,7 +434,7 @@ void nsWindow::ClearCachedResources() { if (mLayerManager && - mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) { + mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_BASIC) { statimLayerManager->ClearCachedResources(); } for (nsIWidget* kid = mFirstChild; kid; ) { @@ -1077,7 +1077,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q { AutoLayerManagerSetup - setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE); + setupLayerManager(this, ctx, mozilla::layers::BufferMode::BUFFER_NONE); if (mWidgetListener) { nsIntRegion region(rect); painted = mWidgetListener->PaintWindow(this, region); @@ -3139,7 +3139,7 @@ uint32_t nsWindow::GetGLFrameBufferFormat() { if (mLayerManager && - mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) { + mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) { return MozQGLWidgetWrapper::isRGBAContext() ? LOCAL_GL_RGBA : LOCAL_GL_RGB; } return LOCAL_GL_NONE; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 0f3c62110959..6c6d68a9877a 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -1379,7 +1379,7 @@ NS_METHOD nsWindow::Move(double aX, double aY) // region, some drivers or OSes may incorrectly copy into the clipped-out // area. if (mWindowType == eWindowType_plugin && - (!mLayerManager || mLayerManager->GetBackendType() == LAYERS_D3D9) && + (!mLayerManager || mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D9) && mClipRects && (mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(nsIntRect(0, 0, mBounds.width, mBounds.height)))) { flags |= SWP_NOCOPYBITS; @@ -3252,7 +3252,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager, #ifdef MOZ_ENABLE_D3D10_LAYER if (mLayerManager) { - if (mLayerManager->GetBackendType() == LAYERS_D3D10) + if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D10) { LayerManagerD3D10 *layerManagerD3D10 = static_cast(mLayerManager.get()); @@ -3281,7 +3281,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager, if (!mLayerManager || (!sAllowD3D9 && aPersistence == LAYER_MANAGER_PERSISTENT && - mLayerManager->GetBackendType() == LAYERS_BASIC && + mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC && !ShouldUseOffMainThreadCompositing())) { // If D3D9 is not currently allowed but the permanent manager is required, // -and- we're currently using basic layers, run through this check. @@ -6372,7 +6372,7 @@ nsWindow::ConfigureChildren(const nsTArray& aConfigurations) if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() == gfxWindowsPlatform::RENDER_DIRECT2D || - GetLayerManager()->GetBackendType() != LAYERS_BASIC) { + GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_BASIC) { // XXX - Workaround for Bug 587508. This will invalidate the part of the // plugin window that might be touched by moving content somehow. The // underlying problem should be found and fixed! @@ -6673,14 +6673,14 @@ nsWindow::GetPreferredCompositorBackends(nsTArray& aHints) if (!(prefs.mDisableAcceleration || mTransparencyMode == eTransparencyTransparent)) { if (prefs.mPreferOpenGL) { - aHints.AppendElement(LAYERS_OPENGL); + aHints.AppendElement(LayersBackend::LAYERS_OPENGL); } if (!prefs.mPreferD3D9) { - aHints.AppendElement(LAYERS_D3D11); + aHints.AppendElement(LayersBackend::LAYERS_D3D11); } - aHints.AppendElement(LAYERS_D3D9); + aHints.AppendElement(LayersBackend::LAYERS_D3D9); } - aHints.AppendElement(LAYERS_BASIC); + aHints.AppendElement(LayersBackend::LAYERS_BASIC); } void @@ -7253,7 +7253,7 @@ nsWindow::ClearCachedResources() mD2DWindowSurface = nullptr; #endif if (mLayerManager && - mLayerManager->GetBackendType() == LAYERS_BASIC) { + mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) { mLayerManager->ClearCachedResources(); } ::EnumChildWindows(mWnd, nsWindow::ClearResourcesCallback, 0); diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index 40c7b2c70f2d..44d859df8938 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -153,7 +153,7 @@ public: NS_IMETHOD GetAttention(int32_t aCycleCount); virtual bool HasPendingInputEvent(); virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); gfxASurface *GetThebesSurface(); diff --git a/widget/windows/nsWindowGfx.cpp b/widget/windows/nsWindowGfx.cpp index a3ddc0537a68..8eb49da86772 100644 --- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -214,7 +214,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) } ClientLayerManager *clientLayerManager = - (GetLayerManager()->GetBackendType() == LAYERS_CLIENT) + (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) ? static_cast(GetLayerManager()) : nullptr; @@ -308,7 +308,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) #endif // WIDGET_DEBUG_OUTPUT switch (GetLayerManager()->GetBackendType()) { - case LAYERS_BASIC: + case LayersBackend::LAYERS_BASIC: { nsRefPtr targetSurface; @@ -412,7 +412,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) } // don't need to double buffer with anything but GDI - BufferMode doubleBuffering = mozilla::layers::BUFFER_NONE; + BufferMode doubleBuffering = mozilla::layers::BufferMode::BUFFER_NONE; if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) { #ifdef MOZ_XUL switch (mTransparencyMode) { @@ -420,7 +420,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) case eTransparencyBorderlessGlass: default: // If we're not doing translucency, then double buffer - doubleBuffering = mozilla::layers::BUFFER_BUFFERED; + doubleBuffering = mozilla::layers::BufferMode::BUFFERED; break; case eTransparencyTransparent: // If we're rendering with translucency, we're going to be @@ -431,7 +431,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) break; } #else - doubleBuffering = mozilla::layers::BUFFER_BUFFERED; + doubleBuffering = mozilla::layers::BufferMode::BUFFERED; #endif } @@ -551,7 +551,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) } break; #ifdef MOZ_ENABLE_D3D9_LAYER - case LAYERS_D3D9: + case LayersBackend::LAYERS_D3D9: { nsRefPtr layerManagerD3D9 = static_cast(GetLayerManager()); @@ -569,7 +569,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) break; #endif #ifdef MOZ_ENABLE_D3D10_LAYER - case LAYERS_D3D10: + case LayersBackend::LAYERS_D3D10: { gfxWindowsPlatform::GetPlatform()->UpdateRenderMode(); LayerManagerD3D10 *layerManagerD3D10 = static_cast(GetLayerManager()); @@ -581,7 +581,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) } break; #endif - case LAYERS_CLIENT: + case LayersBackend::LAYERS_CLIENT: result = listener->PaintWindow(this, region); break; default: diff --git a/widget/windows/winrt/MetroWidget.cpp b/widget/windows/winrt/MetroWidget.cpp index 6bf041652aa7..d7fff55539a1 100644 --- a/widget/windows/winrt/MetroWidget.cpp +++ b/widget/windows/winrt/MetroWidget.cpp @@ -1131,7 +1131,7 @@ MetroWidget::GetLayerManager(PLayerTransactionChild* aShadowManager, // If the backend device has changed, create a new manager (pulled from nswindow) if (mLayerManager) { - if (mLayerManager->GetBackendType() == LAYERS_D3D10) { + if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D10) { LayerManagerD3D10 *layerManagerD3D10 = static_cast(mLayerManager.get()); if (layerManagerD3D10->device() != diff --git a/widget/windows/winrt/MetroWidget.h b/widget/windows/winrt/MetroWidget.h index 93c6cfc420af..8715994fdb12 100644 --- a/widget/windows/winrt/MetroWidget.h +++ b/widget/windows/winrt/MetroWidget.h @@ -151,10 +151,10 @@ public: bool ShouldUseBasicManager(); bool ShouldUseAPZC(); virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); - virtual void GetPreferredCompositorBackends(nsTArray& aHints) { aHints.AppendElement(mozilla::layers::LAYERS_D3D11); } + virtual void GetPreferredCompositorBackends(nsTArray& aHints) { aHints.AppendElement(mozilla::layers::LayersBackend::LAYERS_D3D11); } // IME related interfaces NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, diff --git a/widget/xpwidgets/PuppetWidget.cpp b/widget/xpwidgets/PuppetWidget.cpp index a5484f09b01c..dffd49e03025 100644 --- a/widget/xpwidgets/PuppetWidget.cpp +++ b/widget/xpwidgets/PuppetWidget.cpp @@ -317,7 +317,7 @@ PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager, // The backend hint is a temporary placeholder until Azure, when // all content-process layer managers will be BasicLayerManagers. #if defined(MOZ_ENABLE_D3D10_LAYER) - if (mozilla::layers::LAYERS_D3D10 == aBackendHint) { + if (mozilla::layers::LayersBackend::LAYERS_D3D10 == aBackendHint) { nsRefPtr m = new LayerManagerD3D10(this); m->AsShadowForwarder()->SetShadowManager(aShadowManager); if (m->Initialize()) { @@ -613,9 +613,9 @@ PuppetWidget::Paint() nsAutoCString("PuppetWidget"), 0); #endif - if (mozilla::layers::LAYERS_D3D10 == mLayerManager->GetBackendType()) { + if (mozilla::layers::LayersBackend::LAYERS_D3D10 == mLayerManager->GetBackendType()) { mAttachedWidgetListener->PaintWindow(this, region); - } else if (mozilla::layers::LAYERS_CLIENT == mLayerManager->GetBackendType()) { + } else if (mozilla::layers::LayersBackend::LAYERS_CLIENT == mLayerManager->GetBackendType()) { // Do nothing, the compositor will handle drawing if (mTabChild) { mTabChild->NotifyPainted(); @@ -625,7 +625,7 @@ PuppetWidget::Paint() ctx->Rectangle(gfxRect(0,0,0,0)); ctx->Clip(); AutoLayerManagerSetup setupLayerManager(this, ctx, - BUFFER_NONE); + BufferMode::BUFFER_NONE); mAttachedWidgetListener->PaintWindow(this, region); if (mTabChild) { mTabChild->NotifyPainted(); diff --git a/widget/xpwidgets/PuppetWidget.h b/widget/xpwidgets/PuppetWidget.h index c3fb703a13b8..c7c21e96c70d 100644 --- a/widget/xpwidgets/PuppetWidget.h +++ b/widget/xpwidgets/PuppetWidget.h @@ -144,7 +144,7 @@ public: virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); virtual gfxASurface* GetThebesSurface(); diff --git a/widget/xpwidgets/nsBaseWidget.cpp b/widget/xpwidgets/nsBaseWidget.cpp index 1f14d2f6dd64..9e730544f467 100644 --- a/widget/xpwidgets/nsBaseWidget.cpp +++ b/widget/xpwidgets/nsBaseWidget.cpp @@ -202,7 +202,7 @@ void nsBaseWidget::DestroyCompositor() nsBaseWidget::~nsBaseWidget() { if (mLayerManager && - mLayerManager->GetBackendType() == LAYERS_BASIC) { + mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) { static_cast(mLayerManager.get())->ClearRetainerWidget(); } @@ -802,7 +802,7 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup( { mLayerManager = static_cast(mWidget->GetLayerManager()); if (mLayerManager) { - NS_ASSERTION(mLayerManager->GetBackendType() == LAYERS_BASIC, + NS_ASSERTION(mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC, "AutoLayerManagerSetup instantiated for non-basic layer backend!"); mLayerManager->SetDefaultTarget(aTarget); mLayerManager->SetDefaultTargetConfiguration(aDoubleBuffering, aRotation); @@ -812,10 +812,10 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup( nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup() { if (mLayerManager) { - NS_ASSERTION(mLayerManager->GetBackendType() == LAYERS_BASIC, + NS_ASSERTION(mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC, "AutoLayerManagerSetup instantiated for non-basic layer backend!"); mLayerManager->SetDefaultTarget(nullptr); - mLayerManager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE, ROTATION_0); + mLayerManager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE, ROTATION_0); } } @@ -927,21 +927,21 @@ void nsBaseWidget::GetPreferredCompositorBackends(nsTArray& aHints) { if (mUseLayersAcceleration) { - aHints.AppendElement(LAYERS_OPENGL); + aHints.AppendElement(LayersBackend::LAYERS_OPENGL); } - aHints.AppendElement(LAYERS_BASIC); + aHints.AppendElement(LayersBackend::LAYERS_BASIC); } static void CheckForBasicBackends(nsTArray& aHints) { for (size_t i = 0; i < aHints.Length(); ++i) { - if (aHints[i] == LAYERS_BASIC && + if (aHints[i] == LayersBackend::LAYERS_BASIC && !Preferences::GetBool("layers.offmainthreadcomposition.force-basic", false) && !BrowserTabsRemote()) { // basic compositor is not stable enough for regular use - aHints[i] = LAYERS_NONE; + aHints[i] = LayersBackend::LAYERS_NONE; } } } diff --git a/widget/xpwidgets/nsBaseWidget.h b/widget/xpwidgets/nsBaseWidget.h index 787aa679d375..833a16b76246 100644 --- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -132,7 +132,7 @@ public: NS_IMETHOD MakeFullScreen(bool aFullScreen); virtual nsDeviceContext* GetDeviceContext(); virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, - LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr);