Skip to content

Commit 5f88090

Browse files
committed
Remove PrimitiveContainer
1 parent f97480c commit 5f88090

File tree

5 files changed

+163
-338
lines changed

5 files changed

+163
-338
lines changed

webrender/src/border.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use euclid::vec2;
1111
use display_list_flattener::DisplayListFlattener;
1212
use gpu_types::{BorderInstance, BorderSegment, BrushFlags};
1313
use prim_store::{BorderSegmentInfo, BrushSegment, NinePatchDescriptor};
14-
use prim_store::{EdgeAaSegmentMask, PrimitiveContainer, ScrollNodeAndClipChain};
14+
use prim_store::{EdgeAaSegmentMask, ScrollNodeAndClipChain, PrimitiveKeyKind};
1515
use util::{lerp, RectHelpers};
1616

1717
// Using 2048 as the maximum radius in device space before which we
@@ -117,6 +117,18 @@ pub struct NormalBorderAu {
117117
pub do_aa: bool,
118118
}
119119

120+
impl NormalBorderAu {
121+
// Construct a border based upon self with color
122+
pub fn with_color(&self, color: ColorU) -> Self {
123+
let mut b = self.clone();
124+
b.left.color = color;
125+
b.right.color = color;
126+
b.top.color = color;
127+
b.bottom.color = color;
128+
b
129+
}
130+
}
131+
120132
impl From<NormalBorder> for NormalBorderAu {
121133
fn from(border: NormalBorder) -> Self {
122134
NormalBorderAu {
@@ -217,9 +229,9 @@ impl<'a> DisplayListFlattener<'a> {
217229
clip_and_scroll,
218230
info,
219231
Vec::new(),
220-
PrimitiveContainer::NormalBorder {
221-
border,
222-
widths,
232+
PrimitiveKeyKind::NormalBorder {
233+
border: border.into(),
234+
widths: widths.to_au(),
223235
},
224236
);
225237
}

webrender/src/box_shadow.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use clip::ClipItemKey;
88
use display_list_flattener::DisplayListFlattener;
99
use gpu_cache::GpuCacheHandle;
1010
use gpu_types::BoxShadowStretchMode;
11-
use prim_store::PrimitiveContainer;
12-
use prim_store::ScrollNodeAndClipChain;
11+
use prim_store::{ScrollNodeAndClipChain, PrimitiveKeyKind};
1312
use render_task::RenderTaskCacheEntryHandle;
1413
use util::RectHelpers;
1514

@@ -73,7 +72,7 @@ impl<'a> DisplayListFlattener<'a> {
7372
clip_and_scroll: ScrollNodeAndClipChain,
7473
prim_info: &LayoutPrimitiveInfo,
7574
box_offset: &LayoutVector2D,
76-
color: &ColorF,
75+
color: ColorF,
7776
mut blur_radius: f32,
7877
spread_radius: f32,
7978
border_radius: BorderRadius,
@@ -149,8 +148,8 @@ impl<'a> DisplayListFlattener<'a> {
149148
clip_and_scroll,
150149
&LayoutPrimitiveInfo::with_clip_rect(final_prim_rect, prim_info.clip_rect),
151150
clips,
152-
PrimitiveContainer::Rectangle {
153-
color: *color,
151+
PrimitiveKeyKind::Rectangle {
152+
color: color.into(),
154153
},
155154
);
156155
} else {
@@ -172,8 +171,8 @@ impl<'a> DisplayListFlattener<'a> {
172171

173172
// Draw the box-shadow as a solid rect, using a box-shadow
174173
// clip mask item.
175-
let prim = PrimitiveContainer::Rectangle {
176-
color: *color,
174+
let prim = PrimitiveKeyKind::Rectangle {
175+
color: color.into(),
177176
};
178177

179178
// Create the box-shadow clip item.

0 commit comments

Comments
 (0)