зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1757259 - Fix snapping on surfaces with 180 + 180 deg rotations r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139801
This commit is contained in:
Родитель
09859a423f
Коммит
439765c954
|
@ -1541,13 +1541,6 @@ impl BatchBuilder {
|
|||
let blend_mode = BlendMode::PremultipliedAlpha;
|
||||
let prim_cache_address = gpu_cache.get_address(&ctx.globals.default_image_handle);
|
||||
|
||||
let prim_header = PrimitiveHeader {
|
||||
local_rect: prim_rect,
|
||||
local_clip_rect: prim_info.combined_local_clip_rect,
|
||||
specific_prim_address: prim_cache_address,
|
||||
transform_id,
|
||||
};
|
||||
|
||||
match picture.context_3d {
|
||||
// Convert all children of the 3D hierarchy root into batches.
|
||||
Picture3DContext::In { root_data: Some(_), .. } => {
|
||||
|
@ -1568,6 +1561,45 @@ impl BatchBuilder {
|
|||
|
||||
let surface = &ctx.surfaces[raster_config.surface_index.0];
|
||||
|
||||
// If we are drawing with snapping enabled, the local rect of the prim must be in the raster
|
||||
// space, to avoid situations where there is a 180deg rotation in between the root and primitive
|
||||
// space not being correctly applied.
|
||||
let prim_header = if surface.surface_spatial_node_index == surface.raster_spatial_node_index {
|
||||
PrimitiveHeader {
|
||||
local_rect: prim_rect,
|
||||
local_clip_rect: prim_info.combined_local_clip_rect,
|
||||
specific_prim_address: prim_cache_address,
|
||||
transform_id,
|
||||
}
|
||||
} else {
|
||||
let map_local_to_raster = SpaceMapper::new_with_target(
|
||||
surface.raster_spatial_node_index,
|
||||
surface.surface_spatial_node_index,
|
||||
LayoutRect::max_rect(),
|
||||
ctx.spatial_tree,
|
||||
);
|
||||
|
||||
let prim_rect = map_local_to_raster
|
||||
.map(&prim_rect)
|
||||
.unwrap();
|
||||
let local_clip_rect = map_local_to_raster
|
||||
.map(&prim_info.combined_local_clip_rect)
|
||||
.unwrap();
|
||||
let transform_id = transforms
|
||||
.get_id(
|
||||
surface.raster_spatial_node_index,
|
||||
root_spatial_node_index,
|
||||
ctx.spatial_tree,
|
||||
);
|
||||
|
||||
PrimitiveHeader {
|
||||
local_rect: prim_rect,
|
||||
local_clip_rect,
|
||||
specific_prim_address: prim_cache_address,
|
||||
transform_id,
|
||||
}
|
||||
};
|
||||
|
||||
let mut is_opaque = prim_info.clip_task_index == ClipTaskIndex::INVALID
|
||||
&& surface.is_opaque
|
||||
&& transform_kind == TransformedRectKind::AxisAligned;
|
||||
|
@ -2110,10 +2142,8 @@ impl BatchBuilder {
|
|||
};
|
||||
|
||||
let prim_header = PrimitiveHeader {
|
||||
local_rect: prim_rect,
|
||||
local_clip_rect: prim_info.combined_local_clip_rect,
|
||||
specific_prim_address: prim_cache_address,
|
||||
transform_id,
|
||||
..prim_header
|
||||
};
|
||||
|
||||
let prim_header_index = prim_headers.push(
|
||||
|
|
|
@ -5867,11 +5867,27 @@ impl PicturePrimitive {
|
|||
shadow.blur_radius,
|
||||
);
|
||||
|
||||
let shadow_rect = prim_rect.inflate(
|
||||
let mut shadow_rect = prim_rect.inflate(
|
||||
blur_inflation_x * BLUR_SAMPLE_SCALE,
|
||||
blur_inflation_y * BLUR_SAMPLE_SCALE,
|
||||
).translate(shadow.offset);
|
||||
|
||||
// If we are drawing with snapping enabled, the local rect of the prim must be in the raster
|
||||
// space, to avoid situations where there is a 180deg rotation in between the root and primitive
|
||||
// space not being correctly applied.
|
||||
if surface.surface_spatial_node_index != surface.raster_spatial_node_index {
|
||||
let map_local_to_raster = SpaceMapper::new_with_target(
|
||||
surface.raster_spatial_node_index,
|
||||
surface.surface_spatial_node_index,
|
||||
LayoutRect::max_rect(),
|
||||
frame_context.spatial_tree,
|
||||
);
|
||||
|
||||
shadow_rect = map_local_to_raster
|
||||
.map(&shadow_rect)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// ImageBrush colors
|
||||
request.push(shadow.color.premultiplied());
|
||||
request.push(PremultipliedColorF::WHITE);
|
||||
|
|
|
@ -83,3 +83,5 @@ fuzzy(1,15) platform(linux) force_subpixel_aa_where_possible(false) == text-fixe
|
|||
# despite 4x on-the-fly scale change.
|
||||
skip_on(android) fuzzy(220,7600) == raster_root_C_8192.yaml raster_root_C_ref.yaml
|
||||
== subpx-bg-mask.yaml subpx-bg-mask-ref.yaml
|
||||
platform(linux,mac) == rotate-snap-clip.yaml rotate-snap-clip-ref.yaml
|
||||
platform(linux,mac) == rotate-snap-filter.yaml rotate-snap-filter-ref.yaml
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
id: 2
|
||||
bounds: [0, 0, 400, 30]
|
||||
complex:
|
||||
- rect: [0, 0, 400, 30]
|
||||
radius: {
|
||||
top-left: 2,
|
||||
top-right: 2,
|
||||
bottom-left: 2,
|
||||
bottom-right: 2,
|
||||
}
|
||||
- type: stacking-context
|
||||
clip-node: 2
|
||||
items:
|
||||
- type: stacking-context
|
||||
items:
|
||||
- text: "Should be upright"
|
||||
origin: 20 24
|
||||
size: 18
|
||||
color: black
|
||||
font: "VeraBd.ttf"
|
|
@ -0,0 +1,27 @@
|
|||
# Verify that snapping on a clipped surface with a 180 deg rotation + a local 180 deg rotation works correctly
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
id: 2
|
||||
bounds: [0, 0, 400, 30]
|
||||
complex:
|
||||
- rect: [0, 0, 400, 30]
|
||||
radius: {
|
||||
top-left: 2,
|
||||
top-right: 2,
|
||||
bottom-left: 2,
|
||||
bottom-right: 2,
|
||||
}
|
||||
- type: stacking-context
|
||||
clip-node: 2
|
||||
transform: rotate(180)
|
||||
items:
|
||||
- type: stacking-context
|
||||
transform: rotate(180)
|
||||
items:
|
||||
- text: "Should be upright"
|
||||
origin: 20 24
|
||||
size: 18
|
||||
color: black
|
||||
font: "VeraBd.ttf"
|
|
@ -0,0 +1,14 @@
|
|||
# Verify that snapping on a filtered surface with a 180 deg rotation + a local 180 deg rotation works correctly
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: stacking-context
|
||||
filters: [opacity(0.5)]
|
||||
items:
|
||||
- type: stacking-context
|
||||
items:
|
||||
- text: "Should be upright"
|
||||
origin: 20 24
|
||||
size: 18
|
||||
color: black
|
||||
font: "VeraBd.ttf"
|
|
@ -0,0 +1,16 @@
|
|||
# Verify that snapping on a filtered surface with a 180 deg rotation + a local 180 deg rotation works correctly
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: stacking-context
|
||||
filters: [opacity(0.5)]
|
||||
transform: rotate(180)
|
||||
items:
|
||||
- type: stacking-context
|
||||
transform: rotate(180)
|
||||
items:
|
||||
- text: "Should be upright"
|
||||
origin: 20 24
|
||||
size: 18
|
||||
color: black
|
||||
font: "VeraBd.ttf"
|
Загрузка…
Ссылка в новой задаче