Skip to content

Commit 0c2b149

Browse files
lsalzmanwrupdater
authored and
wrupdater
committed
Bug 1512010 - backing out local raster space text snapping change. r=jrmuizel
[wrupdater] From https://hg.mozilla.org/mozilla-central/rev/2bf2c209f520c75405b70ed5a5a12c2a8938dffe
1 parent b966bbe commit 0c2b149

File tree

8 files changed

+7
-37
lines changed

8 files changed

+7
-37
lines changed

webrender/res/ps_text_run.glsl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ TextRun fetch_text_run(int address) {
6363

6464
VertexInfo write_text_vertex(RectWithSize local_clip_rect,
6565
float z,
66-
bool should_snap,
6766
Transform transform,
6867
PictureTask task,
6968
vec2 text_offset,
@@ -74,8 +73,13 @@ VertexInfo write_text_vertex(RectWithSize local_clip_rect,
7473
vec2 snap_offset = vec2(0.0);
7574
mat2 local_transform;
7675

76+
#ifdef WR_FEATURE_GLYPH_TRANSFORM
77+
bool remove_subpx_offset = true;
78+
#else
79+
bool remove_subpx_offset = transform.is_axis_aligned;
80+
#endif
7781
// Compute the snapping offset only if the scroll node transform is axis-aligned.
78-
if (should_snap) {
82+
if (remove_subpx_offset) {
7983
// Transform from local space to device space.
8084
float device_scale = task.common_data.device_pixel_scale / transform.m[3].w;
8185
mat2 device_transform = mat2(transform.m) * device_scale;
@@ -174,18 +178,13 @@ void main(void) {
174178
RectWithSize glyph_rect = RectWithSize(res.offset + glyph_transform * (text.offset + glyph.offset),
175179
res.uv_rect.zw - res.uv_rect.xy);
176180

177-
// Since the glyph is pre-transformed, snapping is both forced and does not depend on the transform.
178-
bool should_snap = true;
179181
#else
180182
// Scale from glyph space to local space.
181183
float scale = res.scale / task.common_data.device_pixel_scale;
182184

183185
// Compute the glyph rect in local space.
184186
RectWithSize glyph_rect = RectWithSize(scale * res.offset + text.offset + glyph.offset,
185187
scale * (res.uv_rect.zw - res.uv_rect.xy));
186-
187-
// Check if the primitive is actually safe to snap.
188-
bool should_snap = ph.user_data.x != 0;
189188
#endif
190189

191190
vec2 snap_bias;
@@ -215,7 +214,6 @@ void main(void) {
215214

216215
VertexInfo vi = write_text_vertex(ph.local_clip_rect,
217216
ph.z,
218-
should_snap,
219217
transform,
220218
task,
221219
text.offset,

webrender/src/batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ impl AlphaBatchBuilder {
829829
}
830830
};
831831

832-
let prim_header_index = prim_headers.push(&prim_header, z_id, [run.should_snap as i32, 0, 0]);
832+
let prim_header_index = prim_headers.push(&prim_header, z_id, [0; 3]);
833833
let key = BatchKey::new(kind, blend_mode, textures);
834834
let base_instance = GlyphInstance::new(
835835
prim_header_index,

webrender/src/prim_store/text_run.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ impl AsInstanceKind<TextRunDataHandle> for TextRunKey {
6565
used_font: self.font.clone(),
6666
glyph_keys_range: storage::Range::empty(),
6767
shadow: self.shadow,
68-
should_snap: true,
6968
});
7069

7170
PrimitiveInstanceKind::TextRun{ data_handle, run_index }
@@ -228,7 +227,6 @@ pub struct TextRunPrimitive {
228227
pub used_font: FontInstance,
229228
pub glyph_keys_range: storage::Range<GlyphKey>,
230229
pub shadow: bool,
231-
pub should_snap: bool,
232230
}
233231

234232
impl TextRunPrimitive {
@@ -264,11 +262,6 @@ impl TextRunPrimitive {
264262
FontTransform::identity()
265263
};
266264

267-
// We can snap only if the transform is axis-aligned and in screen-space.
268-
self.should_snap =
269-
transform.preserves_2d_axis_alignment() &&
270-
raster_space == RasterSpace::Screen;
271-
272265
// If the transform or device size is different, then the caller of
273266
// this method needs to know to rebuild the glyphs.
274267
let cache_dirty =
Loading

wrench/reftests/text/raster-space-snap-ref.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

wrench/reftests/text/raster-space-snap.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

wrench/reftests/text/reftest.list

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,3 @@ fuzzy(1,113) platform(linux) == raster-space.yaml raster-space.png
6868
== shadow-image.yaml shadow-solid-ref.yaml
6969
options(disable-aa) == snap-clip.yaml snap-clip-ref.yaml
7070
platform(linux) == perspective-clip.yaml perspective-clip.png
71-
options(disable-subpixel) != raster-space-snap.yaml raster-space-snap-ref.yaml

wrench/reftests/text/two-shadows.png

-159 Bytes
Loading

0 commit comments

Comments
 (0)