 Chromium Code Reviews
 Chromium Code Reviews Issue 417153002:
  Avoid passing uninitialized value to markRectAsNonOpaque.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 417153002:
  Avoid passing uninitialized value to markRectAsNonOpaque.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/platform/graphics/skia/OpaqueRegionSkia.cpp | 
| diff --git a/Source/platform/graphics/skia/OpaqueRegionSkia.cpp b/Source/platform/graphics/skia/OpaqueRegionSkia.cpp | 
| index 24c0369d2ee641c597367d4f4541d6d0d6364fa1..5ccacbe40bd4745b6b423016c17831467aea09fe 100644 | 
| --- a/Source/platform/graphics/skia/OpaqueRegionSkia.cpp | 
| +++ b/Source/platform/graphics/skia/OpaqueRegionSkia.cpp | 
| @@ -156,8 +156,10 @@ static inline bool paintIsOpaque(const SkPaint& paint, OpaqueRegionSkia::DrawTyp | 
| 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)) | 
| @@ -331,7 +333,7 @@ void OpaqueRegionSkia::applyOpaqueRegionFromLayer(const GraphicsContext* context | 
| SkRect deviceClipRect; | 
| bool deviceClipIsARect = getDeviceClipAsRect(context, deviceClipRect); | 
| - if (deviceClipRect.isEmpty()) | 
| + if (deviceClipRect.isEmpty() && deviceClipIsARect) | 
| 
danakj
2014/07/28 14:03:57
reverse this order
 
sohanjg
2014/07/30 10:23:46
Done.
 | 
| return; | 
| SkRect sourceOpaqueRect = layerOpaqueRect; | 
| @@ -339,11 +341,9 @@ void OpaqueRegionSkia::applyOpaqueRegionFromLayer(const GraphicsContext* context | 
| SkRect destinationOpaqueRect = currentTrackingOpaqueRect(); | 
| bool outsideSourceOpaqueRectPreservesOpaque = xfermodePreservesOpaque(paint, false); | 
| - if (!outsideSourceOpaqueRectPreservesOpaque) | 
| - markRectAsNonOpaque(deviceClipRect); | 
| + if (!outsideSourceOpaqueRectPreservesOpaque && !deviceClipIsARect) | 
| + markAllAsNonOpaque(); | 
| 
danakj
2014/07/28 14:03:56
if it is a rect, you need to still do what we did
 
sohanjg
2014/07/30 10:23:46
Done.
 | 
| - if (!deviceClipIsARect) | 
| - return; | 
| if (!sourceOpaqueRect.intersect(deviceClipRect)) | 
| return; |