mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1034404 - Get rid of the Thebes backed gfxContexts in ThebesLayerD3D9. r=Bas
This commit is contained in:
parent
191df684dc
commit
77876f67e4
@ -471,11 +471,12 @@ static void
|
||||
FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion,
|
||||
const nsIntPoint& aOffset, const gfxRGBA& aColor)
|
||||
{
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(aSurface);
|
||||
ctx->Translate(-gfxPoint(aOffset.x, aOffset.y));
|
||||
gfxUtils::ClipToRegion(ctx, aRegion);
|
||||
ctx->SetColor(aColor);
|
||||
ctx->Paint();
|
||||
nsIntRegionRectIterator iter(aRegion);
|
||||
const nsIntRect* r;
|
||||
while ((r = iter.Next()) != nullptr) {
|
||||
nsIntRect rect = *r + aOffset;
|
||||
gfxUtils::ClearThebesSurface(aSurface, &rect, aColor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -526,17 +527,13 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
|
||||
if (!destinationSurface)
|
||||
return;
|
||||
|
||||
nsRefPtr<gfxContext> context;
|
||||
if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(BackendType::CAIRO)) {
|
||||
RefPtr<DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(destinationSurface,
|
||||
IntSize(destinationSurface->GetSize().width,
|
||||
destinationSurface->GetSize().height));
|
||||
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContentForType(BackendType::CAIRO));
|
||||
RefPtr<DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(destinationSurface,
|
||||
IntSize(destinationSurface->GetSize().width,
|
||||
destinationSurface->GetSize().height));
|
||||
|
||||
context = new gfxContext(dt);
|
||||
} else {
|
||||
context = new gfxContext(destinationSurface);
|
||||
}
|
||||
nsRefPtr<gfxContext> context = new gfxContext(dt);
|
||||
|
||||
context->Translate(gfxPoint(-bounds.x, -bounds.y));
|
||||
LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
|
||||
|
@ -1005,7 +1005,9 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void gfxUtils::ClearThebesSurface(gfxASurface* aSurface)
|
||||
/* static */ void gfxUtils::ClearThebesSurface(gfxASurface* aSurface,
|
||||
nsIntRect* aRect,
|
||||
const gfxRGBA& aColor)
|
||||
{
|
||||
if (aSurface->CairoStatus()) {
|
||||
return;
|
||||
@ -1015,8 +1017,16 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
|
||||
return;
|
||||
}
|
||||
cairo_t* ctx = cairo_create(surf);
|
||||
cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint_with_alpha(ctx, 1.0);
|
||||
cairo_set_source_rgba(ctx, aColor.r, aColor.g, aColor.b, aColor.a);
|
||||
cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
|
||||
nsIntRect bounds;
|
||||
if (aRect) {
|
||||
bounds = *aRect;
|
||||
} else {
|
||||
bounds = nsIntRect(nsIntPoint(0, 0), aSurface->GetSize());
|
||||
}
|
||||
cairo_rectangle(ctx, bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
cairo_fill(ctx);
|
||||
cairo_destroy(ctx);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef GFX_UTILS_H
|
||||
#define GFX_UTILS_H
|
||||
|
||||
#include "gfxColor.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "GraphicsFilter.h"
|
||||
#include "imgIContainer.h"
|
||||
@ -171,9 +172,11 @@ public:
|
||||
int32_t aStride);
|
||||
|
||||
/**
|
||||
* Clears surface to transparent black.
|
||||
* Clears surface to aColor (which defaults to transparent black).
|
||||
*/
|
||||
static void ClearThebesSurface(gfxASurface* aSurface);
|
||||
static void ClearThebesSurface(gfxASurface* aSurface,
|
||||
nsIntRect* aRect = nullptr,
|
||||
const gfxRGBA& aColor = gfxRGBA(0.0, 0.0, 0.0, 0.0));
|
||||
|
||||
/**
|
||||
* Creates a copy of aSurface, but having the SurfaceFormat aFormat.
|
||||
|
Loading…
Reference in New Issue
Block a user