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

Unified Diff: skia/ext/canvas_paint_x.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_x.h
diff --git a/skia/ext/canvas_paint_x.h b/skia/ext/canvas_paint_x.h
index a9f51d2026f83e9769d710f5d83ceaf3b62b38d8..e8e3c68bedc410230baba755f106ca66e6c72a60 100644
--- a/skia/ext/canvas_paint_x.h
+++ b/skia/ext/canvas_paint_x.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/logging.h"
+#include "skia/ext/canvas_paint_common.h"
#include "skia/ext/platform_canvas.h"
#include <cairo/cairo.h>
@@ -41,7 +42,8 @@ class CanvasPaintT : public T {
virtual ~CanvasPaintT() {
if (!is_empty()) {
- T::restoreToCount(1);
+ PlatformCanvas* canvas = GetPlatformCanvas(this);
+ canvas->restoreToCount(1);
// Blit the dirty rect to the window.
CHECK(cairo_window_surface_);
@@ -81,16 +83,18 @@ class CanvasPaintT : public T {
private:
void init(bool opaque) {
- if (!T::initialize(region_->width, region_->height, opaque, NULL)) {
+ PlatformCanvas* canvas = GetPlatformCanvas(this);
+ if (!canvas->initialize(region_->width, region_->height, opaque, NULL)) {
// Cause a deliberate crash;
CHECK(false);
}
// Need to translate so that the dirty region appears at the origin of the
// surface.
- T::translate(-SkDoubleToScalar(region_->x), -SkDoubleToScalar(region_->y));
+ canvas->translate(-SkDoubleToScalar(region_->x),
+ -SkDoubleToScalar(region_->y));
- context_ = BeginPlatformPaint(this);
+ context_ = BeginPlatformPaint(canvas);
}
cairo_t* context_;
« no previous file with comments | « skia/ext/canvas_paint_win.h ('k') | ui/aura/demo/demo_main.cc » ('j') | ui/gfx/canvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698