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

Unified Diff: Source/platform/graphics/RegionTracker.cpp

Issue 417153002: Avoid passing uninitialized value to markRectAsNonOpaque. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated tests. Created 6 years, 4 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/platform/graphics/GraphicsContextTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/RegionTracker.cpp
diff --git a/Source/platform/graphics/RegionTracker.cpp b/Source/platform/graphics/RegionTracker.cpp
index 3e7a8c7eee0285a1f5569becffa92a8a47830dd1..dd5689036bd3a208a62a0c28900a180dd7986197 100644
--- a/Source/platform/graphics/RegionTracker.cpp
+++ b/Source/platform/graphics/RegionTracker.cpp
@@ -173,8 +173,10 @@ static inline bool paintIsOpaque(const SkPaint& paint, RegionTracker::DrawType d
static inline bool getDeviceClipAsRect(const GraphicsContext* context, SkRect& deviceClipRect)
{
// Get the current clip in device coordinate space.
- if (!context->canvas()->isClipRect())
+ if (!context->canvas()->isClipRect()) {
+ deviceClipRect.setEmpty();
return false;
+ }
SkIRect deviceClipIRect;
if (context->canvas()->getClipDeviceBounds(&deviceClipIRect))
@@ -353,7 +355,7 @@ void RegionTracker::applyOpaqueRegionFromLayer(const GraphicsContext* context, c
SkRect deviceClipRect;
bool deviceClipIsARect = getDeviceClipAsRect(context, deviceClipRect);
- if (deviceClipRect.isEmpty())
+ if (deviceClipIsARect && deviceClipRect.isEmpty())
return;
SkRect sourceOpaqueRect = layerOpaqueRect;
@@ -361,8 +363,13 @@ void RegionTracker::applyOpaqueRegionFromLayer(const GraphicsContext* context, c
SkRect destinationOpaqueRect = currentTrackingOpaqueRect();
bool outsideSourceOpaqueRectPreservesOpaque = xfermodePreservesOpaque(paint, false);
- if (!outsideSourceOpaqueRectPreservesOpaque)
+ if (!outsideSourceOpaqueRectPreservesOpaque) {
+ if (!deviceClipIsARect) {
+ markAllAsNonOpaque();
+ return;
+ }
markRectAsNonOpaque(deviceClipRect);
+ }
if (!deviceClipIsARect)
return;
« no previous file with comments | « Source/platform/graphics/GraphicsContextTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698