Chromium Code Reviews| Index: include/core/SkSurface.h |
| diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h |
| index cb5133ae003e4d89de0f2f376b749977aee715f4..2ebd1e6282b8c519714473da2299e7c24f798d42 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); |
| } |
| /** |
| @@ -101,6 +105,10 @@ public: |
| TextRenderMode trm = kStandard_TextRenderMode, |
| RenderTargetFlags flags = kNone_RenderTargetFlag); |
| + static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sampleCount, |
|
bsalomon
2014/09/18 18:43:32
Can we deprecate the above version? What do you th
reed1
2014/09/18 21:03:12
Done.
|
| + const SkSurfaceProps&, |
| + RenderTargetFlags flags = kNone_RenderTargetFlag); |
| + |
| /** |
| * Return a new surface whose contents will be drawn to an offscreen |
| * render target, allocated by the surface from the scratch texture pool |
| @@ -204,9 +212,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 +224,7 @@ protected: |
| } |
| private: |
| + const Props fProps; |
| const int fWidth; |
| const int fHeight; |
| uint32_t fGenerationID; |