зеркало из https://github.com/mozilla/gecko-dev.git
Bug 844819 - Don't create DrawTargets for invalid cairo surfaces. r=Bas
This commit is contained in:
Родитель
b9c3d10afd
Коммит
b721789ba1
|
@ -575,6 +575,10 @@ gfxContext::DrawSurface(gfxASurface *surface, const gfxSize& size)
|
||||||
RefPtr<SourceSurface> surf =
|
RefPtr<SourceSurface> surf =
|
||||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
||||||
|
|
||||||
|
if (!surf) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Rect rect(0, 0, Float(size.width), Float(size.height));
|
Rect rect(0, 0, Float(size.width), Float(size.height));
|
||||||
rect.Intersect(Rect(0, 0, Float(surf->GetSize().width), Float(surf->GetSize().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().sourceSurfCairo = surface;
|
||||||
CurrentState().sourceSurface =
|
CurrentState().sourceSurface =
|
||||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
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 =
|
RefPtr<SourceSurface> sourceSurf =
|
||||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
|
||||||
|
|
||||||
|
if (!sourceSurf) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gfxPoint pt = surface->GetDeviceOffset();
|
gfxPoint pt = surface->GetDeviceOffset();
|
||||||
|
|
||||||
// We clip here to bind to the mask surface bounds, see above.
|
// We clip here to bind to the mask surface bounds, see above.
|
||||||
|
|
|
@ -641,6 +641,10 @@ gfxPlatform::ClearSourceSurfaceForSurface(gfxASurface *aSurface)
|
||||||
RefPtr<SourceSurface>
|
RefPtr<SourceSurface>
|
||||||
gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface)
|
gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface)
|
||||||
{
|
{
|
||||||
|
if (!aSurface->CairoSurface() || aSurface->CairoStatus()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void *userData = aSurface->GetData(&kSourceSurface);
|
void *userData = aSurface->GetData(&kSourceSurface);
|
||||||
|
|
||||||
if (userData) {
|
if (userData) {
|
||||||
|
@ -737,10 +741,6 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||||
// alive. This is true if gfxASurface actually -is- an ImageSurface or
|
// alive. This is true if gfxASurface actually -is- an ImageSurface or
|
||||||
// if it is a gfxWindowsSurface which supports GetAsImageSurface.
|
// if it is a gfxWindowsSurface which supports GetAsImageSurface.
|
||||||
if (imgSurface != aSurface && !isWin32ImageSurf) {
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче