Index: ui/gfx/canvas_paint_mac.mm |
diff --git a/ui/gfx/canvas_paint_mac.mm b/ui/gfx/canvas_paint_mac.mm |
index 9d2bbb30d2f4c65c81c41405f137eec60f00eede..73ed62abc6c348be272fb96c967c4a98454975ea 100644 |
--- a/ui/gfx/canvas_paint_mac.mm |
+++ b/ui/gfx/canvas_paint_mac.mm |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/mac/mac_util.h" |
+#include "third_party/skia/include/utils/mac/SkCGUtils.h" |
#include "ui/gfx/canvas_paint_mac.h" |
#include "ui/gfx/geometry/size.h" |
@@ -25,8 +27,14 @@ CanvasSkiaPaint::~CanvasSkiaPaint() { |
canvas->restoreToCount(1); |
// Blit the dirty rect to the current context. |
- CGImageRef image = |
- CGBitmapContextCreateImage(skia::GetNativeDrawingContext(canvas)); |
+ SkPixmap pixmap; |
+ bool success = canvas->peekPixels(&pixmap); |
+ DCHECK(success); |
+ SkBitmap bitmap; |
+ success = bitmap.installPixels(pixmap); |
+ DCHECK(success); |
+ CGImageRef image = SkCreateCGImageRefWithColorspace( |
+ bitmap, base::mac::GetSystemColorSpace()); |
CGRect dest_rect = NSRectToCGRect(rectangle_); |
CGContextRef destination_context = |