diff --git a/Cargo.lock b/Cargo.lock index 0b90829ef7..e451dc71b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1047,7 +1047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "plane-split" -version = "0.13.4" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1621,7 +1621,7 @@ dependencies = [ "pathfinder_gfx_utils 0.2.0 (git+https://github.com/pcwalton/pathfinder?branch=webrender)", "pathfinder_partitioner 0.2.0 (git+https://github.com/pcwalton/pathfinder?branch=webrender)", "pathfinder_path_utils 0.2.0 (git+https://github.com/pcwalton/pathfinder?branch=webrender)", - "plane-split 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", + "plane-split 0.13.6 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1965,7 +1965,7 @@ dependencies = [ "checksum pathfinder_path_utils 0.2.0 (git+https://github.com/pcwalton/pathfinder?branch=webrender)" = "" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f" -"checksum plane-split 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69f5ea52d7bf50ff02342f5af8527c81030bac5545e92eeeb4a2dfd7bfd2ef69" +"checksum plane-split 0.13.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b84b8cf2daa6a829b3e756fb75e0eab8e0d963754de9bfc83a4373a47121323a" "checksum png 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9adebf7fb91ccf5eac9da1a8e00e83cb8ae882c3e8d8e4ad59da73cb8c82a2c9" "checksum proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" diff --git a/webrender/res/ps_text_run.glsl b/webrender/res/ps_text_run.glsl index 1b3d1d56b0..e042df6a25 100644 --- a/webrender/res/ps_text_run.glsl +++ b/webrender/res/ps_text_run.glsl @@ -81,34 +81,39 @@ VertexInfo write_text_vertex(RectWithSize local_clip_rect, // Compute the snapping offset only if the scroll node transform is axis-aligned. if (remove_subpx_offset) { // Be careful to only snap with the transform when in screen raster space. - if (raster_space == RASTER_SCREEN) { - // Transform from local space to device space. - float device_scale = task.common_data.device_pixel_scale / transform.m[3].w; - mat2 device_transform = mat2(transform.m) * device_scale; + switch (raster_space) { + case RASTER_SCREEN: { + // Transform from local space to device space. + float device_scale = task.common_data.device_pixel_scale / transform.m[3].w; + mat2 device_transform = mat2(transform.m) * device_scale; - // Ensure the transformed text offset does not contain a subpixel translation - // such that glyph snapping is stable for equivalent glyph subpixel positions. - vec2 device_text_pos = device_transform * text_offset + transform.m[3].xy * device_scale; - snap_offset = floor(device_text_pos + 0.5) - device_text_pos; + // Ensure the transformed text offset does not contain a subpixel translation + // such that glyph snapping is stable for equivalent glyph subpixel positions. + vec2 device_text_pos = device_transform * text_offset + transform.m[3].xy * device_scale; + snap_offset = floor(device_text_pos + 0.5) - device_text_pos; - // Snap the glyph offset to a device pixel, using an appropriate bias depending - // on whether subpixel positioning is required. - vec2 device_glyph_offset = device_transform * glyph_offset; - snap_offset += floor(device_glyph_offset + snap_bias) - device_glyph_offset; + // Snap the glyph offset to a device pixel, using an appropriate bias depending + // on whether subpixel positioning is required. + vec2 device_glyph_offset = device_transform * glyph_offset; + snap_offset += floor(device_glyph_offset + snap_bias) - device_glyph_offset; - // Transform from device space back to local space. - local_transform = inverse(device_transform); + // Transform from device space back to local space. + local_transform = inverse(device_transform); #ifndef WR_FEATURE_GLYPH_TRANSFORM - // If not using transformed subpixels, the glyph rect is actually in local space. - // So convert the snap offset back to local space. - snap_offset = local_transform * snap_offset; + // If not using transformed subpixels, the glyph rect is actually in local space. + // So convert the snap offset back to local space. + snap_offset = local_transform * snap_offset; #endif - } else { - // Otherwise, when in local raster space, the transform may be animated, so avoid - // snapping with the transform to avoid oscillation. - snap_offset = floor(text_offset + 0.5) - text_offset; - snap_offset += floor(glyph_offset + snap_bias) - glyph_offset; + break; + } + default: { + // Otherwise, when in local raster space, the transform may be animated, so avoid + // snapping with the transform to avoid oscillation. + snap_offset = floor(text_offset + 0.5) - text_offset; + snap_offset += floor(glyph_offset + snap_bias) - glyph_offset; + break; + } } }