diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index 767ba9e7d865..c49f6293e0a7 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -1539,6 +1539,7 @@ class DrawTarget : public external::AtomicRefCounted { * Create a similar DrawTarget in the same space as this DrawTarget whose * device size may be clipped based on the active clips intersected with * aBounds (if it is not empty). + * aRect is a rectangle in user space. */ virtual RefPtr CreateClippedDrawTarget(const Rect& aBounds, SurfaceFormat aFormat) = 0; diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 9613f7ea4ede..26f502592497 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -6164,24 +6164,18 @@ void nsDisplayBlendMode::Paint(nsDisplayListBuilder* aBuilder, // been implemented for all DrawTarget backends. DrawTarget* dt = aCtx->GetDrawTarget(); int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - IntRect rect = - IntRect::RoundOut(NSRectToRect(GetPaintRect(), appUnitsPerDevPixel)); - - // Compute the device space rect that we'll draw to, and allocate - // a temporary draw target of that size. - Rect deviceRect = dt->GetTransform().TransformBounds(Rect(rect)); - if (deviceRect.IsEmpty()) { - return; - } + Rect rect = NSRectToRect(GetPaintRect(), appUnitsPerDevPixel); + rect.RoundOut(); + // Create a temporary DrawTarget that is clipped to the area that + // we're going to draw to. This will include the same transform as + // is currently on |dt|. RefPtr temp = - dt->CreateClippedDrawTarget(deviceRect, SurfaceFormat::B8G8R8A8); + dt->CreateClippedDrawTarget(rect, SurfaceFormat::B8G8R8A8); if (!temp) { return; } - // Copy the transform across to the temporary DT so that we - // draw in device space. RefPtr ctx = gfxContext::CreatePreservingTransformOrNull(temp); GetChildren()->Paint(aBuilder, ctx, @@ -6194,7 +6188,8 @@ void nsDisplayBlendMode::Paint(nsDisplayListBuilder* aBuilder, gfxContextMatrixAutoSaveRestore saveMatrix(aCtx); dt->SetTransform(Matrix()); dt->DrawSurface( - surface, deviceRect, deviceRect, DrawSurfaceOptions(), + surface, Rect(surface->GetRect()), Rect(surface->GetRect()), + DrawSurfaceOptions(), DrawOptions(1.0f, nsCSSRendering::GetGFXBlendMode(mBlendMode))); }