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

Side by Side Diff: src/gpu/SkGpuDevice.h

Issue 1763143002: WIP RasterCanvasLayerAllocator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: test and some further work Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkGpuDevice_DEFINED 8 #ifndef SkGpuDevice_DEFINED
9 #define SkGpuDevice_DEFINED 9 #define SkGpuDevice_DEFINED
10 10
11 #include "SkGr.h" 11 #include "SkGr.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDevice.h" 13 #include "SkDevice.h"
14 #include "SkPicture.h" 14 #include "SkPicture.h"
15 #include "SkRegion.h" 15 #include "SkRegion.h"
16 #include "SkSurface.h" 16 #include "SkSurface.h"
17 #include "GrDrawContext.h" 17 #include "GrDrawContext.h"
18 #include "GrContext.h" 18 #include "GrContext.h"
19 #include "GrSurfacePriv.h" 19 #include "GrSurfacePriv.h"
20 #include "GrTypes.h" 20 #include "GrTypes.h"
21 21
22 class GrAccelData; 22 class GrAccelData;
23 class GrTextureProducer; 23 class GrTextureProducer;
24 struct GrCachedLayer; 24 struct GrCachedLayer;
25 class SkRasterCanvasLayerAllocator;
25 26
26 /** 27 /**
27 * 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
28 * canvas. 29 * canvas.
29 */ 30 */
30 class SK_API SkGpuDevice : public SkBaseDevice { 31 class SK_API SkGpuDevice : public SkBaseDevice {
31 public: 32 public:
32 enum InitContents { 33 enum InitContents {
33 kClear_InitContents, 34 kClear_InitContents,
34 kUninit_InitContents 35 kUninit_InitContents
(...skipping 23 matching lines...) Expand all
58 * the resource cache budget. On failure, returns nullptr. 59 * the resource cache budget. On failure, returns nullptr.
59 */ 60 */
60 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&, 61 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&,
61 int sampleCount, const SkSurfaceProps*, InitC ontents); 62 int sampleCount, const SkSurfaceProps*, InitC ontents);
62 63
63 ~SkGpuDevice() override {} 64 ~SkGpuDevice() override {}
64 65
65 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { 66 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) {
66 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage, 67 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage,
67 props.pixelGeometry( )), 68 props.pixelGeometry( )),
68 nullptr); 69 nullptr, nullptr);
69 return static_cast<SkGpuDevice*>(dev); 70 return static_cast<SkGpuDevice*>(dev);
70 } 71 }
71 72
72 GrContext* context() const override { return fContext; } 73 GrContext* context() const override { return fContext; }
73 74
74 // set all pixels to 0 75 // set all pixels to 0
75 void clearAll(); 76 void clearAll();
76 77
77 void replaceDrawContext(bool shouldRetainContent); 78 void replaceDrawContext(bool shouldRetainContent);
78 79
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 enum Flags { 166 enum Flags {
166 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear 167 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
167 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this device will be 168 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this device will be
168 // opaque even if the config supports alpha . 169 // opaque even if the config supports alpha .
169 }; 170 };
170 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init, 171 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init,
171 unsigned* flags); 172 unsigned* flags);
172 173
173 SkGpuDevice(sk_sp<GrDrawContext>, int width, int height, unsigned flags); 174 SkGpuDevice(sk_sp<GrDrawContext>, int width, int height, unsigned flags);
174 175
175 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; 176 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*,
177 SkRasterCanvasLayerAllocator*) override;
176 178
177 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over ride; 179 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over ride;
178 180
179 SkImageFilterCache* getImageFilterCache() override; 181 SkImageFilterCache* getImageFilterCache() override;
180 182
181 bool forceConservativeRasterClip() const override { return true; } 183 bool forceConservativeRasterClip() const override { return true; }
182 184
183 // sets the render target and clip on context 185 // sets the render target and clip on context
184 void prepareDraw(const SkDraw&); 186 void prepareDraw(const SkDraw&);
185 187
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 263
262 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, 264 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y,
263 const SkPaint&) override; 265 const SkPaint&) override;
264 266
265 friend class GrAtlasTextContext; 267 friend class GrAtlasTextContext;
266 friend class SkSurface_Gpu; // for access to surfaceProps 268 friend class SkSurface_Gpu; // for access to surfaceProps
267 typedef SkBaseDevice INHERITED; 269 typedef SkBaseDevice INHERITED;
268 }; 270 };
269 271
270 #endif 272 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698