Bug 1477260 - Clip the rect in Matrix4x4TypedFlagged::TransformAndClipBounds, when transform is an identity matrix r=bas
authorMiko Mynttinen <mikokm@gmail.com>
Fri, 20 Jul 2018 17:28:37 +0200
changeset 427498 c1e307c1e6ec83a053ceeac73fef451eaf58346e
parent 427497 285ade739cd21e156a9236c3e4bd242b5837604c
child 427499 db6f301d2fd9be209d51ce46795398e59892cd68
push id34306
push usercsabou@mozilla.com
push dateFri, 20 Jul 2018 21:41:18 +0000
treeherdermozilla-central@d6a5e8aea651 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1477260
milestone63.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 1477260 - Clip the rect in Matrix4x4TypedFlagged::TransformAndClipBounds, when transform is an identity matrix r=bas MozReview-Commit-ID: 3a8vnl3K87n
gfx/2d/Matrix.h
--- a/gfx/2d/Matrix.h
+++ b/gfx/2d/Matrix.h
@@ -1902,17 +1902,19 @@ public:
     return Parent::TransformPoint(aPoint);
   }
 
   template<class F>
   RectTyped<TargetUnits, F> TransformAndClipBounds(const RectTyped<SourceUnits, F>& aRect,
                                                    const RectTyped<TargetUnits, F>& aClip) const
   {
     if (mType == MatrixType::Identity) {
-      return aRect;
+      const RectTyped<SourceUnits, F>& clipped = aRect.Intersect(aClip);
+      return RectTyped<TargetUnits, F>(clipped.X(), clipped.Y(),
+                                       clipped.Width(), clipped.Height());
     }
 
     if (mType == MatrixType::Simple) {
       PointTyped<UnknownUnits, F> p1 = TransformPointSimple(aRect.TopLeft());
       PointTyped<UnknownUnits, F> p2 = TransformPointSimple(aRect.TopRight());
       PointTyped<UnknownUnits, F> p3 = TransformPointSimple(aRect.BottomLeft());
       PointTyped<UnknownUnits, F> p4 = TransformPointSimple(aRect.BottomRight());