tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 96e2aa51411081ea22782a69955b9a5a7863259d
parent 4dbd5f7251183fe6834de68a35fff20d0b1f6076
Author: Glenn Watson <git@chillybin.org>
Date:   Thu, 11 Dec 2025 08:20:13 +0000

Bug 2005426 - Remove SubpixelDirection::Mixed for glyph rasterization r=gfx-reviewers,nical

These cases are rare, but can cause a lot of extra glyph rasterization
(up to 16 variants). It's worth the miniscule quality tradeoff for some
future work to select offsets in the shader to remove this case.

Differential Revision: https://phabricator.services.mozilla.com/D275909

Diffstat:
Mgfx/wr/webrender/res/prim_shared.glsl | 1-
Mgfx/wr/webrender/res/ps_text_run.glsl | 2--
Mgfx/wr/webrender/src/batch.rs | 1-
Mgfx/wr/wr_glyph_rasterizer/src/rasterizer.rs | 8+++-----
Mgfx/wr/wrench/reftests/text/alpha-transform.png | 0
Mgfx/wr/wrench/reftests/text/clipped-transform.png | 0
Mgfx/wr/wrench/reftests/text/raster-space.png | 0
Mgfx/wr/wrench/reftests/text/reftest.list | 6+++---
Mgfx/wr/wrench/reftests/text/shadow-transforms.png | 0
Mgfx/wr/wrench/reftests/text/subpixel-rotate.png | 0
10 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/gfx/wr/webrender/res/prim_shared.glsl b/gfx/wr/webrender/res/prim_shared.glsl @@ -10,7 +10,6 @@ #define SUBPX_DIR_NONE 0 #define SUBPX_DIR_HORIZONTAL 1 #define SUBPX_DIR_VERTICAL 2 -#define SUBPX_DIR_MIXED 3 #define RASTER_LOCAL 0 #define RASTER_SCREEN 1 diff --git a/gfx/wr/webrender/res/ps_text_run.glsl b/gfx/wr/webrender/res/ps_text_run.glsl @@ -90,8 +90,6 @@ vec2 get_snap_bias(int subpx_dir) { return vec2(0.125, 0.5); case SUBPX_DIR_VERTICAL: return vec2(0.5, 0.125); - case SUBPX_DIR_MIXED: - return vec2(0.125); } } diff --git a/gfx/wr/webrender/src/batch.rs b/gfx/wr/webrender/src/batch.rs @@ -1904,7 +1904,6 @@ impl BatchBuilder { SubpixelDirection::None => DeviceVector2D::new(0.5, 0.5), SubpixelDirection::Horizontal => DeviceVector2D::new(0.125, 0.5), SubpixelDirection::Vertical => DeviceVector2D::new(0.5, 0.125), - SubpixelDirection::Mixed => DeviceVector2D::new(0.125, 0.125), }; let text_offset = prim_header.local_rect.max.to_vector(); diff --git a/gfx/wr/wr_glyph_rasterizer/src/rasterizer.rs b/gfx/wr/wr_glyph_rasterizer/src/rasterizer.rs @@ -380,8 +380,8 @@ impl FontTransform { // The X axis has been swapped with the Y axis SubpixelDirection::Vertical } else { - // Use subpixel precision on all axes - SubpixelDirection::Mixed + // Mixed transforms get no subpixel positioning + SubpixelDirection::None } } } @@ -1032,7 +1032,6 @@ pub enum SubpixelDirection { None = 0, Horizontal, Vertical, - Mixed, } impl SubpixelDirection { @@ -1047,7 +1046,7 @@ impl SubpixelDirection { pub fn swap_xy(self) -> Self { match self { - SubpixelDirection::None | SubpixelDirection::Mixed => self, + SubpixelDirection::None => self, SubpixelDirection::Horizontal => SubpixelDirection::Vertical, SubpixelDirection::Vertical => SubpixelDirection::Horizontal, } @@ -1114,7 +1113,6 @@ impl GlyphKey { SubpixelDirection::None => (0.0, 0.0), SubpixelDirection::Horizontal => (point.x, 0.0), SubpixelDirection::Vertical => (0.0, point.y), - SubpixelDirection::Mixed => (point.x, point.y), }; let sox = SubpixelOffset::quantize(dx); let soy = SubpixelOffset::quantize(dy); diff --git a/gfx/wr/wrench/reftests/text/alpha-transform.png b/gfx/wr/wrench/reftests/text/alpha-transform.png Binary files differ. diff --git a/gfx/wr/wrench/reftests/text/clipped-transform.png b/gfx/wr/wrench/reftests/text/clipped-transform.png Binary files differ. diff --git a/gfx/wr/wrench/reftests/text/raster-space.png b/gfx/wr/wrench/reftests/text/raster-space.png Binary files differ. diff --git a/gfx/wr/wrench/reftests/text/reftest.list b/gfx/wr/wrench/reftests/text/reftest.list @@ -41,14 +41,14 @@ platform(linux) options(disable-subpixel) == border-radius.yaml border-radius-al platform(linux) == border-radius.yaml border-radius-subpx.png options(disable-aa) == transparent-no-aa.yaml transparent-no-aa-ref.yaml != diacritics.yaml diacritics-ref.yaml -fuzzy(1,30) platform(linux) options(disable-subpixel) == alpha-transform.yaml alpha-transform.png -fuzzy(1,20) platform(linux) == subpixel-rotate.yaml subpixel-rotate.png +fuzzy(1,42) platform(linux) options(disable-subpixel) == alpha-transform.yaml alpha-transform.png +fuzzy(1,39) platform(linux) == subpixel-rotate.yaml subpixel-rotate.png fuzzy(1,72) platform(linux) == subpixel-scale.yaml subpixel-scale.png fuzzy(1,26) platform(linux) == subpixel-skew.yaml subpixel-skew.png fuzzy(1,381) platform(linux) == subpixel-translate.yaml subpixel-translate-ref.yaml != shadow-rotate.yaml blank.yaml platform(linux) == embedded-bitmaps.yaml embedded-bitmaps.png -fuzzy(1,13) platform(linux) == clipped-transform.yaml clipped-transform.png +fuzzy(1,21) platform(linux) == clipped-transform.yaml clipped-transform.png platform(mac) fuzzy(195,30) == color-bitmap-shadow.yaml color-bitmap-shadow-ref.yaml platform(linux) == writing-modes.yaml writing-modes-ref.yaml fuzzy(1,5) platform(linux) == blurred-shadow-local-clip-rect.yaml blurred-shadow-local-clip-rect-ref.png diff --git a/gfx/wr/wrench/reftests/text/shadow-transforms.png b/gfx/wr/wrench/reftests/text/shadow-transforms.png Binary files differ. diff --git a/gfx/wr/wrench/reftests/text/subpixel-rotate.png b/gfx/wr/wrench/reftests/text/subpixel-rotate.png Binary files differ.