aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkSurface.h
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-09-21 10:25:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-21 10:25:07 -0700
commit29c857d0f3a1cb837f73406eeb6ba9771879b5e7 (patch)
tree135d517cf36f82b7f6f02fd81bfef92eb8befe34 /include/core/SkSurface.h
parent3716fd067a5621bb94a6cb08d72afec8bf3aceda (diff)
Revert of introduce Props to surface (patchset #27 id:520001 of https://codereview.chromium.org/551463004/)
Reason for revert: Broke call site in WebKit Original issue's description: > introduce Props to surface (work in progress) > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/3716fd067a5621bb94a6cb08d72afec8bf3aceda R=robertphillips@google.com, bsalomon@google.com, jvanverth@google.com, bungeman@google.com, fmalita@google.com, vangelis@chromium.org, reed@google.com TBR=bsalomon@google.com, bungeman@google.com, fmalita@google.com, jvanverth@google.com, reed@google.com, robertphillips@google.com, vangelis@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Author: reed@chromium.org Review URL: https://codereview.chromium.org/583773004
Diffstat (limited to 'include/core/SkSurface.h')
-rw-r--r--include/core/SkSurface.h89
1 files changed, 33 insertions, 56 deletions
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index e0e60ab7fb..1871c676f2 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -10,9 +10,6 @@
#include "SkRefCnt.h"
#include "SkImage.h"
-#include "SkSurfaceProps.h"
-
-//#define SK_SUPPORT_LEGACY_TEXTRENDERMODE
class SkCanvas;
class SkPaint;
@@ -38,8 +35,7 @@ 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,
- const SkSurfaceProps* = NULL);
+ static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes);
/**
* The same as NewRasterDirect, but also accepts a call-back routine, which is invoked
@@ -47,7 +43,7 @@ public:
*/
static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo&, void* pixels, size_t rowBytes,
void (*releaseProc)(void* pixels, void* context),
- void* context, const SkSurfaceProps* = NULL);
+ void* context);
/**
* Return a new surface, with the memory for the pixels automatically
@@ -56,36 +52,45 @@ 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&, const SkSurfaceProps* = NULL);
+ static SkSurface* NewRaster(const SkImageInfo&);
/**
* 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, const SkSurfaceProps* props = NULL) {
- return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
+ static SkSurface* NewRasterPMColor(int width, int height) {
+ return NewRaster(SkImageInfo::MakeN32Premul(width, height));
}
/**
+ * Text rendering modes that can be passed to NewRenderTarget*
+ */
+ enum TextRenderMode {
+ /**
+ * This will use the standard text rendering method
+ */
+ kStandard_TextRenderMode,
+ /**
+ * This will use signed distance fields for text rendering when possible
+ */
+ kDistanceField_TextRenderMode,
+ };
+
+ /**
* Return a new surface using the specified render target.
+ * The pixels in the rendertarget are not cleared or otherwised changed when the surface
+ * is created.
*/
- static SkSurface* NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*);
-
- static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
- return NewRenderTargetDirect(target, NULL);
- }
-
+ static SkSurface* NewRenderTargetDirect(GrRenderTarget*,
+ TextRenderMode trm = kStandard_TextRenderMode);
+
/**
* Return a new surface whose contents will be drawn to an offscreen
* render target, allocated by the surface.
*/
- static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
- const SkSurfaceProps* = NULL);
-
- static SkSurface* NewRenderTarget(GrContext* gr, const SkImageInfo& info) {
- return NewRenderTarget(gr, info, 0, NULL);
- }
+ static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sampleCount = 0,
+ TextRenderMode trm = kStandard_TextRenderMode);
/**
* Return a new surface whose contents will be drawn to an offscreen
@@ -99,33 +104,8 @@ public:
* Note: Scratch textures count against the GrContext's cached resource
* budget.
*/
- static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
- const SkSurfaceProps*);
-
- static SkSurface* NewScratchRenderTarget(GrContext* gr, const SkImageInfo& info) {
- return NewScratchRenderTarget(gr, info, 0, NULL);
- }
-
-#ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE
- /**
- * Text rendering modes that can be passed to NewRenderTarget*
- */
- enum TextRenderMode {
- /**
- * This will use the standard text rendering method
- */
- kStandard_TextRenderMode,
- /**
- * This will use signed distance fields for text rendering when possible
- */
- kDistanceField_TextRenderMode,
- };
- static SkSurface* NewRenderTargetDirect(GrRenderTarget*, TextRenderMode);
- static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
- TextRenderMode);
- static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
- TextRenderMode);
-#endif
+ static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount = 0,
+ TextRenderMode trm = kStandard_TextRenderMode);
int width() const { return fWidth; }
int height() const { return fHeight; }
@@ -214,11 +194,9 @@ public:
*/
const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
- const SkSurfaceProps& props() const { return fProps; }
-
protected:
- SkSurface(int width, int height, const SkSurfaceProps*);
- SkSurface(const SkImageInfo&, const SkSurfaceProps*);
+ SkSurface(int width, int height);
+ SkSurface(const SkImageInfo&);
// called by subclass if their contents have changed
void dirtyGenerationID() {
@@ -226,10 +204,9 @@ protected:
}
private:
- const SkSurfaceProps fProps;
- const int fWidth;
- const int fHeight;
- uint32_t fGenerationID;
+ const int fWidth;
+ const int fHeight;
+ uint32_t fGenerationID;
typedef SkRefCnt INHERITED;
};