Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Unified Diff: third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm

Issue 1956583002: Clamp Mac theme painting to reasonable large bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm
diff --git a/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm b/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm
index cb50058ead46f319891930a36e83fdad78b86378..514d07b2916d8ba6bb5215e6359fb41890b38c6c 100644
--- a/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm
+++ b/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm
@@ -27,18 +27,13 @@
namespace blink {
LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
- : LocalCurrentGraphicsContext(graphicsContext.canvas(), graphicsContext.deviceScaleFactor(), nullptr, dirtyRect)
+ : LocalCurrentGraphicsContext(graphicsContext.canvas(), graphicsContext.deviceScaleFactor(), dirtyRect)
{
}
-LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(GraphicsContext& graphicsContext, const IntRect* interestRect,
- const IntRect& dirtyRect)
- : LocalCurrentGraphicsContext(graphicsContext.canvas(), graphicsContext.deviceScaleFactor(), interestRect, dirtyRect)
-{
-}
+static const int kPixelDistanceToClamp = 4000;
-LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(SkCanvas* canvas, float deviceScaleFactor, const IntRect* interestRect,
- const IntRect& dirtyRect)
+LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(SkCanvas* canvas, float deviceScaleFactor, const IntRect& dirtyRect)
: m_didSetGraphicsContext(false)
, m_inflatedDirtyRect(ThemeMac::inflateRectForAA(dirtyRect))
, m_skiaBitLocker(canvas,
@@ -48,10 +43,10 @@ LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(SkCanvas* canvas, float
m_savedCanvas = canvas;
canvas->save();
- bool clipToInterest = interestRect && !interestRect->contains(m_inflatedDirtyRect);
- if (clipToInterest) {
+ IntRect clampRect(0, 0, kPixelDistanceToClamp, kPixelDistanceToClamp);
+ if (!clampRect.contains(m_inflatedDirtyRect)) {
chrishtr 2016/05/05 23:50:58 I think you need to adjust clampRect by the paint
wkorman 2016/05/06 22:42:55 Reworked this and added a comment.
IntRect clippedBounds(m_inflatedDirtyRect);
- clippedBounds.intersect(*interestRect);
+ clippedBounds.intersect(clampRect);
canvas->clipRect(clippedBounds, SkRegion::kIntersect_Op);
}
« no previous file with comments | « third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698