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

Unified Diff: ui/gfx/canvas_paint_mac.mm

Issue 2612023003: don't need native-drawing-context for CanvasSkiaPaint (Closed)
Patch Set: rebase Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698