Bug 1396489 - Part 1. Change gfxContext::GetClipExtents to a const function. draft
authorcku <cku@mozilla.com>
Mon, 04 Sep 2017 12:56:13 +0800
changeset 659012 0caedc7f54f257bafad4964fd38ca7a432e88e58
parent 658813 1401e3eec44df87963d3af329ef8a4183ab0483f
child 659013 3839dec3df9ed02a6c42576c1b2d51b3f5c1ee81
push id77980
push userbmo:cku@mozilla.com
push dateTue, 05 Sep 2017 10:11:55 +0000
bugs1396489
milestone57.0a1
Bug 1396489 - Part 1. Change gfxContext::GetClipExtents to a const function. MozReview-Commit-ID: ANFDAxeL5G0
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -590,17 +590,17 @@ gfxContext::PopClip()
 {
   MOZ_ASSERT(CurrentState().pushedClips.Length() > 0);
 
   CurrentState().pushedClips.RemoveElementAt(CurrentState().pushedClips.Length() - 1);
   mDT->PopClip();
 }
 
 gfxRect
-gfxContext::GetClipExtents()
+gfxContext::GetClipExtents() const
 {
   Rect rect = GetAzureDeviceSpaceClipBounds();
 
   if (rect.width == 0 || rect.height == 0) {
     return gfxRect(0, 0, 0, 0);
   }
 
   Matrix mat = mTransform;
@@ -1057,23 +1057,23 @@ gfxContext::ChangeTransform(const Matrix
   }
 
   mTransform = aNewMatrix;
 
   mDT->SetTransform(GetDTTransform());
 }
 
 Rect
-gfxContext::GetAzureDeviceSpaceClipBounds()
+gfxContext::GetAzureDeviceSpaceClipBounds() const
 {
   Rect rect(CurrentState().deviceOffset.x, CurrentState().deviceOffset.y,
             Float(mDT->GetSize().width), Float(mDT->GetSize().height));
   for (unsigned int i = 0; i < mStateStack.Length(); i++) {
     for (unsigned int c = 0; c < mStateStack[i].pushedClips.Length(); c++) {
-      AzureState::PushedClip &clip = mStateStack[i].pushedClips[c];
+      const AzureState::PushedClip &clip = mStateStack[i].pushedClips[c];
       if (clip.path) {
         Rect bounds = clip.path->GetBounds(clip.transform);
         rect.IntersectRect(rect, bounds);
       } else {
         rect.IntersectRect(rect, clip.transform.TransformBounds(clip.rect));
       }
     }
   }
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -376,17 +376,17 @@ public:
     void Clip(Path* aPath);
 
     void PopClip();
 
     /**
      * This will return the current bounds of the clip region in user
      * space.
      */
-    gfxRect GetClipExtents();
+    gfxRect GetClipExtents() 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);
 
@@ -514,17 +514,17 @@ private:
 
   // This ensures mPath contains a valid path (in user space!)
   void EnsurePath();
   // This ensures mPathBuilder contains a valid PathBuilder (in user space!)
   void EnsurePathBuilder();
   void FillAzure(const Pattern& aPattern, mozilla::gfx::Float aOpacity);
   CompositionOp GetOp();
   void ChangeTransform(const mozilla::gfx::Matrix &aNewMatrix, bool aUpdatePatternTransform = true);
-  Rect GetAzureDeviceSpaceClipBounds();
+  Rect GetAzureDeviceSpaceClipBounds() const;
   Matrix GetDeviceTransform() const;
   Matrix GetDTTransform() const;
 
   bool mPathIsRect;
   bool mTransformChanged;
   Matrix mPathTransform;
   Rect mRect;
   RefPtr<PathBuilder> mPathBuilder;