Bug 1374730 - Update webrender bindings for API changes in WR cset 5066a13. r?mrobinson draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 10 Jul 2017 07:22:39 -0400
changeset 606133 a3c82f478270e6e32c876f045289b763905b3713
parent 606132 0714d152b90739d38275717645896f08eb341f55
child 636679 cdba256a29e733a4cff438a4634c417a563ca5dd
push id67608
push userkgupta@mozilla.com
push dateMon, 10 Jul 2017 11:23:08 +0000
reviewersmrobinson
bugs1374730
milestone56.0a1
Bug 1374730 - Update webrender bindings for API changes in WR cset 5066a13. r?mrobinson This change preserves the existing semantics of the webrender_bindings code, although it may result in creating unnecessary clips. A follow-up bug will be filed to make clip optional in the C++ interface, and avoid passing it in places where it is not necessary. MozReview-Commit-ID: KMeBumpgDXL
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1367,33 +1367,35 @@ pub extern "C" fn wr_dp_push_iframe(stat
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
                                   rect: WrRect,
                                   clip: WrRect,
                                   color: WrColor) {
     assert!(unsafe { !is_in_render_thread() });
 
-    state.frame_builder.dl_builder.push_rect(rect.into(), clip.into(), color.into());
+    state.frame_builder.dl_builder.push_rect(rect.into(),
+                                             Some(LocalClip::Rect(clip.into())),
+                                             color.into());
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_image(state: &mut WrState,
                                    bounds: WrRect,
                                    clip: WrRect,
                                    stretch_size: WrSize,
                                    tile_spacing: WrSize,
                                    image_rendering: WrImageRendering,
                                    key: WrImageKey) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
          .push_image(bounds.into(),
-                     clip.into(),
+                     Some(LocalClip::Rect(clip.into())),
                      stretch_size.into(),
                      tile_spacing.into(),
                      image_rendering,
                      key);
 }
 
 /// Push a 3 planar yuv image.
 #[no_mangle]
@@ -1405,17 +1407,17 @@ pub extern "C" fn wr_dp_push_yuv_planar_
                                               image_key_2: WrImageKey,
                                               color_space: WrYuvColorSpace,
                                               image_rendering: WrImageRendering) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(bounds.into(),
-                         clip.into(),
+                         Some(LocalClip::Rect(clip.into())),
                          YuvData::PlanarYCbCr(image_key_0, image_key_1, image_key_2),
                          color_space,
                          image_rendering);
 }
 
 /// Push a 2 planar NV12 image.
 #[no_mangle]
 pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
@@ -1425,17 +1427,17 @@ pub extern "C" fn wr_dp_push_yuv_NV12_im
                                             image_key_1: WrImageKey,
                                             color_space: WrYuvColorSpace,
                                             image_rendering: WrImageRendering) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(bounds.into(),
-                         clip.into(),
+                         Some(LocalClip::Rect(clip.into())),
                          YuvData::NV12(image_key_0, image_key_1),
                          color_space,
                          image_rendering);
 }
 
 /// Push a yuv interleaved image.
 #[no_mangle]
 pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
@@ -1444,17 +1446,17 @@ pub extern "C" fn wr_dp_push_yuv_interle
                                                    image_key_0: WrImageKey,
                                                    color_space: WrYuvColorSpace,
                                                    image_rendering: WrImageRendering) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(bounds.into(),
-                         clip.into(),
+                         Some(LocalClip::Rect(clip.into())),
                          YuvData::InterleavedYCbCr(image_key_0),
                          color_space,
                          image_rendering);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_text(state: &mut WrState,
                                   bounds: WrRect,
@@ -1470,17 +1472,17 @@ pub extern "C" fn wr_dp_push_text(state:
     let glyph_vector: Vec<_> = glyph_slice.iter().map(|x| x.into()).collect();
 
     let colorf = ColorF::new(color.r, color.g, color.b, color.a);
 
     let glyph_options = None; // TODO
     state.frame_builder
          .dl_builder
          .push_text(bounds.into(),
-                    clip.into(),
+                    Some(LocalClip::Rect(clip.into())),
                     &glyph_vector,
                     font_key,
                     colorf,
                     Au::from_f32_px(glyph_size),
                     0.0,
                     glyph_options);
 }
 
@@ -1500,17 +1502,20 @@ pub extern "C" fn wr_dp_push_border(stat
                                                    left: left.into(),
                                                    right: right.into(),
                                                    top: top.into(),
                                                    bottom: bottom.into(),
                                                    radius: radius.into(),
                                                });
     state.frame_builder
          .dl_builder
-         .push_border(rect.into(), clip.into(), widths.into(), border_details);
+         .push_border(rect.into(),
+                      Some(LocalClip::Rect(clip.into())),
+                      widths.into(),
+                      border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
                                           rect: WrRect,
                                           clip: WrRect,
                                           widths: WrBorderWidths,
                                           image: WrImageKey,
@@ -1525,17 +1530,20 @@ pub extern "C" fn wr_dp_push_border_imag
                                  patch: patch.into(),
                                  fill: false,
                                  outset: outset.into(),
                                  repeat_horizontal: repeat_horizontal.into(),
                                  repeat_vertical: repeat_vertical.into(),
                              });
     state.frame_builder
          .dl_builder
-         .push_border(rect.into(), clip.into(), widths.into(), border_details);
+         .push_border(rect.into(),
+                      Some(LocalClip::Rect(clip.into())),
+                      widths.into(),
+                      border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
                                              rect: WrRect,
                                              clip: WrRect,
                                              widths: WrBorderWidths,
                                              start_point: WrPoint,
@@ -1556,17 +1564,20 @@ pub extern "C" fn wr_dp_push_border_grad
                                                               .create_gradient(start_point.into(),
                                                                                end_point.into(),
                                                                                stops_vector,
                                                                                extend_mode.into()),
                                                      outset: outset.into(),
                                                  });
     state.frame_builder
          .dl_builder
-         .push_border(rect.into(), clip.into(), widths.into(), border_details);
+         .push_border(rect.into(),
+                      Some(LocalClip::Rect(clip.into())),
+                      widths.into(),
+                      border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
                                                     rect: WrRect,
                                                     clip: WrRect,
                                                     widths: WrBorderWidths,
                                                     center: WrPoint,
@@ -1588,17 +1599,20 @@ pub extern "C" fn wr_dp_push_border_radi
                                                    .create_radial_gradient(center.into(),
                                                                            radius.into(),
                                                                            stops_vector,
                                                                            extend_mode.into()),
                                           outset: outset.into(),
                                       });
     state.frame_builder
          .dl_builder
-         .push_border(rect.into(), clip.into(), widths.into(), border_details);
+         .push_border(rect.into(),
+                      Some(LocalClip::Rect(clip.into())),
+                      widths.into(),
+                      border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
                                              rect: WrRect,
                                              clip: WrRect,
                                              start_point: WrPoint,
                                              end_point: WrPoint,
@@ -1613,22 +1627,23 @@ pub extern "C" fn wr_dp_push_linear_grad
     let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
 
     let gradient = state.frame_builder
                         .dl_builder
                         .create_gradient(start_point.into(),
                                          end_point.into(),
                                          stops_vector,
                                          extend_mode.into());
-    let rect = rect.into();
-    let tile_size = tile_size.into();
-    let tile_spacing = tile_spacing.into();
     state.frame_builder
          .dl_builder
-         .push_gradient(rect, clip.into(), gradient, tile_size, tile_spacing);
+         .push_gradient(rect.into(),
+                        Some(LocalClip::Rect(clip.into())),
+                        gradient,
+                        tile_size.into(),
+                        tile_spacing.into());
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
                                              rect: WrRect,
                                              clip: WrRect,
                                              center: WrPoint,
                                              radius: WrSize,
@@ -1643,22 +1658,23 @@ pub extern "C" fn wr_dp_push_radial_grad
     let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
 
     let gradient = state.frame_builder
                         .dl_builder
                         .create_radial_gradient(center.into(),
                                                 radius.into(),
                                                 stops_vector,
                                                 extend_mode.into());
-    let rect = rect.into();
-    let tile_size = tile_size.into();
-    let tile_spacing = tile_spacing.into();
     state.frame_builder
          .dl_builder
-         .push_radial_gradient(rect, clip.into(), gradient, tile_size, tile_spacing);
+         .push_radial_gradient(rect.into(),
+                               Some(LocalClip::Rect(clip.into())),
+                               gradient,
+                               tile_size.into(),
+                               tile_spacing.into());
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState,
                                         rect: WrRect,
                                         clip: WrRect,
                                         box_bounds: WrRect,
                                         offset: WrPoint,
@@ -1667,17 +1683,17 @@ pub extern "C" fn wr_dp_push_box_shadow(
                                         spread_radius: f32,
                                         border_radius: f32,
                                         clip_mode: WrBoxShadowClipMode) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder
          .dl_builder
          .push_box_shadow(rect.into(),
-                          clip.into(),
+                          Some(LocalClip::Rect(clip.into())),
                           box_bounds.into(),
                           offset.into(),
                           color.into(),
                           blur_radius,
                           spread_radius,
                           border_radius,
                           clip_mode);
 }