mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 844819 - Don't create DrawTargets for invalid cairo surfaces. r=Bas
This commit is contained in:
parent
f1e0403e39
commit
7eebb50480
@ -575,6 +575,10 @@ gfxContext::DrawSurface(gfxASurface *surface, const gfxSize& size)
|
||||
RefPtr<SourceSurface> surf =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
||||
|
||||
if (!surf) {
|
||||
return;
|
||||
}
|
||||
|
||||
Rect rect(0, 0, Float(size.width), Float(size.height));
|
||||
rect.Intersect(Rect(0, 0, Float(surf->GetSize().width), Float(surf->GetSize().height)));
|
||||
|
||||
@ -1389,6 +1393,7 @@ gfxContext::SetSource(gfxASurface *surface, const gfxPoint& offset)
|
||||
CurrentState().sourceSurfCairo = surface;
|
||||
CurrentState().sourceSurface =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
||||
CurrentState().color = Color(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1492,6 +1497,10 @@ gfxContext::Mask(gfxASurface *surface, const gfxPoint& offset)
|
||||
RefPtr<SourceSurface> sourceSurf =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
||||
|
||||
if (!sourceSurf) {
|
||||
return;
|
||||
}
|
||||
|
||||
gfxPoint pt = surface->GetDeviceOffset();
|
||||
|
||||
// We clip here to bind to the mask surface bounds, see above.
|
||||
|
@ -641,6 +641,10 @@ gfxPlatform::ClearSourceSurfaceForSurface(gfxASurface *aSurface)
|
||||
RefPtr<SourceSurface>
|
||||
gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface)
|
||||
{
|
||||
if (!aSurface->CairoSurface() || aSurface->CairoStatus()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *userData = aSurface->GetData(&kSourceSurface);
|
||||
|
||||
if (userData) {
|
||||
@ -737,10 +741,6 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
// alive. This is true if gfxASurface actually -is- an ImageSurface or
|
||||
// if it is a gfxWindowsSurface which supports GetAsImageSurface.
|
||||
if (imgSurface != aSurface && !isWin32ImageSurf) {
|
||||
// This shouldn't happen for now, it can be easily supported by making
|
||||
// a copy. For now let's just abort.
|
||||
NS_RUNTIMEABORT("Attempt to create unsupported SourceSurface from"
|
||||
"non-image surface.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user