Bug 1513126 - Update webrender to commit a6700dac955d9fe8fc6e68668969b02c2d803dbf (WR PR #3395). r=kats

https://github.com/servo/webrender/pull/3395

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
WR Updater Bot 2018-12-12 13:38:03 +00:00
Родитель 24ae4caadb
Коммит fbbf29aa6e
5 изменённых файлов: 63 добавлений и 15 удалений

Просмотреть файл

@ -1 +1 @@
41c12cabc42228dda6a2d2628c9b24df9aca66b4
a6700dac955d9fe8fc6e68668969b02c2d803dbf

Просмотреть файл

@ -166,6 +166,8 @@ void main(void) {
}
Glyph glyph = fetch_glyph(ph.specific_prim_address, glyph_index);
glyph.offset += ph.local_rect.p0 - text.offset;
GlyphResource res = fetch_glyph_resource(resource_address);
#ifdef WR_FEATURE_GLYPH_TRANSFORM

Просмотреть файл

@ -2340,12 +2340,21 @@ impl<'a> DisplayListFlattener<'a> {
// the primitive key, when the common case is that the
// hash will match and we won't end up creating a new
// primitive template.
let glyphs = display_list.get(glyph_range).collect();
let prim_offset = prim_info.rect.origin.to_vector() - offset;
let glyphs = display_list
.get(glyph_range)
.map(|glyph| {
GlyphInstance {
index: glyph.index,
point: glyph.point - prim_offset,
}
})
.collect();
TextRun {
glyphs,
font,
offset: offset.to_au(),
offset,
shadow: false,
}
};

Просмотреть файл

@ -533,6 +533,39 @@ impl SizeKey {
}
}
/// A hashable vec for using as a key during primitive interning.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Copy, Debug, Clone, PartialEq)]
pub struct VectorKey {
x: f32,
y: f32,
}
impl Eq for VectorKey {}
impl hash::Hash for VectorKey {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.x.to_bits().hash(state);
self.y.to_bits().hash(state);
}
}
impl From<VectorKey> for LayoutVector2D {
fn from(key: VectorKey) -> LayoutVector2D {
LayoutVector2D::new(key.x, key.y)
}
}
impl From<LayoutVector2D> for VectorKey {
fn from(vec: LayoutVector2D) -> VectorKey {
VectorKey {
x: vec.x,
y: vec.y,
}
}
}
/// A hashable point for using as a key during primitive interning.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
@ -2778,6 +2811,7 @@ impl PrimitiveStore {
// The transform only makes sense for screen space rasterization
let transform = prim_context.spatial_node.world_content_transform.to_transform();
let prim_offset = prim_instance.prim_origin.to_vector() - prim_data.offset;
// TODO(gw): This match is a bit untidy, but it should disappear completely
// once the prepare_prims and batching are unified. When that
@ -2785,6 +2819,7 @@ impl PrimitiveStore {
// to temporarily store it in the primitive instance.
let run = &mut self.text_runs[*run_index];
run.prepare_for_render(
prim_offset,
&prim_data.font,
&prim_data.glyphs,
frame_context.device_pixel_scale,

Просмотреть файл

@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{AuHelpers, ColorF, DevicePixelScale, GlyphInstance, LayoutPrimitiveInfo};
use api::{LayoutRect, LayoutToWorldTransform, LayoutVector2DAu, RasterSpace};
use api::Shadow;
use api::{ColorF, DevicePixelScale, GlyphInstance, LayoutPrimitiveInfo};
use api::{LayoutRect, LayoutToWorldTransform, RasterSpace};
use api::{LayoutVector2D, Shadow};
use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
use frame_builder::{FrameBuildingState, PictureContext};
use glyph_rasterizer::{FontInstance, FontTransform, GlyphKey, FONT_SIZE_LIMIT};
use gpu_cache::GpuCache;
use intern;
use prim_store::{PrimitiveOpacity, PrimitiveSceneData, PrimitiveScratchBuffer};
use prim_store::{PrimitiveStore, PrimKeyCommonData, PrimTemplateCommonData};
use prim_store::{PrimitiveStore, PrimKeyCommonData, PrimTemplateCommonData, VectorKey};
use render_task::{RenderTaskTree};
use renderer::{MAX_VERTEX_TEXTURE_WIDTH};
use resource_cache::{ResourceCache};
@ -28,7 +28,7 @@ use storage;
pub struct TextRunKey {
pub common: PrimKeyCommonData,
pub font: FontInstance,
pub offset: LayoutVector2DAu,
pub offset: VectorKey,
pub glyphs: Vec<GlyphInstance>,
pub shadow: bool,
}
@ -75,7 +75,7 @@ impl AsInstanceKind<TextRunDataHandle> for TextRunKey {
pub struct TextRunTemplate {
pub common: PrimTemplateCommonData,
pub font: FontInstance,
pub offset: LayoutVector2DAu,
pub offset: LayoutVector2D,
pub glyphs: Vec<GlyphInstance>,
}
@ -98,7 +98,7 @@ impl From<TextRunKey> for TextRunTemplate {
TextRunTemplate {
common,
font: item.font,
offset: item.offset,
offset: item.offset.into(),
glyphs: item.glyphs,
}
}
@ -127,8 +127,8 @@ impl TextRunTemplate {
let bg_color = ColorF::from(self.font.bg_color);
request.push([bg_color.r, bg_color.g, bg_color.b, 1.0]);
request.push([
self.offset.x.to_f32_px(),
self.offset.y.to_f32_px(),
self.offset.x,
self.offset.y,
0.0,
0.0,
]);
@ -170,7 +170,7 @@ pub type TextRunDataInterner = intern::Interner<TextRunKey, PrimitiveSceneData,
pub struct TextRun {
pub font: FontInstance,
pub offset: LayoutVector2DAu,
pub offset: LayoutVector2D,
pub glyphs: Vec<GlyphInstance>,
pub shadow: bool,
}
@ -208,7 +208,7 @@ impl CreateShadow for TextRun {
TextRun {
font,
glyphs: self.glyphs.clone(),
offset: self.offset + shadow.offset.to_au(),
offset: self.offset + shadow.offset,
shadow: true
}
}
@ -287,6 +287,7 @@ impl TextRunPrimitive {
pub fn prepare_for_render(
&mut self,
prim_offset: LayoutVector2D,
specified_font: &FontInstance,
glyphs: &[GlyphInstance],
device_pixel_scale: DevicePixelScale,
@ -311,7 +312,8 @@ impl TextRunPrimitive {
self.glyph_keys_range = scratch.glyph_keys.extend(
glyphs.iter().map(|src| {
let world_offset = self.used_font.transform.transform(&src.point);
let src_point = src.point + prim_offset;
let world_offset = self.used_font.transform.transform(&src_point);
let device_offset = device_pixel_scale.transform_point(&world_offset);
GlyphKey::new(src.index, device_offset, subpx_dir)
}));