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

Unified Diff: skia/ext/canvas_paint_win.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_win.h
diff --git a/skia/ext/canvas_paint_win.h b/skia/ext/canvas_paint_win.h
index 5fe22fc9947fbd073e996c98eadde79c9dea7eef..4bc908f03cd5019dca3fc9ef768d5af5d111e80b 100644
--- a/skia/ext/canvas_paint_win.h
+++ b/skia/ext/canvas_paint_win.h
@@ -6,6 +6,7 @@
#define SKIA_EXT_CANVAS_PAINT_WIN_H_
#pragma once
+#include "skia/ext/canvas_paint_common.h"
#include "skia/ext/platform_canvas.h"
namespace skia {
@@ -60,9 +61,10 @@ class CanvasPaintT : public T {
virtual ~CanvasPaintT() {
if (!isEmpty()) {
- restoreToCount(1);
+ PlatformCanvas* canvas = GetPlatformCanvas(this);
+ canvas->restoreToCount(1);
// Commit the drawing to the screen
- skia::DrawToNativeContext(this, paint_dc_, ps_.rcPaint.left,
+ skia::DrawToNativeContext(canvas, paint_dc_, ps_.rcPaint.left,
ps_.rcPaint.top, NULL);
}
if (for_paint_)
@@ -100,21 +102,22 @@ class CanvasPaintT : public T {
}
void init(bool opaque) {
+ PlatformCanvas* canvas = GetPlatformCanvas(this);
// FIXME(brettw) for ClearType, we probably want to expand the bounds of
// painting by one pixel so that the boundaries will be correct (ClearType
// text can depend on the adjacent pixel). Then we would paint just the
// inset pixels to the screen.
const int width = ps_.rcPaint.right - ps_.rcPaint.left;
const int height = ps_.rcPaint.bottom - ps_.rcPaint.top;
- if (!initialize(width, height, opaque, NULL)) {
+ if (!canvas->initialize(width, height, opaque, NULL)) {
// Cause a deliberate crash;
*(char*) 0 = 0;
}
// This will bring the canvas into the screen coordinate system for the
// dirty rect
- translate(SkIntToScalar(-ps_.rcPaint.left),
- SkIntToScalar(-ps_.rcPaint.top));
+ canvas->translate(SkIntToScalar(-ps_.rcPaint.left),
+ SkIntToScalar(-ps_.rcPaint.top));
}
// If true, this canvas was created for a BeginPaint.
« no previous file with comments | « skia/ext/canvas_paint_wayland.h ('k') | skia/ext/canvas_paint_x.h » ('j') | ui/gfx/canvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698