зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1405399 - Update webrender to commit a884e676449e5b41669cd6de51af14e70cbe3512. r=Gankro
MozReview-Commit-ID: AABRgb2Ruds --HG-- extra : rebase_source : a684696378a40bca275034f5fb8b6de7f6531613
This commit is contained in:
Родитель
155c57e385
Коммит
f079e04ec7
|
@ -79,4 +79,4 @@ to make sure that mozjs_sys also has its Cargo.lock file updated if needed, henc
|
|||
the need to run the cargo update command in js/src as well. Hopefully this will
|
||||
be resolved soon.
|
||||
|
||||
Latest Commit: aa81aebba2c1b8ff8af5d40796154d66349fd131
|
||||
Latest Commit: a884e676449e5b41669cd6de51af14e70cbe3512
|
||||
|
|
|
@ -43,6 +43,8 @@ void main(void) {
|
|||
|
||||
// Whether to repeat the gradient instead of clamping.
|
||||
vGradientRepeat = float(int(gradient.extend_mode.x) != EXTEND_MODE_CLAMP);
|
||||
|
||||
write_clip(vi.screen_pos, prim.clip_area);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -57,8 +59,21 @@ void main(void) {
|
|||
|
||||
float offset = dot(pos - vStartPoint, vScaledDir);
|
||||
|
||||
oFragColor = sample_gradient(vGradientAddress,
|
||||
vec4 color = sample_gradient(vGradientAddress,
|
||||
offset,
|
||||
vGradientRepeat);
|
||||
|
||||
// Un-premultiply the color from sampling the gradient.
|
||||
if (color.a > 0.0) {
|
||||
color.rgb /= color.a;
|
||||
|
||||
// Apply the clip mask
|
||||
color.a = min(color.a, do_clip());
|
||||
|
||||
// Pre-multiply the result.
|
||||
color.rgb *= color.a;
|
||||
}
|
||||
|
||||
oFragColor = color;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -91,10 +91,12 @@ void main(void) {
|
|||
|
||||
// We clamp the texture coordinate calculation here to the local rectangle boundaries,
|
||||
// which makes the edge of the texture stretch instead of repeat.
|
||||
vec2 upper_bound_mask = step(vLocalRect.zw, pos);
|
||||
vec2 relative_pos_in_rect = clamp(pos, vLocalRect.xy, vLocalRect.zw) - vLocalRect.xy;
|
||||
#else
|
||||
float alpha = 1.0;
|
||||
vec2 relative_pos_in_rect = vLocalPos;
|
||||
vec2 upper_bound_mask = vec2(0.0);
|
||||
#endif
|
||||
|
||||
alpha = min(alpha, do_clip());
|
||||
|
@ -102,7 +104,12 @@ void main(void) {
|
|||
// We calculate the particular tile this fragment belongs to, taking into
|
||||
// account the spacing in between tiles. We only paint if our fragment does
|
||||
// not fall into that spacing.
|
||||
vec2 position_in_tile = mod(relative_pos_in_rect, vStretchSize + vTileSpacing);
|
||||
// If the pixel is at the local rectangle upper bound, we force the current
|
||||
// tile upper bound in order to avoid wrapping.
|
||||
vec2 position_in_tile = mix(
|
||||
mod(relative_pos_in_rect, vStretchSize + vTileSpacing),
|
||||
vStretchSize,
|
||||
upper_bound_mask);
|
||||
vec2 st = vTextureOffset + ((position_in_tile / vStretchSize) * vTextureSize);
|
||||
st = clamp(st, vStRect.xy, vStRect.zw);
|
||||
|
||||
|
|
|
@ -800,15 +800,15 @@ impl Frame {
|
|||
SpecificDisplayItem::PopStackingContext => {
|
||||
unreachable!("Should have returned in parent method.")
|
||||
}
|
||||
SpecificDisplayItem::PushTextShadow(shadow) => {
|
||||
SpecificDisplayItem::PushShadow(shadow) => {
|
||||
let mut prim_info = prim_info.clone();
|
||||
prim_info.rect = LayerRect::zero();
|
||||
context
|
||||
.builder
|
||||
.push_text_shadow(shadow, clip_and_scroll, &prim_info);
|
||||
.push_shadow(shadow, clip_and_scroll, &prim_info);
|
||||
}
|
||||
SpecificDisplayItem::PopTextShadow => {
|
||||
context.builder.pop_text_shadow();
|
||||
SpecificDisplayItem::PopShadow => {
|
||||
context.builder.pop_shadow();
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
|
@ -10,7 +10,7 @@ use api::{GlyphInstance, GlyphOptions, GradientStop, HitTestFlags, HitTestItem,
|
|||
use api::{ImageKey, ImageRendering, ItemRange, ItemTag, LayerPoint, LayerPrimitiveInfo, LayerRect};
|
||||
use api::{LayerSize, LayerToScrollTransform, LayerVector2D, LayoutVector2D, LineOrientation};
|
||||
use api::{LineStyle, LocalClip, POINT_RELATIVE_TO_PIPELINE_VIEWPORT, PipelineId, RepeatMode};
|
||||
use api::{ScrollSensitivity, SubpixelDirection, TextShadow, TileOffset, TransformStyle};
|
||||
use api::{ScrollSensitivity, SubpixelDirection, Shadow, TileOffset, TransformStyle};
|
||||
use api::{WorldPixel, WorldPoint, YuvColorSpace, YuvData, device_length};
|
||||
use app_units::Au;
|
||||
use border::ImageBorderSegment;
|
||||
|
@ -26,7 +26,7 @@ use prim_store::{BoxShadowPrimitiveCpu, TexelRect, YuvImagePrimitiveCpu};
|
|||
use prim_store::{GradientPrimitiveCpu, ImagePrimitiveCpu, LinePrimitive, PrimitiveKind};
|
||||
use prim_store::{PrimitiveContainer, PrimitiveIndex};
|
||||
use prim_store::{PrimitiveStore, RadialGradientPrimitiveCpu};
|
||||
use prim_store::{RectanglePrimitive, TextRunPrimitiveCpu, TextShadowPrimitiveCpu};
|
||||
use prim_store::{RectanglePrimitive, TextRunPrimitiveCpu, ShadowPrimitiveCpu};
|
||||
use profiler::{FrameProfileCounters, GpuCacheProfileCounters, TextureCacheProfileCounters};
|
||||
use render_task::{AlphaRenderItem, ClipWorkItem, RenderTask};
|
||||
use render_task::{RenderTaskId, RenderTaskLocation, RenderTaskTree};
|
||||
|
@ -100,7 +100,7 @@ pub struct FrameBuilder {
|
|||
clip_scroll_group_indices: FastHashMap<ClipAndScrollInfo, usize>,
|
||||
packed_layers: Vec<PackedLayer>,
|
||||
|
||||
// A stack of the current text-shadow primitives.
|
||||
// A stack of the current shadow primitives.
|
||||
shadow_prim_stack: Vec<PrimitiveIndex>,
|
||||
|
||||
scrollbar_prims: Vec<ScrollbarPrimitive>,
|
||||
|
@ -578,33 +578,33 @@ impl FrameBuilder {
|
|||
self.reference_frame_stack.pop();
|
||||
}
|
||||
|
||||
pub fn push_text_shadow(
|
||||
pub fn push_shadow(
|
||||
&mut self,
|
||||
shadow: TextShadow,
|
||||
shadow: Shadow,
|
||||
clip_and_scroll: ClipAndScrollInfo,
|
||||
info: &LayerPrimitiveInfo,
|
||||
) {
|
||||
let prim = TextShadowPrimitiveCpu {
|
||||
let prim = ShadowPrimitiveCpu {
|
||||
shadow,
|
||||
primitives: Vec::new(),
|
||||
render_task_id: None,
|
||||
};
|
||||
|
||||
// Create an empty text-shadow primitive. Insert it into
|
||||
// Create an empty shadow primitive. Insert it into
|
||||
// the draw lists immediately so that it will be drawn
|
||||
// before any visual text elements that are added as
|
||||
// part of this text-shadow context.
|
||||
// part of this shadow context.
|
||||
let prim_index = self.add_primitive(
|
||||
clip_and_scroll,
|
||||
info,
|
||||
Vec::new(),
|
||||
PrimitiveContainer::TextShadow(prim),
|
||||
PrimitiveContainer::Shadow(prim),
|
||||
);
|
||||
|
||||
self.shadow_prim_stack.push(prim_index);
|
||||
}
|
||||
|
||||
pub fn pop_text_shadow(&mut self) {
|
||||
pub fn pop_shadow(&mut self) {
|
||||
let prim_index = self.shadow_prim_stack
|
||||
.pop()
|
||||
.expect("invalid shadow push/pop count");
|
||||
|
@ -614,7 +614,7 @@ impl FrameBuilder {
|
|||
// safe to offset the local rect by the offset of the shadow, which
|
||||
// is then used when blitting the shadow to the final location.
|
||||
let metadata = &mut self.prim_store.cpu_metadata[prim_index.0];
|
||||
let prim = &self.prim_store.cpu_text_shadows[metadata.cpu_prim_index.0];
|
||||
let prim = &self.prim_store.cpu_shadows[metadata.cpu_prim_index.0];
|
||||
|
||||
metadata.local_rect = metadata.local_rect.translate(&prim.shadow.offset);
|
||||
}
|
||||
|
@ -683,15 +683,15 @@ impl FrameBuilder {
|
|||
orientation: orientation,
|
||||
};
|
||||
|
||||
let mut fast_text_shadow_prims = Vec::new();
|
||||
let mut fast_shadow_prims = Vec::new();
|
||||
for shadow_prim_index in &self.shadow_prim_stack {
|
||||
let shadow_metadata = &self.prim_store.cpu_metadata[shadow_prim_index.0];
|
||||
let shadow_prim = &self.prim_store.cpu_text_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
let shadow_prim = &self.prim_store.cpu_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
if shadow_prim.shadow.blur_radius == 0.0 {
|
||||
fast_text_shadow_prims.push(shadow_prim.shadow);
|
||||
fast_shadow_prims.push(shadow_prim.shadow);
|
||||
}
|
||||
}
|
||||
for shadow in fast_text_shadow_prims {
|
||||
for shadow in fast_shadow_prims {
|
||||
let mut line = line.clone();
|
||||
line.color = shadow.color;
|
||||
let mut info = info.clone();
|
||||
|
@ -720,9 +720,9 @@ impl FrameBuilder {
|
|||
|
||||
for shadow_prim_index in &self.shadow_prim_stack {
|
||||
let shadow_metadata = &mut self.prim_store.cpu_metadata[shadow_prim_index.0];
|
||||
debug_assert_eq!(shadow_metadata.prim_kind, PrimitiveKind::TextShadow);
|
||||
debug_assert_eq!(shadow_metadata.prim_kind, PrimitiveKind::Shadow);
|
||||
let shadow_prim =
|
||||
&mut self.prim_store.cpu_text_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
&mut self.prim_store.cpu_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
|
||||
// Only run real blurs here (fast path zero blurs are handled above).
|
||||
if shadow_prim.shadow.blur_radius > 0.0 {
|
||||
|
@ -1208,10 +1208,10 @@ impl FrameBuilder {
|
|||
// *before* the visual text primitive in order to get the correct paint
|
||||
// order. Store them in a Vec first to work around borrowck issues.
|
||||
// TODO(gw): Refactor to avoid having to store them in a Vec first.
|
||||
let mut fast_text_shadow_prims = Vec::new();
|
||||
let mut fast_shadow_prims = Vec::new();
|
||||
for shadow_prim_index in &self.shadow_prim_stack {
|
||||
let shadow_metadata = &self.prim_store.cpu_metadata[shadow_prim_index.0];
|
||||
let shadow_prim = &self.prim_store.cpu_text_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
let shadow_prim = &self.prim_store.cpu_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
if shadow_prim.shadow.blur_radius == 0.0 {
|
||||
let mut text_prim = prim.clone();
|
||||
if font.render_mode != FontRenderMode::Bitmap {
|
||||
|
@ -1225,10 +1225,10 @@ impl FrameBuilder {
|
|||
}
|
||||
text_prim.color = shadow_prim.shadow.color;
|
||||
text_prim.offset += shadow_prim.shadow.offset;
|
||||
fast_text_shadow_prims.push(text_prim);
|
||||
fast_shadow_prims.push(text_prim);
|
||||
}
|
||||
}
|
||||
for text_prim in fast_text_shadow_prims {
|
||||
for text_prim in fast_shadow_prims {
|
||||
let rect = info.rect;
|
||||
let mut info = info.clone();
|
||||
info.rect = rect.translate(&text_prim.offset);
|
||||
|
@ -1258,15 +1258,15 @@ impl FrameBuilder {
|
|||
// Now add this primitive index to all the currently active text shadow
|
||||
// primitives. Although we're adding the indices *after* the visual
|
||||
// primitive here, they will still draw before the visual text, since
|
||||
// the text-shadow primitive itself has been added to the draw cmd
|
||||
// list *before* the visual element, during push_text_shadow. We need
|
||||
// the shadow primitive itself has been added to the draw cmd
|
||||
// list *before* the visual element, during push_shadow. We need
|
||||
// the primitive index of the visual element here before we can add
|
||||
// the indices as sub-primitives to the shadow primitives.
|
||||
for shadow_prim_index in &self.shadow_prim_stack {
|
||||
let shadow_metadata = &mut self.prim_store.cpu_metadata[shadow_prim_index.0];
|
||||
debug_assert_eq!(shadow_metadata.prim_kind, PrimitiveKind::TextShadow);
|
||||
debug_assert_eq!(shadow_metadata.prim_kind, PrimitiveKind::Shadow);
|
||||
let shadow_prim =
|
||||
&mut self.prim_store.cpu_text_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
&mut self.prim_store.cpu_shadows[shadow_metadata.cpu_prim_index.0];
|
||||
|
||||
// Only run real blurs here (fast path zero blurs are handled above).
|
||||
if shadow_prim.shadow.blur_radius > 0.0 {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use api::{BorderRadius, BuiltDisplayList, ColorF, ComplexClipRegion, DeviceIntRect, DeviceIntSize};
|
||||
use api::{DevicePoint, ExtendMode, FontInstance, FontRenderMode, GlyphInstance, GlyphKey};
|
||||
use api::{GradientStop, ImageKey, ImageRendering, ItemRange, ItemTag, LayerPoint, LayerRect};
|
||||
use api::{LayerSize, LayerVector2D, LineOrientation, LineStyle, TextShadow};
|
||||
use api::{LayerSize, LayerVector2D, LineOrientation, LineStyle, Shadow};
|
||||
use api::{TileOffset, YuvColorSpace, YuvFormat, device_length};
|
||||
use app_units::Au;
|
||||
use border::BorderCornerInstance;
|
||||
|
@ -110,7 +110,7 @@ pub enum PrimitiveKind {
|
|||
AngleGradient,
|
||||
RadialGradient,
|
||||
BoxShadow,
|
||||
TextShadow,
|
||||
Shadow,
|
||||
Line,
|
||||
}
|
||||
|
||||
|
@ -515,8 +515,8 @@ impl RadialGradientPrimitiveCpu {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TextShadowPrimitiveCpu {
|
||||
pub shadow: TextShadow,
|
||||
pub struct ShadowPrimitiveCpu {
|
||||
pub shadow: Shadow,
|
||||
pub primitives: Vec<PrimitiveIndex>,
|
||||
pub render_task_id: Option<RenderTaskId>,
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ pub enum PrimitiveContainer {
|
|||
AngleGradient(GradientPrimitiveCpu),
|
||||
RadialGradient(RadialGradientPrimitiveCpu),
|
||||
BoxShadow(BoxShadowPrimitiveCpu),
|
||||
TextShadow(TextShadowPrimitiveCpu),
|
||||
Shadow(ShadowPrimitiveCpu),
|
||||
Line(LinePrimitive),
|
||||
}
|
||||
|
||||
|
@ -815,7 +815,7 @@ pub struct PrimitiveStore {
|
|||
/// CPU side information only.
|
||||
pub cpu_rectangles: Vec<RectanglePrimitive>,
|
||||
pub cpu_text_runs: Vec<TextRunPrimitiveCpu>,
|
||||
pub cpu_text_shadows: Vec<TextShadowPrimitiveCpu>,
|
||||
pub cpu_shadows: Vec<ShadowPrimitiveCpu>,
|
||||
pub cpu_images: Vec<ImagePrimitiveCpu>,
|
||||
pub cpu_yuv_images: Vec<YuvImagePrimitiveCpu>,
|
||||
pub cpu_gradients: Vec<GradientPrimitiveCpu>,
|
||||
|
@ -832,7 +832,7 @@ impl PrimitiveStore {
|
|||
cpu_metadata: Vec::new(),
|
||||
cpu_rectangles: Vec::new(),
|
||||
cpu_text_runs: Vec::new(),
|
||||
cpu_text_shadows: Vec::new(),
|
||||
cpu_shadows: Vec::new(),
|
||||
cpu_images: Vec::new(),
|
||||
cpu_yuv_images: Vec::new(),
|
||||
cpu_gradients: Vec::new(),
|
||||
|
@ -848,7 +848,7 @@ impl PrimitiveStore {
|
|||
cpu_metadata: recycle_vec(self.cpu_metadata),
|
||||
cpu_rectangles: recycle_vec(self.cpu_rectangles),
|
||||
cpu_text_runs: recycle_vec(self.cpu_text_runs),
|
||||
cpu_text_shadows: recycle_vec(self.cpu_text_shadows),
|
||||
cpu_shadows: recycle_vec(self.cpu_shadows),
|
||||
cpu_images: recycle_vec(self.cpu_images),
|
||||
cpu_yuv_images: recycle_vec(self.cpu_yuv_images),
|
||||
cpu_gradients: recycle_vec(self.cpu_gradients),
|
||||
|
@ -920,15 +920,15 @@ impl PrimitiveStore {
|
|||
self.cpu_text_runs.push(text_cpu);
|
||||
metadata
|
||||
}
|
||||
PrimitiveContainer::TextShadow(text_shadow) => {
|
||||
PrimitiveContainer::Shadow(shadow) => {
|
||||
let metadata = PrimitiveMetadata {
|
||||
opacity: PrimitiveOpacity::translucent(),
|
||||
prim_kind: PrimitiveKind::TextShadow,
|
||||
cpu_prim_index: SpecificPrimitiveIndex(self.cpu_text_shadows.len()),
|
||||
prim_kind: PrimitiveKind::Shadow,
|
||||
cpu_prim_index: SpecificPrimitiveIndex(self.cpu_shadows.len()),
|
||||
..base_metadata
|
||||
};
|
||||
|
||||
self.cpu_text_shadows.push(text_shadow);
|
||||
self.cpu_shadows.push(shadow);
|
||||
metadata
|
||||
}
|
||||
PrimitiveContainer::Image(image_cpu) => {
|
||||
|
@ -1035,9 +1035,9 @@ impl PrimitiveStore {
|
|||
let box_shadow = &self.cpu_box_shadows[metadata.cpu_prim_index.0];
|
||||
box_shadow.render_task_id
|
||||
}
|
||||
PrimitiveKind::TextShadow => {
|
||||
let text_shadow = &self.cpu_text_shadows[metadata.cpu_prim_index.0];
|
||||
text_shadow.render_task_id
|
||||
PrimitiveKind::Shadow => {
|
||||
let shadow = &self.cpu_shadows[metadata.cpu_prim_index.0];
|
||||
shadow.render_task_id
|
||||
}
|
||||
PrimitiveKind::Rectangle |
|
||||
PrimitiveKind::TextRun |
|
||||
|
@ -1114,10 +1114,10 @@ impl PrimitiveStore {
|
|||
// ignore the new task if we are in a dependency context
|
||||
box_shadow.render_task_id = render_tasks.map(|rt| rt.add(render_task));
|
||||
}
|
||||
PrimitiveKind::TextShadow => {
|
||||
let shadow = &mut self.cpu_text_shadows[metadata.cpu_prim_index.0];
|
||||
PrimitiveKind::Shadow => {
|
||||
let shadow = &mut self.cpu_shadows[metadata.cpu_prim_index.0];
|
||||
|
||||
// This is a text-shadow element. Create a render task that will
|
||||
// This is a shadow element. Create a render task that will
|
||||
// render the text run to a target, and then apply a gaussian
|
||||
// blur to that text run in order to build the actual primitive
|
||||
// which will be blitted to the framebuffer.
|
||||
|
@ -1234,8 +1234,8 @@ impl PrimitiveStore {
|
|||
let text = &self.cpu_text_runs[metadata.cpu_prim_index.0];
|
||||
text.write_gpu_blocks(&mut request);
|
||||
}
|
||||
PrimitiveKind::TextShadow => {
|
||||
let prim = &self.cpu_text_shadows[metadata.cpu_prim_index.0];
|
||||
PrimitiveKind::Shadow => {
|
||||
let prim = &self.cpu_shadows[metadata.cpu_prim_index.0];
|
||||
request.push(prim.shadow.color);
|
||||
request.push([
|
||||
prim.shadow.offset.x,
|
||||
|
@ -1374,8 +1374,8 @@ impl PrimitiveStore {
|
|||
};
|
||||
|
||||
let dependencies = match metadata.prim_kind {
|
||||
PrimitiveKind::TextShadow =>
|
||||
self.cpu_text_shadows[metadata.cpu_prim_index.0].primitives.clone(),
|
||||
PrimitiveKind::Shadow =>
|
||||
self.cpu_shadows[metadata.cpu_prim_index.0].primitives.clone(),
|
||||
_ => Vec::new(),
|
||||
};
|
||||
(geometry, dependencies)
|
||||
|
|
|
@ -716,8 +716,8 @@ impl ToDebugString for SpecificDisplayItem {
|
|||
SpecificDisplayItem::PopNestedDisplayList => String::from("pop_nested_display_list"),
|
||||
SpecificDisplayItem::SetGradientStops => String::from("set_gradient_stops"),
|
||||
SpecificDisplayItem::PopStackingContext => String::from("pop_stacking_context"),
|
||||
SpecificDisplayItem::PushTextShadow(..) => String::from("push_text_shadow"),
|
||||
SpecificDisplayItem::PopTextShadow => String::from("pop_text_shadow"),
|
||||
SpecificDisplayItem::PushShadow(..) => String::from("push_shadow"),
|
||||
SpecificDisplayItem::PopShadow => String::from("pop_shadow"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2659,7 +2659,7 @@ impl Renderer {
|
|||
|
||||
// Draw any textrun caches for this target. For now, this
|
||||
// is only used to cache text runs that are to be blurred
|
||||
// for text-shadow support. In the future it may be worth
|
||||
// for shadow support. In the future it may be worth
|
||||
// considering using this for (some) other text runs, since
|
||||
// it removes the overhead of submitting many small glyphs
|
||||
// to multiple tiles in the normal text run case.
|
||||
|
|
|
@ -64,7 +64,7 @@ impl AlphaBatchHelpers for PrimitiveStore {
|
|||
PrimitiveKind::AlignedGradient |
|
||||
PrimitiveKind::AngleGradient |
|
||||
PrimitiveKind::RadialGradient |
|
||||
PrimitiveKind::TextShadow => if needs_blending {
|
||||
PrimitiveKind::Shadow => if needs_blending {
|
||||
BlendMode::PremultipliedAlpha
|
||||
} else {
|
||||
BlendMode::None
|
||||
|
@ -541,10 +541,10 @@ impl AlphaRenderItem {
|
|||
},
|
||||
);
|
||||
}
|
||||
PrimitiveKind::TextShadow => {
|
||||
let text_shadow =
|
||||
&ctx.prim_store.cpu_text_shadows[prim_metadata.cpu_prim_index.0];
|
||||
let cache_task_id = text_shadow.render_task_id.expect("no render task!");
|
||||
PrimitiveKind::Shadow => {
|
||||
let shadow =
|
||||
&ctx.prim_store.cpu_shadows[prim_metadata.cpu_prim_index.0];
|
||||
let cache_task_id = shadow.render_task_id.expect("no render task!");
|
||||
let cache_task_address = render_tasks.get_task_address(cache_task_id);
|
||||
let textures = BatchTextures::render_target_cache();
|
||||
let kind = BatchKind::Transformable(
|
||||
|
@ -1140,8 +1140,8 @@ impl RenderTarget for ColorRenderTarget {
|
|||
let prim_address = prim_metadata.gpu_location.as_int(gpu_cache);
|
||||
|
||||
match prim_metadata.prim_kind {
|
||||
PrimitiveKind::TextShadow => {
|
||||
let prim = &ctx.prim_store.cpu_text_shadows[prim_metadata.cpu_prim_index.0];
|
||||
PrimitiveKind::Shadow => {
|
||||
let prim = &ctx.prim_store.cpu_shadows[prim_metadata.cpu_prim_index.0];
|
||||
|
||||
let task_index = render_tasks.get_task_address(task_id);
|
||||
|
||||
|
@ -1160,8 +1160,8 @@ impl RenderTarget for ColorRenderTarget {
|
|||
match sub_metadata.prim_kind {
|
||||
PrimitiveKind::TextRun => {
|
||||
// Add instances that reference the text run GPU location. Also supply
|
||||
// the parent text-shadow prim address as a user data field, allowing
|
||||
// the shader to fetch the text-shadow parameters.
|
||||
// the parent shadow prim address as a user data field, allowing
|
||||
// the shader to fetch the shadow parameters.
|
||||
let text = &ctx.prim_store.cpu_text_runs
|
||||
[sub_metadata.cpu_prim_index.0];
|
||||
let text_run_cache_prims = &mut self.text_run_cache_prims;
|
||||
|
|
|
@ -104,8 +104,8 @@ pub enum SpecificDisplayItem {
|
|||
SetGradientStops,
|
||||
PushNestedDisplayList,
|
||||
PopNestedDisplayList,
|
||||
PushTextShadow(TextShadow),
|
||||
PopTextShadow,
|
||||
PushShadow(Shadow),
|
||||
PopShadow,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
|
@ -308,7 +308,7 @@ pub struct BoxShadowDisplayItem {
|
|||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct TextShadow {
|
||||
pub struct Shadow {
|
||||
pub offset: LayoutVector2D,
|
||||
pub color: ColorF,
|
||||
pub blur_radius: f32,
|
||||
|
|
|
@ -12,7 +12,7 @@ use {LineDisplayItem, LineOrientation, LineStyle, LocalClip, MixBlendMode, Pipel
|
|||
use {PropertyBinding, PushStackingContextDisplayItem, RadialGradient, RadialGradientDisplayItem};
|
||||
use {RectangleDisplayItem, ScrollFrameDisplayItem, ScrollPolicy, ScrollSensitivity};
|
||||
use {SpecificDisplayItem, StackingContext, StickyFrameDisplayItem, StickyFrameInfo};
|
||||
use {TextDisplayItem, TextShadow, TransformStyle, YuvColorSpace, YuvData};
|
||||
use {TextDisplayItem, Shadow, TransformStyle, YuvColorSpace, YuvData};
|
||||
use YuvImageDisplayItem;
|
||||
use bincode;
|
||||
use serde::{Deserialize, Serialize, Serializer};
|
||||
|
@ -982,6 +982,31 @@ impl DisplayListBuilder {
|
|||
image_mask: Option<ImageMask>,
|
||||
scroll_sensitivity: ScrollSensitivity,
|
||||
) -> ClipId
|
||||
where
|
||||
I: IntoIterator<Item = ComplexClipRegion>,
|
||||
I::IntoIter: ExactSizeIterator,
|
||||
{
|
||||
let parent_id = self.clip_stack.last().unwrap().scroll_node_id;
|
||||
self.define_scroll_frame_with_parent(
|
||||
id,
|
||||
parent_id,
|
||||
content_rect,
|
||||
clip_rect,
|
||||
complex_clips,
|
||||
image_mask,
|
||||
scroll_sensitivity)
|
||||
}
|
||||
|
||||
pub fn define_scroll_frame_with_parent<I>(
|
||||
&mut self,
|
||||
id: Option<ClipId>,
|
||||
parent_id: ClipId,
|
||||
content_rect: LayoutRect,
|
||||
clip_rect: LayoutRect,
|
||||
complex_clips: I,
|
||||
image_mask: Option<ImageMask>,
|
||||
scroll_sensitivity: ScrollSensitivity,
|
||||
) -> ClipId
|
||||
where
|
||||
I: IntoIterator<Item = ComplexClipRegion>,
|
||||
I::IntoIter: ExactSizeIterator,
|
||||
|
@ -989,7 +1014,7 @@ impl DisplayListBuilder {
|
|||
let id = self.generate_clip_id(id);
|
||||
let item = SpecificDisplayItem::ScrollFrame(ScrollFrameDisplayItem {
|
||||
id: id,
|
||||
parent_id: self.clip_stack.last().unwrap().scroll_node_id,
|
||||
parent_id: parent_id,
|
||||
image_mask: image_mask,
|
||||
scroll_sensitivity,
|
||||
});
|
||||
|
@ -1013,6 +1038,27 @@ impl DisplayListBuilder {
|
|||
complex_clips: I,
|
||||
image_mask: Option<ImageMask>,
|
||||
) -> ClipId
|
||||
where
|
||||
I: IntoIterator<Item = ComplexClipRegion>,
|
||||
I::IntoIter: ExactSizeIterator,
|
||||
{
|
||||
let parent_id = self.clip_stack.last().unwrap().scroll_node_id;
|
||||
self.define_clip_with_parent(
|
||||
id,
|
||||
parent_id,
|
||||
clip_rect,
|
||||
complex_clips,
|
||||
image_mask)
|
||||
}
|
||||
|
||||
pub fn define_clip_with_parent<I>(
|
||||
&mut self,
|
||||
id: Option<ClipId>,
|
||||
parent_id: ClipId,
|
||||
clip_rect: LayoutRect,
|
||||
complex_clips: I,
|
||||
image_mask: Option<ImageMask>,
|
||||
) -> ClipId
|
||||
where
|
||||
I: IntoIterator<Item = ComplexClipRegion>,
|
||||
I::IntoIter: ExactSizeIterator,
|
||||
|
@ -1020,7 +1066,7 @@ impl DisplayListBuilder {
|
|||
let id = self.generate_clip_id(id);
|
||||
let item = SpecificDisplayItem::Clip(ClipDisplayItem {
|
||||
id,
|
||||
parent_id: self.clip_stack.last().unwrap().scroll_node_id,
|
||||
parent_id: parent_id,
|
||||
image_mask: image_mask,
|
||||
});
|
||||
|
||||
|
@ -1087,12 +1133,12 @@ impl DisplayListBuilder {
|
|||
self.push_new_empty_item(SpecificDisplayItem::PopNestedDisplayList);
|
||||
}
|
||||
|
||||
pub fn push_text_shadow(&mut self, info: &LayoutPrimitiveInfo, shadow: TextShadow) {
|
||||
self.push_item(SpecificDisplayItem::PushTextShadow(shadow), info);
|
||||
pub fn push_shadow(&mut self, info: &LayoutPrimitiveInfo, shadow: Shadow) {
|
||||
self.push_item(SpecificDisplayItem::PushShadow(shadow), info);
|
||||
}
|
||||
|
||||
pub fn pop_text_shadow(&mut self) {
|
||||
self.push_new_empty_item(SpecificDisplayItem::PopTextShadow);
|
||||
pub fn pop_shadow(&mut self) {
|
||||
self.push_new_empty_item(SpecificDisplayItem::PopShadow);
|
||||
}
|
||||
|
||||
pub fn finalize(mut self) -> (PipelineId, LayoutSize, BuiltDisplayList) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче