зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
a5c1a27839
Коммит
0e61a0217b
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче