mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1051592 - Clip DrawTargetCairo's context to the surface bound to prevent massive mask allocations within cairo. r=jrmuizel
--HG-- extra : rebase_source : 89bc9dd9c4d5120c73b025d5106827594fac6663
This commit is contained in:
parent
f418beb13f
commit
f4ffbf1eae
@ -68,7 +68,14 @@ public:
|
||||
MOZ_ASSERT(cairo_status(mCtx) || dt->GetTransform() == GetTransform());
|
||||
}
|
||||
|
||||
~AutoPrepareForDrawing() { cairo_restore(mCtx); }
|
||||
~AutoPrepareForDrawing()
|
||||
{
|
||||
cairo_restore(mCtx);
|
||||
cairo_status_t status = cairo_status(mCtx);
|
||||
if (status) {
|
||||
gfxWarning() << "DrawTargetCairo context in error state: " << cairo_status_to_string(status) << "(" << status << ")";
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
@ -1290,6 +1297,13 @@ DrawTargetCairo::InitAlreadyReferenced(cairo_surface_t* aSurface, const IntSize&
|
||||
mSize = aSize;
|
||||
mFormat = aFormat ? *aFormat : CairoContentToGfxFormat(cairo_surface_get_content(aSurface));
|
||||
|
||||
// Cairo image surface have a bug where they will allocate a mask surface (for clipping)
|
||||
// the size of the clip extents, and don't take the surface extents into account.
|
||||
// Add a manual clip to the surface extents to prevent this.
|
||||
cairo_new_path(mContext);
|
||||
cairo_rectangle(mContext, 0, 0, mSize.width, mSize.height);
|
||||
cairo_clip(mContext);
|
||||
|
||||
if (mFormat == SurfaceFormat::B8G8R8A8 ||
|
||||
mFormat == SurfaceFormat::R8G8B8A8) {
|
||||
SetPermitSubpixelAA(false);
|
||||
|
Loading…
Reference in New Issue
Block a user