Bug 1509304 - Update webrender to commit 5dba919cac858f9b2972bd24e29c9e353c28051d (WR PR #3317). r=kats
authorWR Updater Bot <graphics-team@mozilla.staktrace.com>
Thu, 22 Nov 2018 12:53:13 +0000
changeset 504150 3465a07ac08bd3052fd77cbd2aeffe38bebd8a49
parent 504149 1bb7cd7e79a40d479078aefc5b52bfb7b7d34191
child 504151 cd308694d14f85253f2ad714e09a04136ac1b196
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1509304
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1509304 - Update webrender to commit 5dba919cac858f9b2972bd24e29c9e353c28051d (WR PR #3317). r=kats Differential Revision: https://phabricator.services.mozilla.com/D12647
gfx/webrender/src/glyph_rasterizer/mod.rs
gfx/webrender/src/platform/macos/font.rs
gfx/webrender/src/platform/unix/font.rs
gfx/webrender/src/platform/windows/font.rs
gfx/webrender/src/prim_store.rs
gfx/webrender_bindings/revision.txt
--- a/gfx/webrender/src/glyph_rasterizer/mod.rs
+++ b/gfx/webrender/src/glyph_rasterizer/mod.rs
@@ -277,23 +277,22 @@ impl FontInstance {
             0
         }
     }
 
     pub fn oversized_scale_factor(&self, x_scale: f64, y_scale: f64) -> f64 {
         // If the scaled size is over the limit, then it will need to
         // be scaled up from the size limit to the scaled size.
         // However, this should only occur when the font isn't using any
-        // features that would tie it to device space, like transforms,
-        // subpixel AA, or subpixel positioning.
+        // features that would tie it to device space, like transforms or
+        // subpixel AA.
         let max_size = self.size.to_f64_px() * x_scale.max(y_scale);
         if max_size > FONT_SIZE_LIMIT &&
            self.transform.is_identity() &&
-           self.render_mode != FontRenderMode::Subpixel &&
-           !self.use_subpixel_position()
+           self.render_mode != FontRenderMode::Subpixel
         {
             max_size / FONT_SIZE_LIMIT
         } else {
             1.0
         }
     }
 }
 
--- a/gfx/webrender/src/platform/macos/font.rs
+++ b/gfx/webrender/src/platform/macos/font.rs
@@ -552,18 +552,18 @@ impl FontContext {
             (x_scale, y_scale / x_scale)
         };
 
         let extra_strikes = font.get_extra_strikes(strike_scale / scale);
         let metrics = get_glyph_metrics(
             &ct_font,
             transform.as_ref(),
             glyph,
-            x_offset,
-            y_offset,
+            x_offset / scale,
+            y_offset / scale,
             extra_strikes as f64 * pixel_step,
         );
         if metrics.rasterized_width == 0 || metrics.rasterized_height == 0 {
             return GlyphRasterResult::LoadFailed
         }
 
         let raster_size = Size2D::new(
             metrics.rasterized_width as u32,
@@ -643,18 +643,18 @@ impl FontContext {
             cg_context.set_blend_mode(CGBlendMode::Normal);
 
             // Set the text color and draw the glyphs.
             cg_context.set_rgb_fill_color(text_color, text_color, text_color, 1.0);
             cg_context.set_text_drawing_mode(CGTextDrawingMode::CGTextFill);
 
             // CG Origin is bottom left, WR is top left. Need -y offset
             let mut draw_origin = CGPoint {
-                x: -metrics.rasterized_left as f64 + x_offset,
-                y: metrics.rasterized_descent as f64 - y_offset,
+                x: -metrics.rasterized_left as f64 + x_offset / scale,
+                y: metrics.rasterized_descent as f64 - y_offset / scale,
             };
 
             if let Some(transform) = transform {
                 cg_context.set_text_matrix(&transform);
 
                 draw_origin = draw_origin.apply_transform(&transform.invert());
             } else {
                 // Make sure to reset this because some previous glyph rasterization might have
--- a/gfx/webrender/src/platform/unix/font.rs
+++ b/gfx/webrender/src/platform/unix/font.rs
@@ -370,16 +370,17 @@ impl FontContext {
     }
 
     // Get the bounding box for a glyph, accounting for sub-pixel positioning.
     fn get_bounding_box(
         &self,
         slot: FT_GlyphSlot,
         font: &FontInstance,
         glyph: &GlyphKey,
+        scale: f32,
     ) -> FT_BBox {
         let mut cbox: FT_BBox = unsafe { mem::uninitialized() };
 
         // Get the estimated bounding box from FT (control points).
         unsafe {
             FT_Outline_Get_CBox(&(*slot).outline, &mut cbox);
 
             // For spaces and other non-printable characters, early out.
@@ -399,18 +400,18 @@ impl FontContext {
                 cbox.xMax += padding;
             }
         }
 
         // Offset the bounding box by subpixel positioning.
         // Convert to 26.6 fixed point format for FT.
         let (dx, dy) = font.get_subpx_offset(glyph);
         let (dx, dy) = (
-            (dx * 64.0 + 0.5) as FT_Pos,
-            -(dy * 64.0 + 0.5) as FT_Pos,
+            (dx / scale as f64 * 64.0 + 0.5) as FT_Pos,
+            -(dy / scale as f64 * 64.0 + 0.5) as FT_Pos,
         );
         cbox.xMin += dx;
         cbox.xMax += dx;
         cbox.yMin += dy;
         cbox.yMax += dy;
 
         // Outset the box to device pixel boundaries
         cbox.xMin &= !63;
@@ -421,41 +422,42 @@ impl FontContext {
         cbox
     }
 
     fn get_glyph_dimensions_impl(
         &self,
         slot: FT_GlyphSlot,
         font: &FontInstance,
         glyph: &GlyphKey,
-        use_transform: Option<f32>,
+        scale: f32,
+        use_transform: bool,
     ) -> Option<GlyphDimensions> {
         let format = unsafe { (*slot).format };
         let (mut left, mut top, mut width, mut height) = match format {
             FT_Glyph_Format::FT_GLYPH_FORMAT_BITMAP => {
                 unsafe { (
                     (*slot).bitmap_left as i32,
                     (*slot).bitmap_top as i32,
                     (*slot).bitmap.width as i32,
                     (*slot).bitmap.rows as i32,
                 ) }
             }
             FT_Glyph_Format::FT_GLYPH_FORMAT_OUTLINE => {
-                let cbox = self.get_bounding_box(slot, font, glyph);
+                let cbox = self.get_bounding_box(slot, font, glyph, scale);
                 (
                     (cbox.xMin >> 6) as i32,
                     (cbox.yMax >> 6) as i32,
                     ((cbox.xMax - cbox.xMin) >> 6) as i32,
                     ((cbox.yMax - cbox.yMin) >> 6) as i32,
                 )
             }
             _ => return None,
         };
         let mut advance = unsafe { (*slot).metrics.horiAdvance as f32 / 64.0 };
-        if let Some(scale) = use_transform {
+        if use_transform {
             if scale != 1.0 {
                 let x0 = left as f32 * scale;
                 let x1 = width as f32 * scale + x0;
                 let y1 = top as f32 * scale;
                 let y0 = y1 - height as f32 * scale;
                 left = x0.round() as i32;
                 top = y1.round() as i32;
                 width = (x1.ceil() - x0.floor()) as i32;
@@ -510,17 +512,17 @@ impl FontContext {
     }
 
     pub fn get_glyph_dimensions(
         &mut self,
         font: &FontInstance,
         key: &GlyphKey,
     ) -> Option<GlyphDimensions> {
         let slot = self.load_glyph(font, key);
-        slot.and_then(|(slot, scale)| self.get_glyph_dimensions_impl(slot, font, key, Some(scale)))
+        slot.and_then(|(slot, scale)| self.get_glyph_dimensions_impl(slot, font, key, scale, true))
     }
 
     fn choose_bitmap_size(&self, face: FT_Face, requested_size: f64) -> FT_Error {
         let mut best_dist = unsafe { *(*face).available_sizes.offset(0) }.y_ppem as f64 / 64.0 - requested_size;
         let mut best_size = 0;
         let num_fixed_sizes = unsafe { (*face).num_fixed_sizes };
         for i in 1 .. num_fixed_sizes {
             // Distance is positive if strike is larger than desired size,
@@ -550,22 +552,23 @@ impl FontContext {
         }
     }
 
     fn rasterize_glyph_outline(
         &mut self,
         slot: FT_GlyphSlot,
         font: &FontInstance,
         key: &GlyphKey,
+        scale: f32,
     ) -> bool {
         // Get the subpixel offsets in FT 26.6 format.
         let (dx, dy) = font.get_subpx_offset(key);
         let (dx, dy) = (
-            (dx * 64.0 + 0.5) as FT_Pos,
-            -(dy * 64.0 + 0.5) as FT_Pos,
+            (dx / scale as f64 * 64.0 + 0.5) as FT_Pos,
+            -(dy / scale as f64 * 64.0 + 0.5) as FT_Pos,
         );
 
         // Move the outline curves to be at the origin, taking
         // into account the subpixel positioning.
         unsafe {
             let outline = &(*slot).outline;
             let mut cbox: FT_BBox = mem::uninitialized();
             FT_Outline_Get_CBox(outline, &mut cbox);
@@ -615,32 +618,32 @@ impl FontContext {
         let (slot, scale) = match self.load_glyph(font, key) {
             Some(val) => val,
             None => return GlyphRasterResult::LoadFailed,
         };
 
         // Get dimensions of the glyph, to see if we need to rasterize it.
         // Don't apply scaling to the dimensions, as the glyph cache needs to know the actual
         // footprint of the glyph.
-        let dimensions = match self.get_glyph_dimensions_impl(slot, font, key, None) {
+        let dimensions = match self.get_glyph_dimensions_impl(slot, font, key, scale, false) {
             Some(val) => val,
             None => return GlyphRasterResult::LoadFailed,
         };
         let GlyphDimensions { mut left, mut top, width, height, .. } = dimensions;
 
         // For spaces and other non-printable characters, early out.
         if width == 0 || height == 0 {
             return GlyphRasterResult::LoadFailed;
         }
 
         let format = unsafe { (*slot).format };
         match format {
             FT_Glyph_Format::FT_GLYPH_FORMAT_BITMAP => {}
             FT_Glyph_Format::FT_GLYPH_FORMAT_OUTLINE => {
-                if !self.rasterize_glyph_outline(slot, font, key) {
+                if !self.rasterize_glyph_outline(slot, font, key, scale) {
                     return GlyphRasterResult::LoadFailed;
                 }
             }
             _ => {
                 error!("Unsupported format");
                 debug!("format={:?}", format);
                 return GlyphRasterResult::LoadFailed;
             }
--- a/gfx/webrender/src/platform/windows/font.rs
+++ b/gfx/webrender/src/platform/windows/font.rs
@@ -448,18 +448,18 @@ impl FontContext {
             shape = shape.synthesize_italics(font.synthetic_italics);
         }
         let transform = if !shape.is_identity() || (x_offset, y_offset) != (0.0, 0.0) {
             Some(dwrote::DWRITE_MATRIX {
                 m11: shape.scale_x,
                 m12: shape.skew_y,
                 m21: shape.skew_x,
                 m22: shape.scale_y,
-                dx: x_offset as f32,
-                dy: y_offset as f32,
+                dx: (x_offset / scale) as f32,
+                dy: (y_offset / scale) as f32,
             })
         } else {
             None
         };
 
         let analysis = self.create_glyph_analysis(font, key, size, transform, bitmaps);
         let texture_type = dwrite_texture_type(font.render_mode);
 
--- a/gfx/webrender/src/prim_store.rs
+++ b/gfx/webrender/src/prim_store.rs
@@ -1317,27 +1317,22 @@ impl TextRunPrimitive {
             transform: font_transform,
             size: device_font_size,
             ..specified_font.clone()
         };
 
         // If subpixel AA is disabled due to the backing surface the glyphs
         // are being drawn onto, disable it (unless we are using the
         // specifial subpixel mode that estimates background color).
-        if !allow_subpixel_aa && self.used_font.bg_color.a == 0 {
+        if (!allow_subpixel_aa && self.used_font.bg_color.a == 0) ||
+            // If using local space glyphs, we don't want subpixel AA.
+            !transform_glyphs {
             self.used_font.disable_subpixel_aa();
         }
 
-        // If using local space glyphs, we don't want subpixel AA
-        // or positioning.
-        if !transform_glyphs {
-            self.used_font.disable_subpixel_aa();
-            self.used_font.disable_subpixel_position();
-        }
-
         cache_dirty
     }
 
     fn prepare_for_render(
         &mut self,
         specified_font: &FontInstance,
         glyphs: &[GlyphInstance],
         device_pixel_scale: DevicePixelScale,
--- a/gfx/webrender_bindings/revision.txt
+++ b/gfx/webrender_bindings/revision.txt
@@ -1,1 +1,1 @@
-a749b63f090379d1f854459f64f55a2ca68af0dc
+5dba919cac858f9b2972bd24e29c9e353c28051d