Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1535273) for webrender bustages CLOSED TREE
Browse files Browse the repository at this point in the history
Backed out changeset ae26f98bfa7c (bug 1535273)
Backed out changeset df478b79c9b3 (bug 1535273)

[wrupdater] From https://hg.mozilla.org/mozilla-central/rev/9dcc555ea352f0dc8bdf58dc82bf57e4d0bfedd0
  • Loading branch information
nerli1 authored and wrupdater committed Mar 15, 2019
1 parent 8fc4ea0 commit e93854c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions webrender/src/texture_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* 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.
Expand Down Expand Up @@ -166,10 +167,10 @@ impl ArrayAllocationTracker {
}

// Add the guillotined rects back to the free list.
if !new_free_rect_to_right.is_empty() {
if !util::rect_is_empty(&new_free_rect_to_right) {
self.push(chosen.slice, new_free_rect_to_right);
}
if !new_free_rect_to_bottom.is_empty() {
if !util::rect_is_empty(&new_free_rect_to_bottom) {
self.push(chosen.slice, new_free_rect_to_bottom);
}
}
Expand Down
9 changes: 8 additions & 1 deletion webrender/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

use api::BorderRadius;
use api::units::*;
use euclid::{TypedPoint2D, TypedRect, TypedSize2D, Vector2D};
use euclid::{Point2D, Rect, Size2D, 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;
Expand Down Expand Up @@ -414,6 +415,12 @@ impl<U> RectHelpers<U> for TypedRect<f32, U> {
}
}

// 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> {
Expand Down

0 comments on commit e93854c

Please sign in to comment.