diff --git a/gfx/layers/ThebesLayerBuffer.cpp b/gfx/layers/ThebesLayerBuffer.cpp index 9468cc774b15..7764943bab7e 100644 --- a/gfx/layers/ThebesLayerBuffer.cpp +++ b/gfx/layers/ThebesLayerBuffer.cpp @@ -277,6 +277,7 @@ ThebesLayerBuffer::DrawTo(ThebesLayer* aLayer, aTarget->Restore(); } else { RefPtr dt = aTarget->GetDrawTarget(); + bool clipped = false; // If the entire buffer is valid, we can just draw the whole thing, // no need to clip. But we'll still clip if clipping is cheap --- @@ -292,11 +293,24 @@ ThebesLayerBuffer::DrawTo(ThebesLayer* aLayer, // we might sample pixels outside GetEffectiveVisibleRegion(), which is wrong // and may cause gray lines. gfxUtils::ClipToRegionSnapped(dt, aLayer->GetEffectiveVisibleRegion()); + clipped = true; } - DrawBufferWithRotation(aTarget, BUFFER_BLACK, aOpacity, aMask, aMaskTransform); - aTarget->Restore(); - } + RefPtr mask; + if (aMask) { + mask = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, aMask); + } + + Matrix maskTransform; + if (aMaskTransform) { + maskTransform = ToMatrix(*aMaskTransform); + } + + DrawBufferWithRotation(dt, BUFFER_BLACK, aOpacity, mask, &maskTransform); + if (clipped) { + dt->PopClip(); + } + } } static void diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 4feb01076b51..3b27d25d379a 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -83,6 +83,7 @@ ContentClientBasic::CreateBuffer(ContentType aType, uint32_t aFlags, gfxASurface**) { + MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA)); nsRefPtr referenceSurface = GetBuffer(); if (!referenceSurface) { gfxContext* defaultTarget = mManager->GetDefaultTarget(); @@ -105,9 +106,13 @@ ContentClientBasic::CreateDTBuffer(ContentType aType, uint32_t aFlags, RefPtr* aWhiteDT) { - NS_RUNTIMEABORT("ContentClientBasic does not support Moz2D drawing yet!"); - // TODO[Bas] - Implement me!? - return nullptr; + MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA)); + gfxASurface::gfxImageFormat format = + gfxPlatform::GetPlatform()->OptimalFormatForContent(aType); + + return gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( + IntSize(aRect.width, aRect.height), + ImageFormatToSurfaceFormat(format)); } void diff --git a/gfx/layers/client/ContentClient.h b/gfx/layers/client/ContentClient.h index 900e738c9f8e..d8929568a90f 100644 --- a/gfx/layers/client/ContentClient.h +++ b/gfx/layers/client/ContentClient.h @@ -160,6 +160,7 @@ public: const nsIntRect& aRect, uint32_t aFlags, RefPtr* aWhiteDT); + virtual bool SupportsAzureContent() const { return true; } virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE {