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

Unified Diff: include/core/SkSurface.h

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments from #6 Created 6 years, 3 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/SkSurface.h
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index cb5133ae003e4d89de0f2f376b749977aee715f4..417a06f1305635315dafca267a9026449de09c0f 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -10,6 +10,7 @@
#include "SkRefCnt.h"
#include "SkImage.h"
+#include "SkSurfaceProps.h"
class SkCanvas;
class SkPaint;
@@ -28,6 +29,8 @@ class SK_API SkSurface : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkSurface)
+ typedef SkSurfaceProps Props;
+
/**
* Create a new surface, using the specified pixels/rowbytes as its
* backend.
@@ -35,7 +38,8 @@ public:
* If the requested surface cannot be created, or the request is not a
* supported configuration, NULL will be returned.
*/
- static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes);
+ static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
+ const Props* = NULL);
/**
* The same as NewRasterDirect, but also accepts a call-back routine, which is invoked
@@ -43,7 +47,7 @@ public:
*/
static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo&, void* pixels, size_t rowBytes,
void (*releaseProc)(void* pixels, void* context),
- void* context);
+ void* context, const Props* = NULL);
/**
* Return a new surface, with the memory for the pixels automatically
@@ -52,15 +56,15 @@ public:
* If the requested surface cannot be created, or the request is not a
* supported configuration, NULL will be returned.
*/
- static SkSurface* NewRaster(const SkImageInfo&);
+ static SkSurface* NewRaster(const SkImageInfo&, const Props* = NULL);
/**
* Helper version of NewRaster. It creates a SkImageInfo with the
* specified width and height, and populates the rest of info to match
* pixels in SkPMColor format.
*/
- static SkSurface* NewRasterPMColor(int width, int height) {
- return NewRaster(SkImageInfo::MakeN32Premul(width, height));
+ static SkSurface* NewRasterPMColor(int width, int height, const Props* props = NULL) {
+ return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
}
/**
@@ -204,9 +208,11 @@ public:
*/
const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
+ const Props& props() const { return fProps; }
+
protected:
- SkSurface(int width, int height);
- SkSurface(const SkImageInfo&);
+ SkSurface(int width, int height, const Props&);
+ SkSurface(const SkImageInfo&, const Props&);
// called by subclass if their contents have changed
void dirtyGenerationID() {
@@ -214,6 +220,7 @@ protected:
}
private:
+ const Props fProps;
const int fWidth;
const int fHeight;
uint32_t fGenerationID;

Powered by Google App Engine
This is Rietveld 408576698