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

Unified Diff: skia/ext/canvas_paint_mac.h

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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
Index: skia/ext/canvas_paint_mac.h
diff --git a/skia/ext/canvas_paint_mac.h b/skia/ext/canvas_paint_mac.h
index c4f45b252814c462e1c7b7f7e8fe4430130c3fd8..5b65be16c9b485da3c849dcbb9d969fd6db7ae7e 100644
--- a/skia/ext/canvas_paint_mac.h
+++ b/skia/ext/canvas_paint_mac.h
@@ -7,6 +7,7 @@
#define SKIA_EXT_CANVAS_PAINT_MAC_H_
#pragma once
+#include "skia/ext/canvas_paint_common.h"
#include "skia/ext/platform_canvas.h"
#import <Cocoa/Cocoa.h>
@@ -36,7 +37,7 @@ class CanvasPaintT : public T {
virtual ~CanvasPaintT() {
if (!is_empty()) {
- T::restoreToCount(1);
+ GetPlatformCanvas(this)->restoreToCount(1);
// Blit the dirty rect to the current context.
CGImageRef image = CGBitmapContextCreateImage(context_);
@@ -81,18 +82,20 @@ class CanvasPaintT : public T {
private:
void init(bool opaque) {
- if (!T::initialize(rectangle_.size.width, rectangle_.size.height,
- opaque, NULL)) {
+ PlatformCanvas* canvas = GetPlatformCanvas(this);
+ if (!canvas->initialize(rectangle_.size.width,
+ rectangle_.size.height,
+ opaque, NULL)) {
// Cause a deliberate crash;
*(volatile char*) 0 = 0;
}
// Need to translate so that the dirty region appears at the origin of the
// surface.
- T::translate(-SkDoubleToScalar(rectangle_.origin.x),
- -SkDoubleToScalar(rectangle_.origin.y));
+ canvas->translate(-SkDoubleToScalar(rectangle_.origin.x),
+ -SkDoubleToScalar(rectangle_.origin.y));
- context_ = GetBitmapContext(GetTopDevice(*this));
+ context_ = GetBitmapContext(GetTopDevice(*canvas));
}
CGContext* context_;
« no previous file with comments | « skia/ext/canvas_paint_gtk.h ('k') | skia/ext/canvas_paint_wayland.h » ('j') | ui/gfx/canvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698