mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
gfx: Stop cloning clipping regions so much.
Clipping regions can contain vectors and so can be expensive to copy.
This commit is contained in:
parent
983576ebaa
commit
940bff1f9c
5 changed files with 52 additions and 52 deletions
|
@ -761,16 +761,13 @@ impl ClippingRegion {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the intersection of this clipping region and the given rectangle.
|
||||
/// Mutates this clipping region to intersect with the given rectangle.
|
||||
///
|
||||
/// TODO(pcwalton): This could more eagerly eliminate complex clipping regions, at the cost of
|
||||
/// complexity.
|
||||
#[inline]
|
||||
pub fn intersect_rect(self, rect: &Rect<Au>) -> ClippingRegion {
|
||||
ClippingRegion {
|
||||
main: self.main.intersection(rect).unwrap_or(Rect::zero()),
|
||||
complex: self.complex,
|
||||
}
|
||||
pub fn intersect_rect(&mut self, rect: &Rect<Au>) {
|
||||
self.main = self.main.intersection(rect).unwrap_or(Rect::zero())
|
||||
}
|
||||
|
||||
/// Returns true if this clipping region might be nonempty. This can return false positives,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue