Bug 1355187 - Add type aliases for instantiations of WrSideOffsets. r=rhunt
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 10 Apr 2017 17:38:01 -0400
changeset 559929 f71d33022a5e40a7623ac8d5da8619d83948ccb7
parent 559928 db087d30b56b363b559eb8e736885475c708bfcf
child 559930 223769fd889492f5a270559533bc5967ced40e09
push id53284
push userkgupta@mozilla.com
push dateMon, 10 Apr 2017 22:25:08 +0000
reviewersrhunt
bugs1355187
milestone55.0a1
Bug 1355187 - Add type aliases for instantiations of WrSideOffsets. r=rhunt The binding generator needs this in order to deal with the generic-ness of the WrSideOffsets type. MozReview-Commit-ID: GetmNIpqf7O
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -27,16 +27,18 @@ type WrGlyphInstance = GlyphInstance;
 type WrIdNamespace = IdNamespace;
 type WrImageFormat = ImageFormat;
 type WrImageRendering = ImageRendering;
 type WrImageKey = ImageKey;
 type WrMixBlendMode = MixBlendMode;
 type WrPipelineId = PipelineId;
 type WrRenderedEpochs = Vec<(WrPipelineId, WrEpoch)>;
 type WrRenderer = Renderer;
+type WrSideOffsets2Du32 = WrSideOffsets2D<u32>;
+type WrSideOffsets2Df32 = WrSideOffsets2D<f32>;
 
 static ENABLE_RECORDING: bool = false;
 
 // This macro adds some checks to make sure we notice when the memory representation of
 // types change.
 macro_rules! check_ffi_type {
     ($check_sizes_match:ident struct $TypeName:ident as ($T1:ident, $T2:ident)) => (
         fn $check_sizes_match() {
@@ -289,17 +291,17 @@ impl WrBorderWidths
     }
 }
 
 #[repr(C)]
 pub struct WrNinePatchDescriptor
 {
     width: u32,
     height: u32,
-    slice: WrSideOffsets2D<u32>,
+    slice: WrSideOffsets2Du32,
 }
 
 impl WrNinePatchDescriptor
 {
     pub fn to_nine_patch_descriptor(&self) -> NinePatchDescriptor {
         NinePatchDescriptor {
             width: self.width,
             height: self.height,
@@ -1249,17 +1251,17 @@ pub extern "C" fn wr_dp_push_border(stat
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
                                           rect: WrRect,
                                           clip: WrClipRegion,
                                           widths: WrBorderWidths,
                                           image: WrImageKey,
                                           patch: WrNinePatchDescriptor,
-                                          outset: WrSideOffsets2D<f32>,
+                                          outset: WrSideOffsets2Df32,
                                           repeat_horizontal: WrRepeatMode,
                                           repeat_vertical: WrRepeatMode) {
     assert!( unsafe { is_in_main_thread() });
     let border_details = BorderDetails::Image(ImageBorder {
         image_key: image,
         patch: patch.to_nine_patch_descriptor(),
         outset: outset.to_side_offsets_2d(),
         repeat_horizontal: repeat_horizontal.to_repeat_mode(),
@@ -1273,17 +1275,17 @@ pub extern "C" fn wr_dp_push_border_imag
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState, rect: WrRect, clip: WrRect,
                                              widths: WrBorderWidths,
                                              start_point: WrPoint, end_point: WrPoint,
                                              stops: *const WrGradientStop, stops_count: usize,
                                              extend_mode: WrGradientExtendMode,
-                                             outset: WrSideOffsets2D<f32>) {
+                                             outset: WrSideOffsets2Df32) {
     assert!( unsafe { is_in_main_thread() });
     let stops = WrGradientStop::to_gradient_stops(unsafe { slice::from_raw_parts(stops, stops_count) });
     let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), Vec::new(), None);
     let border_details = BorderDetails::Gradient(GradientBorder {
         gradient: state.frame_builder.dl_builder.create_gradient(
                       start_point.to_point(), end_point.to_point(),
                       stops, extend_mode.to_gradient_extend_mode()),
         outset: outset.to_side_offsets_2d(),
@@ -1297,17 +1299,17 @@ pub extern "C" fn wr_dp_push_border_grad
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState, rect: WrRect, clip: WrRect,
                                                     widths: WrBorderWidths,
                                                     center: WrPoint,
                                                     radius: WrSize,
                                                     stops: *const WrGradientStop, stops_count: usize,
                                                     extend_mode: WrGradientExtendMode,
-                                                    outset: WrSideOffsets2D<f32>) {
+                                                    outset: WrSideOffsets2Df32) {
     assert!( unsafe { is_in_main_thread() });
     let stops = WrGradientStop::to_gradient_stops(unsafe { slice::from_raw_parts(stops, stops_count) });
     let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), Vec::new(), None);
     let border_details = BorderDetails::RadialGradient(RadialGradientBorder {
         gradient: state.frame_builder.dl_builder.create_radial_gradient(center.to_point(),
                                                                         radius.to_size(),
                                                                         stops,
                                                                         extend_mode.to_gradient_extend_mode()),