Bug 1535273 - Remove webrender::util::rect_is_empty. r=kats
☠☠ backed out by 9dcc555ea352 ☠ ☠
authorNicolas Silva <nsilva@mozilla.com>
Thu, 14 Mar 2019 11:23:39 +0100
changeset 525098 ae26f98bfa7c92874a27c9f734fe0f861ac669ad
parent 525097 df478b79c9b36db774066005f066de5d9909c5d6
child 525099 9dcc555ea352f0dc8bdf58dc82bf57e4d0bfedd0
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1535273
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535273 - Remove webrender::util::rect_is_empty. r=kats
gfx/wr/webrender/src/texture_allocator.rs
gfx/wr/webrender/src/util.rs
--- a/gfx/wr/webrender/src/texture_allocator.rs
+++ b/gfx/wr/webrender/src/texture_allocator.rs
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 use api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
-use util;
 
 //TODO: gather real-world statistics on the bin usage in order to assist the decision
 // on where to place the size thresholds.
 
 /// This is an optimization tweak to enable looking through all the free rectangles in a bin
 /// and choosing the smallest, as opposed to picking the first match.
 const FIND_SMALLEST_AREA: bool = false;
 
@@ -162,20 +161,20 @@ impl ArrayAllocationTracker {
                 DeviceIntSize::new(
                     chosen.rect.size.width,
                     candidate_free_rect_to_bottom.size.height,
                 ),
             )
         }
 
         // Add the guillotined rects back to the free list.
-        if !util::rect_is_empty(&new_free_rect_to_right) {
+        if !new_free_rect_to_right.is_empty() {
             self.push(chosen.slice, new_free_rect_to_right);
         }
-        if !util::rect_is_empty(&new_free_rect_to_bottom) {
+        if !new_free_rect_to_bottom.is_empty() {
             self.push(chosen.slice, new_free_rect_to_bottom);
         }
     }
 
     pub fn allocate(
         &mut self, requested_dimensions: &DeviceIntSize
     ) -> Option<(FreeRectSlice, DeviceIntPoint)> {
         if requested_dimensions.width == 0 || requested_dimensions.height == 0 {
--- a/gfx/wr/webrender/src/util.rs
+++ b/gfx/wr/webrender/src/util.rs
@@ -2,17 +2,16 @@
  * 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/. */
 
 use api::BorderRadius;
 use api::units::*;
 use euclid::{TypedPoint2D, TypedRect, TypedSize2D, Vector2D};
 use euclid::{TypedTransform2D, TypedTransform3D, TypedVector2D, TypedScale};
 use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
-use num_traits::Zero;
 use plane_split::{Clipper, Polygon};
 use std::{i32, f32, fmt, ptr};
 use std::borrow::Cow;
 use std::os::raw::c_void;
 use std::sync::Arc;
 use std::mem::replace;
 
 
@@ -410,22 +409,16 @@ impl<U> RectHelpers<U> for TypedRect<f32
         )
     }
 
     fn is_well_formed_and_nonempty(&self) -> bool {
         self.size.width > 0.0 && self.size.height > 0.0
     }
 }
 
-// Don't use `euclid`'s `is_empty` because that has effectively has an "and" in the conditional
-// below instead of an "or".
-pub fn rect_is_empty<N: PartialEq + Zero, U>(rect: &TypedRect<N, U>) -> bool {
-    rect.size.width == Zero::zero() || rect.size.height == Zero::zero()
-}
-
 #[allow(dead_code)]
 #[inline]
 pub fn rect_from_points_f(x0: f32, y0: f32, x1: f32, y1: f32) -> Rect<f32> {
     Rect::new(Point2D::new(x0, y0), Size2D::new(x1 - x0, y1 - y0))
 }
 
 pub fn lerp(a: f32, b: f32, t: f32) -> f32 {
     (b - a) * t + a