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

Unified Diff: src/gpu/SkGpuDevice.h

Issue 1205643002: Make SkGpuDevice know its alpha type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: extra \n Created 5 years, 6 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: src/gpu/SkGpuDevice.h
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index f71450d7c99faa82db85e1fb88037da63778b1b2..ed6ad028313ee32f76e3479a61751779ead5a1a5 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -30,21 +30,22 @@ struct GrCachedLayer;
*/
class SK_API SkGpuDevice : public SkBaseDevice {
public:
- enum Flags {
- kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
+ enum InitContents {
reed1 2015/06/23 20:05:03 Boy oh boy, we should consider this sort of thing
+ kClear_InitContents,
+ kUninit_InitContents
};
/**
* Creates an SkGpuDevice from a GrRenderTarget.
*/
- static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, unsigned flags = 0);
+ static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, InitContents);
/**
* Creates an SkGpuDevice from a GrRenderTarget whose texture width/height is
* different than its actual width/height (e.g., approx-match scratch texture).
*/
static SkGpuDevice* Create(GrRenderTarget* target, int width, int height,
- const SkSurfaceProps*, unsigned flags = 0);
+ const SkSurfaceProps*, InitContents);
/**
* New device that will create an offscreen renderTarget based on the ImageInfo and
@@ -52,7 +53,7 @@ public:
* the resource cache budget. On failure, returns NULL.
*/
static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInfo&,
- int sampleCount, const SkSurfaceProps*, unsigned flags = 0);
+ int sampleCount, const SkSurfaceProps*, InitContents);
virtual ~SkGpuDevice();
@@ -153,6 +154,15 @@ private:
// remove when our clients don't rely on accessBitmap()
SkBitmap fLegacyBitmap;
bool fNeedClear;
+ bool fOpaque;
+
+ enum Flags {
+ kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
+ kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this device will be
+ // opaque even if the config supports alpha.
+ };
robertphillips 2015/06/23 19:48:09 Do we need the "SkGpuDevice::" here ?
bsalomon 2015/06/25 21:47:18 Done.
+ static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, SkGpuDevice::InitContents init,
+ unsigned* flags);
SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, unsigned flags);
« no previous file with comments | « src/gpu/GrSurfacePriv.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | src/gpu/SkGpuDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698