Bug 1396489 - Part 1. Change gfxContext::GetClipExtents to a const function.
MozReview-Commit-ID: ANFDAxeL5G0
--- 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;