Bug 1730710 - Propagate raster spaces in GPU process r=gw

This actually does two things. One: it lets child stacking contexts inherit out
of process raster spaces by checking the parent stacking context's raster space
inside WR itself, and Two: it mirrors the logic in get_raster_space_for_prim
which undoes the device_pixel_scale for pinch zooms in order to get a
consistent glyph rasterization scale. This second thing won't affect the test
page linked in the bug, but it will affect the performance of, say, animating a
whole browser's scale, which is useful for reasons.

Differential Revision: https://phabricator.services.mozilla.com/D125562
This commit is contained in:
Doug Thayer
2021-10-01 15:12:37 +00:00
parent d7efd82d81
commit 20501215ca
3 changed files with 12 additions and 5 deletions
+1 -2
View File
@@ -133,8 +133,7 @@ StackingContextHelper::StackingContextHelper(
: mBuilder(&aBuilder),
mScale(1.0f, 1.0f),
mDeferredTransformItem(aParams.mDeferredTransformItem),
mRasterizeLocally(aParams.mRasterizeLocally ||
aParentSC.mRasterizeLocally) {
mRasterizeLocally(aParams.mRasterizeLocally) {
MOZ_ASSERT(!aContainerItem || aContainerItem->CreatesStackingContextHelper());
mOrigin = aParentSC.mOrigin + aBounds.TopLeft();
+6 -1
View File
@@ -425,7 +425,12 @@ impl TextRunPrimitive {
RasterSpace::Local(rounded_up / device_pixel_scale.0)
}
} else {
self.requested_raster_space
// Assume that if we have a RasterSpace::Local, it is frequently changing, in which
// case we want to undo the device-pixel scale, as we do above.
match self.requested_raster_space {
RasterSpace::Local(scale) => RasterSpace::Local(scale / device_pixel_scale.0),
RasterSpace::Screen => RasterSpace::Screen,
}
}
}
+5 -2
View File
@@ -1819,8 +1819,11 @@ impl<'a> SceneBuilder<'a> {
) -> StackingContextInfo {
profile_scope!("push_stacking_context");
// Push current requested raster space on stack for prims to access
self.raster_space_stack.push(requested_raster_space);
let new_space = match self.raster_space_stack.last() {
Some(RasterSpace::Local(scale)) => RasterSpace::Local(*scale),
Some(RasterSpace::Screen) | None => requested_raster_space,
};
self.raster_space_stack.push(new_space);
// Get the transform-style of the parent stacking context,
// which determines if we *might* need to draw this on