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

Unified Diff: include/core/SkCanvas.h

Issue 154163002: remove SkCanvas::createCompatibleDevice, and add SkCanvas::newSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index c98ad996f0786caccf75d3f74dca3dbc68edda10..af42c129ed915e9b153edfceaebb6fce2c3e946f 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef SkCanvas_DEFINED
#define SkCanvas_DEFINED
@@ -20,6 +18,8 @@
#include "SkRegion.h"
#include "SkXfermode.h"
+//#define SK_SUPPORT_LEGACY_CANVAS_CREATECOMPATIBLEDEVICE
+
class SkBounder;
class SkBaseDevice;
class SkDraw;
@@ -27,6 +27,7 @@ class SkDrawFilter;
class SkMetaData;
class SkPicture;
class SkRRect;
+class SkSurface;
class SkSurface_Base;
class GrContext;
@@ -112,6 +113,7 @@ public:
*/
SkBaseDevice* getTopDevice(bool updateMatrixClip = false) const;
+#ifdef SK_SUPPORT_LEGACY_CANVAS_CREATECOMPATIBLEDEVICE
/**
* Shortcut for getDevice()->createCompatibleDevice(...).
* If getDevice() == NULL, this method does nothing, and returns NULL.
@@ -119,6 +121,13 @@ public:
SkBaseDevice* createCompatibleDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque);
+#endif
+
+ /**
+ * Create a new surface matching the specified info, one that attempts to
+ * be maximally compatible when used with this canvas.
scroggo 2014/02/05 16:41:12 What does it mean to be used with this canvas? Dra
+ */
+ SkSurface* newSurface(const SkImageInfo&);
/**
* Return the GPU context of the device that is associated with the canvas.
@@ -1019,6 +1028,9 @@ public:
};
protected:
+ // default impl defers to getDevice()->newSurface(info)
+ virtual SkSurface* onNewSurface(const SkImageInfo&);
+
// Returns the canvas to be used by DrawIter. Default implementation
// returns this. Subclasses that encapsulate an indirect canvas may
// need to overload this method. The impl must keep track of this, as it

Powered by Google App Engine
This is Rietveld 408576698