Bug 1660017 - Remove is_well_formed_and_nonempty. r=gw

We don't need it anymore now that Rect::is_empty catches negative values and NaN.

Differential Revision: https://phabricator.services.mozilla.com/D87601
This commit is contained in:
Nicolas Silva 2020-08-20 02:43:05 +00:00
parent 335b4750cb
commit 82a807015c
4 changed files with 9 additions and 15 deletions

View File

@ -10,7 +10,6 @@ use crate::scene_building::SceneBuilder;
use crate::spatial_tree::SpatialNodeIndex;
use crate::gpu_types::BoxShadowStretchMode;
use crate::render_task_cache::RenderTaskCacheEntryHandle;
use crate::util::RectHelpers;
use crate::internal_types::LayoutPrimitiveInfo;
#[derive(Debug, Clone, MallocSizeOf)]
@ -121,7 +120,7 @@ impl<'a> SceneBuilder<'a> {
let mut clips = Vec::with_capacity(2);
let (final_prim_rect, clip_radius) = match clip_mode {
BoxShadowClipMode::Outset => {
if !shadow_rect.is_well_formed_and_nonempty() {
if shadow_rect.is_empty() {
return;
}
@ -137,7 +136,7 @@ impl<'a> SceneBuilder<'a> {
(shadow_rect, shadow_radius)
}
BoxShadowClipMode::Inset => {
if shadow_rect.is_well_formed_and_nonempty() {
if !shadow_rect.is_empty() {
clips.push(ClipItemKey {
kind: ClipItemKeyKind::rounded_rect(
shadow_rect,
@ -207,7 +206,7 @@ impl<'a> SceneBuilder<'a> {
let prim_info = match clip_mode {
BoxShadowClipMode::Outset => {
// Certain spread-radii make the shadow invalid.
if !shadow_rect.is_well_formed_and_nonempty() {
if shadow_rect.is_empty() {
return;
}
@ -231,7 +230,7 @@ impl<'a> SceneBuilder<'a> {
// Inset shadows are still visible, even if the
// inset shadow rect becomes invalid (they will
// just look like a solid rectangle).
if shadow_rect.is_well_formed_and_nonempty() {
if !shadow_rect.is_empty() {
extra_clips.push(shadow_clip_source);
}

View File

@ -132,7 +132,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::collections::hash_map::Entry;
use std::ops::Range;
use crate::texture_cache::TextureCacheHandle;
use crate::util::{MaxRect, VecHelper, RectHelpers, MatrixHelpers, Recycler, raster_rect_to_device_pixels};
use crate::util::{MaxRect, VecHelper, MatrixHelpers, Recycler, raster_rect_to_device_pixels};
use crate::filterdata::{FilterDataHandle};
use crate::visibility::{PrimitiveVisibilityMask, PrimitiveVisibilityFlags, FrameVisibilityContext, FrameVisibilityState};
#[cfg(any(feature = "capture", feature = "replay"))]
@ -3690,7 +3690,7 @@ impl TileCacheInstance {
}
// If we didn't find any valid opaque backdrop, no subpixel AA allowed
if !self.backdrop.opaque_rect.is_well_formed_and_nonempty() {
if self.backdrop.opaque_rect.is_empty() {
return SubpixelMode::Deny;
}
@ -3744,7 +3744,7 @@ impl TileCacheInstance {
// Register the opaque region of this tile cache as an occluder, which
// is used later in the frame to occlude other tiles.
if self.backdrop.opaque_rect.is_well_formed_and_nonempty() {
if !self.backdrop.opaque_rect.is_empty() {
let backdrop_rect = self.backdrop.opaque_rect
.intersection(&self.local_rect)
.and_then(|r| {

View File

@ -52,7 +52,7 @@
use api::{BorderRadius, ClipMode, EdgeAaSegmentMask};
use api::units::*;
use std::{cmp, usize};
use crate::util::{extract_inner_rect_safe, RectHelpers};
use crate::util::{extract_inner_rect_safe};
use smallvec::SmallVec;
bitflags! {
@ -280,7 +280,7 @@ impl SegmentBuilder {
) {
self.has_interesting_clips = true;
if !inner_rect.is_well_formed_and_nonempty() {
if inner_rect.is_empty() {
self.items.push(Item::new(
outer_rect,
None,

View File

@ -503,7 +503,6 @@ where
Self: Sized,
{
fn from_floats(x0: f32, y0: f32, x1: f32, y1: f32) -> Self;
fn is_well_formed_and_nonempty(&self) -> bool;
fn snap(&self) -> Self;
}
@ -515,10 +514,6 @@ impl<U> RectHelpers<U> for Rect<f32, U> {
)
}
fn is_well_formed_and_nonempty(&self) -> bool {
self.size.width > 0.0 && self.size.height > 0.0
}
fn snap(&self) -> Self {
let origin = Point2D::new(
(self.origin.x + 0.5).floor(),