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

Unified Diff: Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp

Issue 9328008: Merge 106663 - [Chromium] Use the current clip when marking paints as opaque (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 11 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 | « Source/WebCore/ChangeLog ('k') | Source/WebCore/platform/graphics/skia/PlatformContextSkia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp
===================================================================
--- Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp (revision 106688)
+++ Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp (working copy)
@@ -34,6 +34,7 @@
#include "PlatformContextSkia.h"
+#include "SkCanvas.h"
#include "SkShader.h"
namespace WebCore {
@@ -236,19 +237,29 @@
}
}
-void OpaqueRegionSkia::markRectAsOpaque(const PlatformContextSkia* context, const SkRect& rect)
+void OpaqueRegionSkia::markRectAsOpaque(const PlatformContextSkia* context, const SkRect& paintRect)
{
// We want to keep track of an opaque region but bound its complexity at a constant size.
// We keep track of the largest rectangle seen by area. If we can add the new rect to this
// rectangle then we do that, as that is the cheapest way to increase the area returned
// without increasing the complexity.
- if (rect.isEmpty())
+ if (paintRect.isEmpty())
return;
if (!context->clippedToImage().isOpaque())
return;
- if (m_opaqueRect.contains(rect))
+ if (context->canvas()->getClipType() != SkCanvas::kRect_ClipType)
return;
+ if (m_opaqueRect.contains(paintRect))
+ return;
+
+ // Apply the current clip.
+ SkIRect deviceClip;
+ context->canvas()->getClipDeviceBounds(&deviceClip);
+ SkRect rect = paintRect;
+ if (!rect.intersect(SkIntToScalar(deviceClip.fLeft), SkIntToScalar(deviceClip.fTop), SkIntToScalar(deviceClip.fRight), SkIntToScalar(deviceClip.fBottom)))
+ return;
+
if (rect.contains(m_opaqueRect)) {
m_opaqueRect = rect;
return;
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | Source/WebCore/platform/graphics/skia/PlatformContextSkia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698