Bug 1396489 - Part 2. Make gfxContext::GetClipExtents can return clipped rect in either user space or device space. r=mstange
☠☠ backed out by 6106d550ba96 ☠ ☠
authorcku <cku@mozilla.com>
Mon, 04 Sep 2017 12:32:03 +0800
changeset 378821 fc779b639aebd3687932a61748384648a5426eaf
parent 378820 dcfd73044bbabcfd43d767282a111c3d2cd45863
child 378822 75ffa3ed13d525f97f23e839a0ebfcbdeabb91ea
push id32442
push userarchaeopteryx@coole-files.de
push dateTue, 05 Sep 2017 09:39:11 +0000
treeherdermozilla-central@35bd47b6e5ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1396489
milestone57.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 1396489 - Part 2. Make gfxContext::GetClipExtents can return clipped rect in either user space or device space. r=mstange MozReview-Commit-ID: 8orKmq1vz8K
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -590,27 +590,29 @@ gfxContext::PopClip()
 {
   MOZ_ASSERT(CurrentState().pushedClips.Length() > 0);
 
   CurrentState().pushedClips.RemoveElementAt(CurrentState().pushedClips.Length() - 1);
   mDT->PopClip();
 }
 
 gfxRect
-gfxContext::GetClipExtents() const
+gfxContext::GetClipExtents(ClipExtentsSpace aSpace) const
 {
   Rect rect = GetAzureDeviceSpaceClipBounds();
 
   if (rect.width == 0 || rect.height == 0) {
     return gfxRect(0, 0, 0, 0);
   }
 
-  Matrix mat = mTransform;
-  mat.Invert();
-  rect = mat.TransformBounds(rect);
+  if (aSpace == eUserSpace) {
+    Matrix mat = mTransform;
+    mat.Invert();
+    rect = mat.TransformBounds(rect);
+  }
 
   return ThebesRect(rect);
 }
 
 bool
 gfxContext::ExportClip(ClipExporter& aExporter)
 {
   for (unsigned int i = 0; i < mStateStack.Length(); i++) {
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -372,21 +372,26 @@ public:
      * Any current path will be destroyed by these functions!
      */
     void Clip(const Rect& rect);
     void Clip(const gfxRect& rect); // will clip to a rect
     void Clip(Path* aPath);
 
     void PopClip();
 
+    enum ClipExtentsSpace {
+        eUserSpace = 0,
+        eDeviceSpace = 1,
+    };
+
     /**
-     * This will return the current bounds of the clip region in user
-     * space.
+     * According to aSpace, this function will return the current bounds of
+     * the clip region in user space or device space.
      */
-    gfxRect GetClipExtents() const;
+    gfxRect GetClipExtents(ClipExtentsSpace aSpace = eUserSpace) const;
 
     /**
      * Returns true if the given rectangle is fully contained in the current clip.
      * This is conservative; it may return false even when the given rectangle is
      * fully contained by the current clip.
      */
     bool ClipContainsRect(const gfxRect& aRect);