mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1151145 - Add assertions to detect unbalanced calls to CGContextSaveGState / CGContextRestoreGState. r=jrmuizel
--HG-- extra : rebase_source : d5f12fa26ec4524ec798704f3851c47215a79f31
This commit is contained in:
parent
4355f36a4c
commit
b0398aca4b
@ -1961,6 +1961,10 @@ DrawTargetCG::PushClipRect(const Rect &aRect)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
mSavedClipBounds.push_back(CGContextGetClipBoundingBox(mCg));
|
||||
#endif
|
||||
|
||||
CGContextSaveGState(mCg);
|
||||
|
||||
/* We go through a bit of trouble to temporarilly set the transform
|
||||
@ -1979,6 +1983,10 @@ DrawTargetCG::PushClip(const Path *aPath)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
mSavedClipBounds.push_back(CGContextGetClipBoundingBox(mCg));
|
||||
#endif
|
||||
|
||||
CGContextSaveGState(mCg);
|
||||
|
||||
CGContextBeginPath(mCg);
|
||||
@ -2013,6 +2021,13 @@ void
|
||||
DrawTargetCG::PopClip()
|
||||
{
|
||||
CGContextRestoreGState(mCg);
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(!mSavedClipBounds.empty(), "Unbalanced PopClip");
|
||||
MOZ_ASSERT(CGRectEqualToRect(mSavedClipBounds.back(), CGContextGetClipBoundingBox(mCg)),
|
||||
"PopClip didn't restore original clip");
|
||||
mSavedClipBounds.pop_back();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -207,6 +207,10 @@ private:
|
||||
|
||||
RefPtr<SourceSurfaceCGContext> mSnapshot;
|
||||
bool mMayContainInvalidPremultipliedData;
|
||||
|
||||
#ifdef DEBUG
|
||||
std::vector<CGRect> mSavedClipBounds;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user