зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1720429
- CreateClippedDrawTarget takes a rect in user space. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D120135
This commit is contained in:
Родитель
f36ae46161
Коммит
81dcdf515d
|
@ -1539,6 +1539,7 @@ class DrawTarget : public external::AtomicRefCounted<DrawTarget> {
|
|||
* 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<DrawTarget> CreateClippedDrawTarget(const Rect& aBounds,
|
||||
SurfaceFormat aFormat) = 0;
|
||||
|
|
|
@ -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<DrawTarget> 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<gfxContext> 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)));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче