aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkBitmapDevice.h2
-rw-r--r--include/core/SkCanvas.h21
-rw-r--r--include/core/SkDevice.h4
-rw-r--r--include/core/SkSurface.h89
-rw-r--r--include/core/SkSurfaceProps.h80
5 files changed, 39 insertions, 157 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index 0ab0234772..39bbab63e5 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -155,7 +155,7 @@ private:
virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
- virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE;
+ virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE;
virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE;
virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE;
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 77038c3067..5088d7ded5 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -16,7 +16,6 @@
#include "SkRefCnt.h"
#include "SkPath.h"
#include "SkRegion.h"
-#include "SkSurfaceProps.h"
#include "SkXfermode.h"
#ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL
@@ -201,12 +200,8 @@ public:
* Create a new surface matching the specified info, one that attempts to
* be maximally compatible when used with this canvas. If there is no matching Surface type,
* NULL is returned.
- *
- * If surfaceprops is specified, those are passed to the new surface, otherwise the new surface
- * inherits the properties of the surface that owns this canvas. If this canvas has no parent
- * surface, then the new surface is created with default properties.
*/
- SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL);
+ SkSurface* newSurface(const SkImageInfo&);
/**
* Return the GPU context of the device that is associated with the canvas.
@@ -1197,7 +1192,7 @@ public:
protected:
// default impl defers to getDevice()->newSurface(info)
- virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&);
+ virtual SkSurface* onNewSurface(const SkImageInfo&);
// default impl defers to its device
virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes);
@@ -1287,8 +1282,6 @@ private:
// the first N recs that can fit here mean we won't call malloc
uint32_t fMCRecStorage[32];
- const SkSurfaceProps fProps;
-
int fSaveLayerCount; // number of successful saveLayer calls
int fCullCount; // number of active culls
@@ -1318,20 +1311,14 @@ private:
kDefault_InitFlags = 0,
kConservativeRasterClip_InitFlag = 1 << 0,
};
- SkCanvas(int width, int height, InitFlags);
- SkCanvas(SkBaseDevice*, const SkSurfaceProps*, InitFlags);
- SkCanvas(const SkBitmap&, const SkSurfaceProps&);
+ SkCanvas(int width, int height, InitFlags flags);
+ SkCanvas(SkBaseDevice*, InitFlags flags);
// needs gettotalclip()
friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*);
SkBaseDevice* createLayerDevice(const SkImageInfo&);
- // call this each time we attach ourselves to a device
- // - constructor
- // - internalSaveLayer
- void setupDevice(SkBaseDevice*);
-
SkBaseDevice* init(SkBaseDevice*, InitFlags);
/**
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 08320bf7b4..e74e95f2f3 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -288,7 +288,7 @@ protected:
protected:
// default impl returns NULL
- virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&);
+ virtual SkSurface* newSurface(const SkImageInfo&);
// default impl returns NULL
virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
@@ -343,8 +343,6 @@ protected:
virtual bool EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const SkMatrix*,
const SkPaint*);
- void setPixelGeometry(SkPixelGeometry geo);
-
private:
friend class SkCanvas;
friend struct DeviceCM; //for setMatrixClip
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;
};
diff --git a/include/core/SkSurfaceProps.h b/include/core/SkSurfaceProps.h
deleted file mode 100644
index 0154473914..0000000000
--- a/include/core/SkSurfaceProps.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkSurfaceProps_DEFINED
-#define SkSurfaceProps_DEFINED
-
-#include "SkTypes.h"
-
-/**
- * Description of how the LCD strips are arranged for each pixel. If this is unknown, or the
- * pixels are meant to be "portable" and/or transformed before showing (e.g. rotated, scaled)
- * then use kUnknown_SkPixelGeometry.
- */
-enum SkPixelGeometry {
- kUnknown_SkPixelGeometry,
- kRGB_H_SkPixelGeometry,
- kBGR_H_SkPixelGeometry,
- kRGB_V_SkPixelGeometry,
- kBGR_V_SkPixelGeometry,
-};
-
-// Returns true iff geo is a known geometry and is RGB.
-static inline bool SkPixelGeometryIsRGB(SkPixelGeometry geo) {
- return kRGB_H_SkPixelGeometry == geo || kRGB_V_SkPixelGeometry == geo;
-}
-
-// Returns true iff geo is a known geometry and is BGR.
-static inline bool SkPixelGeometryIsBGR(SkPixelGeometry geo) {
- return kBGR_H_SkPixelGeometry == geo || kBGR_V_SkPixelGeometry == geo;
-}
-
-// Returns true iff geo is a known geometry and is horizontal.
-static inline bool SkPixelGeometryIsH(SkPixelGeometry geo) {
- return kRGB_H_SkPixelGeometry == geo || kBGR_H_SkPixelGeometry == geo;
-}
-
-// Returns true iff geo is a known geometry and is vertical.
-static inline bool SkPixelGeometryIsV(SkPixelGeometry geo) {
- return kRGB_V_SkPixelGeometry == geo || kBGR_V_SkPixelGeometry == geo;
-}
-
-/**
- * Describes properties and constraints of a given SkSurface. The rendering engine can parse these
- * during drawing, and can sometimes optimize its performance (e.g. disabling an expensive
- * feature).
- */
-class SkSurfaceProps {
-public:
- enum Flags {
- kDisallowAntiAlias_Flag = 1 << 0,
- kDisallowDither_Flag = 1 << 1,
- kUseDistanceFieldFonts_Flag = 1 << 2,
- };
- SkSurfaceProps(uint32_t flags, SkPixelGeometry);
-
- enum InitType {
- kLegacyFontHost_InitType
- };
- SkSurfaceProps(InitType);
- SkSurfaceProps(uint32_t flags, InitType);
-
- uint32_t flags() const { return fFlags; }
- SkPixelGeometry pixelGeometry() const { return fPixelGeometry; }
-
- bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag); }
- bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Flag); }
- bool isUseDistanceFieldFonts() const { return SkToBool(fFlags & kUseDistanceFieldFonts_Flag); }
-
-private:
- SkSurfaceProps();
-
- uint32_t fFlags;
- SkPixelGeometry fPixelGeometry;
-};
-
-#endif