mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1382128 part 5 - Remove WrGradientStop and WrGradientExtendMode. r=kats
MozReview-Commit-ID: 47Rb5jUpCFX --HG-- extra : rebase_source : 6b4d3e6193b08bc978751921d12a0bb37a60c927
This commit is contained in:
parent
f082c1791e
commit
c013220860
@ -667,8 +667,8 @@ DisplayListBuilder::PushLinearGradient(const wr::LayoutRect& aBounds,
|
||||
const wr::LayoutRect& aClip,
|
||||
const wr::LayoutPoint& aStartPoint,
|
||||
const wr::LayoutPoint& aEndPoint,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSize aTileSize,
|
||||
const wr::LayoutSize aTileSpacing)
|
||||
{
|
||||
@ -685,8 +685,8 @@ DisplayListBuilder::PushRadialGradient(const wr::LayoutRect& aBounds,
|
||||
const wr::LayoutRect& aClip,
|
||||
const wr::LayoutPoint& aCenter,
|
||||
const wr::LayoutSize& aRadius,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSize aTileSize,
|
||||
const wr::LayoutSize aTileSpacing)
|
||||
{
|
||||
@ -818,8 +818,8 @@ DisplayListBuilder::PushBorderGradient(const wr::LayoutRect& aBounds,
|
||||
const wr::WrBorderWidths& aWidths,
|
||||
const wr::LayoutPoint& aStartPoint,
|
||||
const wr::LayoutPoint& aEndPoint,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::SideOffsets2D_f32& aOutset)
|
||||
{
|
||||
wr_dp_push_border_gradient(mWrState, aBounds, aClip,
|
||||
@ -834,8 +834,8 @@ DisplayListBuilder::PushBorderRadialGradient(const wr::LayoutRect& aBounds,
|
||||
const wr::WrBorderWidths& aWidths,
|
||||
const wr::LayoutPoint& aCenter,
|
||||
const wr::LayoutSize& aRadius,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::SideOffsets2D_f32& aOutset)
|
||||
{
|
||||
wr_dp_push_border_radial_gradient(
|
||||
|
@ -181,8 +181,8 @@ public:
|
||||
const wr::LayoutRect& aClip,
|
||||
const wr::LayoutPoint& aStartPoint,
|
||||
const wr::LayoutPoint& aEndPoint,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSize aTileSize,
|
||||
const wr::LayoutSize aTileSpacing);
|
||||
|
||||
@ -190,8 +190,8 @@ public:
|
||||
const wr::LayoutRect& aClip,
|
||||
const wr::LayoutPoint& aCenter,
|
||||
const wr::LayoutSize& aRadius,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSize aTileSize,
|
||||
const wr::LayoutSize aTileSpacing);
|
||||
|
||||
@ -253,8 +253,8 @@ public:
|
||||
const wr::WrBorderWidths& aWidths,
|
||||
const wr::LayoutPoint& aStartPoint,
|
||||
const wr::LayoutPoint& aEndPoint,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::SideOffsets2D_f32& aOutset);
|
||||
|
||||
void PushBorderRadialGradient(const wr::LayoutRect& aBounds,
|
||||
@ -262,8 +262,8 @@ public:
|
||||
const wr::WrBorderWidths& aWidths,
|
||||
const wr::LayoutPoint& aCenter,
|
||||
const wr::LayoutSize& aRadius,
|
||||
const nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::GradientExtendMode aExtendMode,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::SideOffsets2D_f32& aOutset);
|
||||
|
||||
void PushText(const wr::LayoutRect& aBounds,
|
||||
|
@ -20,7 +20,6 @@
|
||||
namespace mozilla {
|
||||
namespace wr {
|
||||
|
||||
typedef wr::WrGradientExtendMode GradientExtendMode;
|
||||
typedef wr::WrMixBlendMode MixBlendMode;
|
||||
typedef wr::WrImageRendering ImageRendering;
|
||||
typedef wr::WrImageFormat ImageFormat;
|
||||
|
@ -141,37 +141,6 @@ impl MutByteSlice {
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
pub enum WrGradientExtendMode {
|
||||
Clamp,
|
||||
Repeat,
|
||||
}
|
||||
|
||||
impl Into<ExtendMode> for WrGradientExtendMode {
|
||||
fn into(self) -> ExtendMode {
|
||||
match self {
|
||||
WrGradientExtendMode::Clamp => ExtendMode::Clamp,
|
||||
WrGradientExtendMode::Repeat => ExtendMode::Repeat,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct WrGradientStop {
|
||||
offset: f32,
|
||||
color: ColorF,
|
||||
}
|
||||
|
||||
impl<'a> Into<GradientStop> for &'a WrGradientStop {
|
||||
fn into(self) -> GradientStop {
|
||||
GradientStop {
|
||||
offset: self.offset,
|
||||
color: self.color.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct WrBorderSide {
|
||||
@ -1381,14 +1350,14 @@ pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
|
||||
widths: WrBorderWidths,
|
||||
start_point: LayoutPoint,
|
||||
end_point: LayoutPoint,
|
||||
stops: *const WrGradientStop,
|
||||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: WrGradientExtendMode,
|
||||
extend_mode: ExtendMode,
|
||||
outset: SideOffsets2D<f32>) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
let stops_slice = make_slice(stops, stops_count);
|
||||
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
|
||||
let stops_vector = stops_slice.to_owned();
|
||||
|
||||
let border_details = BorderDetails::Gradient(GradientBorder {
|
||||
gradient:
|
||||
@ -1415,14 +1384,14 @@ pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
|
||||
widths: WrBorderWidths,
|
||||
center: LayoutPoint,
|
||||
radius: LayoutSize,
|
||||
stops: *const WrGradientStop,
|
||||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: WrGradientExtendMode,
|
||||
extend_mode: ExtendMode,
|
||||
outset: SideOffsets2D<f32>) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
let stops_slice = make_slice(stops, stops_count);
|
||||
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
|
||||
let stops_vector = stops_slice.to_owned();
|
||||
|
||||
let border_details =
|
||||
BorderDetails::RadialGradient(RadialGradientBorder {
|
||||
@ -1449,15 +1418,15 @@ pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
|
||||
clip: LayoutRect,
|
||||
start_point: LayoutPoint,
|
||||
end_point: LayoutPoint,
|
||||
stops: *const WrGradientStop,
|
||||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: WrGradientExtendMode,
|
||||
extend_mode: ExtendMode,
|
||||
tile_size: LayoutSize,
|
||||
tile_spacing: LayoutSize) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
let stops_slice = make_slice(stops, stops_count);
|
||||
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
|
||||
let stops_vector = stops_slice.to_owned();
|
||||
|
||||
let gradient = state.frame_builder
|
||||
.dl_builder
|
||||
@ -1480,15 +1449,15 @@ pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
|
||||
clip: LayoutRect,
|
||||
center: LayoutPoint,
|
||||
radius: LayoutSize,
|
||||
stops: *const WrGradientStop,
|
||||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: WrGradientExtendMode,
|
||||
extend_mode: ExtendMode,
|
||||
tile_size: LayoutSize,
|
||||
tile_spacing: LayoutSize) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
let stops_slice = make_slice(stops, stops_count);
|
||||
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
|
||||
let stops_vector = stops_slice.to_owned();
|
||||
|
||||
let gradient = state.frame_builder
|
||||
.dl_builder
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 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/. */
|
||||
|
||||
/* Generated with cbindgen:0.1.16 */
|
||||
/* Generated with cbindgen:0.1.18 */
|
||||
|
||||
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
@ -19,6 +19,13 @@ extern "C" {
|
||||
namespace mozilla {
|
||||
namespace wr {
|
||||
|
||||
enum class ExtendMode : uint32_t {
|
||||
Clamp = 0,
|
||||
Repeat = 1,
|
||||
|
||||
Sentinel /* this must be last for serialization purposes. */
|
||||
};
|
||||
|
||||
enum class WrBorderStyle : uint32_t {
|
||||
None = 0,
|
||||
Solid = 1,
|
||||
@ -72,13 +79,6 @@ enum class WrFilterOpType : uint32_t {
|
||||
Sentinel /* this must be last for serialization purposes. */
|
||||
};
|
||||
|
||||
enum class WrGradientExtendMode : uint32_t {
|
||||
Clamp = 0,
|
||||
Repeat = 1,
|
||||
|
||||
Sentinel /* this must be last for serialization purposes. */
|
||||
};
|
||||
|
||||
enum class WrImageFormat : uint32_t {
|
||||
Invalid = 0,
|
||||
A8 = 1,
|
||||
@ -423,30 +423,16 @@ struct LayoutPoint {
|
||||
}
|
||||
};
|
||||
|
||||
struct WrGradientStop {
|
||||
struct GradientStop {
|
||||
float offset;
|
||||
ColorF color;
|
||||
|
||||
bool operator==(const WrGradientStop& aOther) const {
|
||||
bool operator==(const GradientStop& aOther) const {
|
||||
return offset == aOther.offset &&
|
||||
color == aOther.color;
|
||||
}
|
||||
};
|
||||
|
||||
struct SideOffsets2D_u32 {
|
||||
uint32_t top;
|
||||
uint32_t right;
|
||||
uint32_t bottom;
|
||||
uint32_t left;
|
||||
|
||||
bool operator==(const SideOffsets2D_u32& aOther) const {
|
||||
return top == aOther.top &&
|
||||
right == aOther.right &&
|
||||
bottom == aOther.bottom &&
|
||||
left == aOther.left;
|
||||
}
|
||||
};
|
||||
|
||||
struct SideOffsets2D_f32 {
|
||||
float top;
|
||||
float right;
|
||||
@ -461,6 +447,20 @@ struct SideOffsets2D_f32 {
|
||||
}
|
||||
};
|
||||
|
||||
struct SideOffsets2D_u32 {
|
||||
uint32_t top;
|
||||
uint32_t right;
|
||||
uint32_t bottom;
|
||||
uint32_t left;
|
||||
|
||||
bool operator==(const SideOffsets2D_u32& aOther) const {
|
||||
return top == aOther.top &&
|
||||
right == aOther.right &&
|
||||
bottom == aOther.bottom &&
|
||||
left == aOther.left;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrNinePatchDescriptor {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
@ -756,9 +756,9 @@ void wr_dp_push_border_gradient(WrState *aState,
|
||||
WrBorderWidths aWidths,
|
||||
LayoutPoint aStartPoint,
|
||||
LayoutPoint aEndPoint,
|
||||
const WrGradientStop *aStops,
|
||||
const GradientStop *aStops,
|
||||
size_t aStopsCount,
|
||||
WrGradientExtendMode aExtendMode,
|
||||
ExtendMode aExtendMode,
|
||||
SideOffsets2D_f32 aOutset)
|
||||
WR_FUNC;
|
||||
|
||||
@ -781,9 +781,9 @@ void wr_dp_push_border_radial_gradient(WrState *aState,
|
||||
WrBorderWidths aWidths,
|
||||
LayoutPoint aCenter,
|
||||
LayoutSize aRadius,
|
||||
const WrGradientStop *aStops,
|
||||
const GradientStop *aStops,
|
||||
size_t aStopsCount,
|
||||
WrGradientExtendMode aExtendMode,
|
||||
ExtendMode aExtendMode,
|
||||
SideOffsets2D_f32 aOutset)
|
||||
WR_FUNC;
|
||||
|
||||
@ -842,9 +842,9 @@ void wr_dp_push_linear_gradient(WrState *aState,
|
||||
LayoutRect aClip,
|
||||
LayoutPoint aStartPoint,
|
||||
LayoutPoint aEndPoint,
|
||||
const WrGradientStop *aStops,
|
||||
const GradientStop *aStops,
|
||||
size_t aStopsCount,
|
||||
WrGradientExtendMode aExtendMode,
|
||||
ExtendMode aExtendMode,
|
||||
LayoutSize aTileSize,
|
||||
LayoutSize aTileSpacing)
|
||||
WR_FUNC;
|
||||
@ -855,9 +855,9 @@ void wr_dp_push_radial_gradient(WrState *aState,
|
||||
LayoutRect aClip,
|
||||
LayoutPoint aCenter,
|
||||
LayoutSize aRadius,
|
||||
const WrGradientStop *aStops,
|
||||
const GradientStop *aStops,
|
||||
size_t aStopsCount,
|
||||
WrGradientExtendMode aExtendMode,
|
||||
ExtendMode aExtendMode,
|
||||
LayoutSize aTileSize,
|
||||
LayoutSize aTileSpacing)
|
||||
WR_FUNC;
|
||||
|
@ -1001,13 +1001,13 @@ nsCSSGradientRenderer::Paint(gfxContext& aContext,
|
||||
|
||||
void
|
||||
nsCSSGradientRenderer::BuildWebRenderParameters(float aOpacity,
|
||||
wr::WrGradientExtendMode& aMode,
|
||||
nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::ExtendMode& aMode,
|
||||
nsTArray<wr::GradientStop>& aStops,
|
||||
LayoutDevicePoint& aLineStart,
|
||||
LayoutDevicePoint& aLineEnd,
|
||||
LayoutDeviceSize& aGradientRadius)
|
||||
{
|
||||
aMode = mGradient->mRepeating ? wr::WrGradientExtendMode::Repeat : wr::WrGradientExtendMode::Clamp;
|
||||
aMode = mGradient->mRepeating ? wr::ExtendMode::Repeat : wr::ExtendMode::Clamp;
|
||||
|
||||
aStops.SetLength(mStops.Length());
|
||||
for(uint32_t i = 0; i < mStops.Length(); i++) {
|
||||
@ -1037,8 +1037,8 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
|
||||
return;
|
||||
}
|
||||
|
||||
wr::WrGradientExtendMode extendMode;
|
||||
nsTArray<wr::WrGradientStop> stops;
|
||||
wr::ExtendMode extendMode;
|
||||
nsTArray<wr::GradientStop> stops;
|
||||
LayoutDevicePoint lineStart;
|
||||
LayoutDevicePoint lineEnd;
|
||||
LayoutDeviceSize gradientRadius;
|
||||
|
@ -65,8 +65,8 @@ public:
|
||||
* Collect the gradient parameters
|
||||
*/
|
||||
void BuildWebRenderParameters(float aOpacity,
|
||||
wr::WrGradientExtendMode& aMode,
|
||||
nsTArray<wr::WrGradientStop>& aStops,
|
||||
wr::ExtendMode& aMode,
|
||||
nsTArray<wr::GradientStop>& aStops,
|
||||
LayoutDevicePoint& aLineStart,
|
||||
LayoutDevicePoint& aLineEnd,
|
||||
LayoutDeviceSize& aGradientRadius);
|
||||
|
@ -5017,8 +5017,8 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
|
||||
nsCSSGradientRenderer::Create(mFrame->PresContext(), gradientData,
|
||||
mBorderImageRenderer->mImageSize);
|
||||
|
||||
wr::WrGradientExtendMode extendMode;
|
||||
nsTArray<wr::WrGradientStop> stops;
|
||||
wr::ExtendMode extendMode;
|
||||
nsTArray<wr::GradientStop> stops;
|
||||
LayoutDevicePoint lineStart;
|
||||
LayoutDevicePoint lineEnd;
|
||||
LayoutDeviceSize gradientRadius;
|
||||
|
Loading…
Reference in New Issue
Block a user