Bug 1714275 - Establish raster roots for picture cache tiles. r=gfx-reviewers,kvark

This will allow us to select either rasterizing the tiles with a
scale factor of 1.0 (for high performance mode) or at the current
scale of the pinch-zoom (for high quality mode).

Differential Revision: https://phabricator.services.mozilla.com/D116796
This commit is contained in:
Glenn Watson 2021-06-09 21:41:01 +00:00
Родитель ab34bfc22f
Коммит adb325ac13
2 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -24,7 +24,7 @@ fuzzy-if(webrender,2-7,17500-36908) == 1523776.html 1523776-ref.html
== bug1523410-translate-scale-snap.html bug1523410-translate-scale-snap-ref.html
== 1523080.html 1523080-ref.html
== 1616444-same-color-different-paths.html 1616444-same-color-different-paths-ref.html
skip-if(!asyncPan||!webrender||Android) fuzzy-if(winWidget,94-94,3415-3419) fuzzy-if(cocoaWidget&&swgl,1-1,1-1) pref(apz.allow_zooming,true) == picture-caching-on-async-zoom.html picture-caching-on-async-zoom.html?ref
skip-if(!asyncPan||!webrender||Android) fuzzy-if(winWidget,94-94,3415-3419) fuzzy-if(cocoaWidget,24-24,1190-1200) pref(apz.allow_zooming,true) == picture-caching-on-async-zoom.html picture-caching-on-async-zoom.html?ref
pref(apz.allow_zooming,true) fails-if(useDrawSnapshot) == 1662062-1-no-blurry.html 1662062-1-ref.html
== 1681610.html 1681610-ref.html
skip-if(!webrender||geckoview) fuzzy-if(webrender&&!geckoview,0-255,0-61) == 1687157-1.html 1687157-1-ref.html

Просмотреть файл

@ -5125,7 +5125,13 @@ impl PicturePrimitive {
}
}
let content_origin_f = tile.world_tile_rect.min * device_pixel_scale;
// The cast_unit() here is because the `content_origin` is expected to be in
// device pixels, however we're establishing raster roots for picture cache
// tiles meaning the `content_origin` needs to be in the local space of that root.
// TODO(gw): `content_origin` should actually be in RasterPixels to be consistent
// with both local / screen raster modes, but this involves a lot of
// changes to render task and picture code.
let content_origin_f = tile.local_tile_rect.origin.cast_unit() * device_pixel_scale;
let content_origin = content_origin_f.round();
debug_assert!((content_origin_f.x - content_origin.x).abs() < 0.01);
debug_assert!((content_origin_f.y - content_origin.y).abs() < 0.01);
@ -6247,13 +6253,20 @@ impl PicturePrimitive {
let surface_to_parent_transform = frame_context.spatial_tree
.get_relative_transform(surface_spatial_node_index, parent_raster_node_index);
// Currently, we ensure that the scaling factor is >= 1.0 as a smaller scale factor can result in blurry output.
let mut min_scale = 1.0;
// Check if there is perspective or if an SVG filter is applied, and thus whether a new
// rasterization root should be established.
let establishes_raster_root = match composite_mode {
PictureCompositeMode::TileCache { .. } => {
// Picture caches are special cased - they never need to establish a raster root. In future,
// we will probably remove TileCache as a specific composite mode.
false
// We may need to minify when zooming out picture cache tiles
min_scale = 0.0;
// We know that picture cache tiles are always axis-aligned, but we want to establish
// raster roots for them, so that we can easily control the scale factors used depending
// on whether we want to zoom in high-performance or high-quality mode.
true
}
PictureCompositeMode::SvgFilter(..) => {
// Filters must be applied before transforms, to do this, we can mark this picture as establishing a raster root.
@ -6274,8 +6287,7 @@ impl PicturePrimitive {
let scale_factors = surface_to_parent_transform.scale_factors();
// Pick the largest scale factor of the transform for the scaling factor.
// Currently, we ensure that the scaling factor is >= 1.0 as a smaller scale factor can result in blurry output.
let scaling_factor = scale_factors.0.max(scale_factors.1).max(1.0);
let scaling_factor = scale_factors.0.max(scale_factors.1).max(min_scale);
let device_pixel_scale = parent_device_pixel_scale * Scale::new(scaling_factor);
(surface_spatial_node_index, device_pixel_scale)