Skip to content
Permalink
Browse files

Updates for WR gradient API change.

  • Loading branch information
gw3583 committed Jul 16, 2018
1 parent 6354cd9 commit 1881a06c40ad2f1bd7fa731b36e1360328fe67a7
Showing with 43 additions and 22 deletions.
  1. +2 −2 Cargo.lock
  2. +41 −20 components/layout/display_list/webrender_helpers.rs

Some generated files are not rendered by default. Learn more.

@@ -9,6 +9,7 @@

use display_list::items::{BorderDetails, ClipScrollNode, ClipScrollNodeIndex, ClipScrollNodeType};
use display_list::items::{DisplayItem, DisplayList, StackingContextType};
use euclid::SideOffsets2D;
use msg::constellation_msg::PipelineId;
use webrender_api::{self, ClipAndScrollInfo, ClipId, DisplayListBuilder, GlyphRasterSpace};
use webrender_api::LayoutPoint;
@@ -132,30 +133,50 @@ impl WebRenderDisplayItemConverter for DisplayItem {
BorderDetails::Normal(ref border) => {
webrender_api::BorderDetails::Normal(*border)
},
BorderDetails::Image(ref image) => webrender_api::BorderDetails::NinePatch(*image),
BorderDetails::Image(ref image) => {
webrender_api::BorderDetails::NinePatch(*image)
}
BorderDetails::Gradient(ref gradient) => {
webrender_api::BorderDetails::Gradient(webrender_api::GradientBorder {
gradient: builder.create_gradient(
gradient.gradient.start_point,
gradient.gradient.end_point,
gradient.gradient.stops.clone(),
gradient.gradient.extend_mode,
),
let wr_gradient = builder.create_gradient(
gradient.gradient.start_point,
gradient.gradient.end_point,
gradient.gradient.stops.clone(),
gradient.gradient.extend_mode,
);

let details = webrender_api::NinePatchBorder {
source: webrender_api::NinePatchBorderSource::Gradient(wr_gradient),
width: 0,
height: 0,
slice: SideOffsets2D::zero(),
fill: false,
repeat_horizontal: webrender_api::RepeatMode::Stretch,
repeat_vertical: webrender_api::RepeatMode::Stretch,
outset: gradient.outset,
})
};

webrender_api::BorderDetails::NinePatch(details)
},
BorderDetails::RadialGradient(ref gradient) => {
webrender_api::BorderDetails::RadialGradient(
webrender_api::RadialGradientBorder {
gradient: builder.create_radial_gradient(
gradient.gradient.center,
gradient.gradient.radius,
gradient.gradient.stops.clone(),
gradient.gradient.extend_mode,
),
outset: gradient.outset,
},
)
let wr_gradient = builder.create_radial_gradient(
gradient.gradient.center,
gradient.gradient.radius,
gradient.gradient.stops.clone(),
gradient.gradient.extend_mode,
);

let details = webrender_api::NinePatchBorder {
source: webrender_api::NinePatchBorderSource::RadialGradient(wr_gradient),
width: 0,
height: 0,
slice: SideOffsets2D::zero(),
fill: false,
repeat_horizontal: webrender_api::RepeatMode::Stretch,
repeat_vertical: webrender_api::RepeatMode::Stretch,
outset: gradient.outset,
};

webrender_api::BorderDetails::NinePatch(details)
},
};

0 comments on commit 1881a06

Please sign in to comment.
You can’t perform that action at this time.