OLD | NEW |
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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 class SK_API SkGpuDevice : public SkBaseDevice { | 30 class SK_API SkGpuDevice : public SkBaseDevice { |
31 public: | 31 public: |
32 enum InitContents { | 32 enum InitContents { |
33 kClear_InitContents, | 33 kClear_InitContents, |
34 kUninit_InitContents | 34 kUninit_InitContents |
35 }; | 35 }; |
36 | 36 |
37 /** | 37 /** |
38 * Creates an SkGpuDevice from a GrRenderTarget. | 38 * Creates an SkGpuDevice from a GrRenderTarget. |
39 */ | 39 */ |
40 static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, In
itContents); | 40 static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target, |
| 41 const SkSurfaceProps*, |
| 42 InitContents); |
41 | 43 |
42 /** | 44 /** |
43 * Creates an SkGpuDevice from a GrRenderTarget whose texture width/height i
s | 45 * 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). | 46 * different than its actual width/height (e.g., approx-match scratch textur
e). |
45 */ | 47 */ |
46 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height, | 48 static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target, int width, int
height, |
47 const SkSurfaceProps*, InitContents); | 49 const SkSurfaceProps*, InitContents); |
48 | 50 |
49 /** | 51 /** |
50 * New device that will create an offscreen renderTarget based on the ImageI
nfo and | 52 * 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 | 53 * sampleCount. The Budgeted param controls whether the device's backing sto
re counts against |
52 * the resource cache budget. On failure, returns nullptr. | 54 * the resource cache budget. On failure, returns nullptr. |
53 */ | 55 */ |
54 static SkGpuDevice* Create(GrContext*, SkBudgeted, const SkImageInfo&, | 56 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&, |
55 int sampleCount, const SkSurfaceProps*, InitConte
nts); | 57 int sampleCount, const SkSurfaceProps*, InitC
ontents); |
56 | 58 |
57 ~SkGpuDevice() override {} | 59 ~SkGpuDevice() override {} |
58 | 60 |
59 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { | 61 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { |
60 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k
Possible_TileUsage, | 62 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k
Possible_TileUsage, |
61 props.pixelGeometry(
)), | 63 props.pixelGeometry(
)), |
62 nullptr); | 64 nullptr); |
63 return static_cast<SkGpuDevice*>(dev); | 65 return static_cast<SkGpuDevice*>(dev); |
64 } | 66 } |
65 | 67 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 254 |
253 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, | 255 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, |
254 const SkPaint&) override; | 256 const SkPaint&) override; |
255 | 257 |
256 friend class GrAtlasTextContext; | 258 friend class GrAtlasTextContext; |
257 friend class SkSurface_Gpu; // for access to surfaceProps | 259 friend class SkSurface_Gpu; // for access to surfaceProps |
258 typedef SkBaseDevice INHERITED; | 260 typedef SkBaseDevice INHERITED; |
259 }; | 261 }; |
260 | 262 |
261 #endif | 263 #endif |
OLD | NEW |