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

Side by Side 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: fix bench pictures :( Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrSurfacePriv.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkGpuDevice_DEFINED 9 #ifndef SkGpuDevice_DEFINED
10 #define SkGpuDevice_DEFINED 10 #define SkGpuDevice_DEFINED
(...skipping 12 matching lines...) Expand all
23 23
24 class GrAccelData; 24 class GrAccelData;
25 struct GrCachedLayer; 25 struct GrCachedLayer;
26 26
27 /** 27 /**
28 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th e 28 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th e
29 * canvas. 29 * canvas.
30 */ 30 */
31 class SK_API SkGpuDevice : public SkBaseDevice { 31 class SK_API SkGpuDevice : public SkBaseDevice {
32 public: 32 public:
33 enum Flags { 33 enum InitContents {
34 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear 34 kClear_InitContents,
35 kUninit_InitContents
35 }; 36 };
36 37
37 /** 38 /**
38 * Creates an SkGpuDevice from a GrRenderTarget. 39 * Creates an SkGpuDevice from a GrRenderTarget.
39 */ 40 */
40 static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, un signed flags = 0); 41 static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, In itContents);
41 42
42 /** 43 /**
43 * Creates an SkGpuDevice from a GrRenderTarget whose texture width/height i s 44 * Creates an SkGpuDevice from a GrRenderTarget whose texture width/height i s
44 * different than its actual width/height (e.g., approx-match scratch textur e). 45 * different than its actual width/height (e.g., approx-match scratch textur e).
45 */ 46 */
46 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height, 47 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height,
47 const SkSurfaceProps*, unsigned flags = 0); 48 const SkSurfaceProps*, InitContents);
48 49
49 /** 50 /**
50 * New device that will create an offscreen renderTarget based on the ImageI nfo and 51 * New device that will create an offscreen renderTarget based on the ImageI nfo and
51 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against 52 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against
52 * the resource cache budget. On failure, returns NULL. 53 * the resource cache budget. On failure, returns NULL.
53 */ 54 */
54 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&, 55 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&,
55 int sampleCount, const SkSurfaceProps*, unsigned flags = 0); 56 int sampleCount, const SkSurfaceProps*, InitConte nts);
56 57
57 virtual ~SkGpuDevice(); 58 virtual ~SkGpuDevice();
58 59
59 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { 60 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) {
60 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage, 61 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage,
61 props.pixelGeometry( )), 62 props.pixelGeometry( )),
62 NULL); 63 NULL);
63 return static_cast<SkGpuDevice*>(dev); 64 return static_cast<SkGpuDevice*>(dev);
64 } 65 }
65 66
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 GrContext* fContext; 147 GrContext* fContext;
147 GrSkDrawProcs* fDrawProcs; 148 GrSkDrawProcs* fDrawProcs;
148 SkAutoTUnref<const SkClipStack> fClipStack; 149 SkAutoTUnref<const SkClipStack> fClipStack;
149 SkIPoint fClipOrigin; 150 SkIPoint fClipOrigin;
150 GrClip fClip; 151 GrClip fClip;
151 SkAutoTUnref<GrDrawContext> fDrawContext; 152 SkAutoTUnref<GrDrawContext> fDrawContext;
152 GrRenderTarget* fRenderTarget; 153 GrRenderTarget* fRenderTarget;
153 // remove when our clients don't rely on accessBitmap() 154 // remove when our clients don't rely on accessBitmap()
154 SkBitmap fLegacyBitmap; 155 SkBitmap fLegacyBitmap;
155 bool fNeedClear; 156 bool fNeedClear;
157 bool fOpaque;
158
159 enum Flags {
160 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
161 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this device will be
162 // opaque even if the config supports alpha .
163 };
164 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init,
165 unsigned* flags);
156 166
157 SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, u nsigned flags); 167 SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, u nsigned flags);
158 168
159 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; 169 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
160 170
161 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; 171 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override;
162 172
163 SkImageFilter::Cache* getImageFilterCache() override; 173 SkImageFilter::Cache* getImageFilterCache() override;
164 174
165 bool forceConservativeRasterClip() const override { return true; } 175 bool forceConservativeRasterClip() const override { return true; }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 222
213 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&, 223 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&,
214 int sampleCount); 224 int sampleCount);
215 225
216 friend class GrAtlasTextContext; 226 friend class GrAtlasTextContext;
217 friend class SkSurface_Gpu; // for access to surfaceProps 227 friend class SkSurface_Gpu; // for access to surfaceProps
218 typedef SkBaseDevice INHERITED; 228 typedef SkBaseDevice INHERITED;
219 }; 229 };
220 230
221 #endif 231 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrSurfacePriv.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698