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 20 matching lines...) Expand all Loading... | |
31 * canvas. | 31 * canvas. |
32 */ | 32 */ |
33 class SK_API SkGpuDevice : public SkBaseDevice { | 33 class SK_API SkGpuDevice : public SkBaseDevice { |
34 public: | 34 public: |
35 enum InitContents { | 35 enum InitContents { |
36 kClear_InitContents, | 36 kClear_InitContents, |
37 kUninit_InitContents | 37 kUninit_InitContents |
38 }; | 38 }; |
39 | 39 |
40 /** | 40 /** |
41 * Creates an SkGpuDevice from a GrRenderTarget. | |
42 * TODO: rm this factory. It is used by SkSurface::MakeRenderTargetDirect, | |
43 * MakeFromBackendTexture, MakeFromBackendRenderTarget, | |
44 * and MakeFromBackendTextureAsRenderTarget. Only the first is worriso me. | |
45 */ | |
46 static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target, | |
47 sk_sp<SkColorSpace> colorSpace, | |
48 const SkSurfaceProps*, | |
49 InitContents); | |
50 | |
51 /** | |
52 * Creates an SkGpuDevice from a GrDrawContext whose backing width/height is | 41 * Creates an SkGpuDevice from a GrDrawContext whose backing width/height is |
53 * different than its actual width/height (e.g., approx-match scratch textur e). | 42 * different than its actual width/height (e.g., approx-match scratch textur e). |
54 */ | 43 */ |
robertphillips
2016/08/04 13:38:11
This is an unfortunate side-effect of how SkSurfac
| |
55 static sk_sp<SkBaseDevice> Make(sk_sp<GrDrawContext> drawContext, | 44 static sk_sp<SkGpuDevice> Make(sk_sp<GrDrawContext> drawContext, |
56 int width, int height, | 45 int width, int height, |
57 InitContents); | 46 InitContents); |
58 | 47 |
59 /** | 48 /** |
60 * New device that will create an offscreen renderTarget based on the ImageI nfo and | 49 * New device that will create an offscreen renderTarget based on the ImageI nfo and |
61 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against | 50 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against |
62 * the resource cache budget. On failure, returns nullptr. | 51 * the resource cache budget. On failure, returns nullptr. |
63 */ | 52 */ |
64 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&, | 53 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&, |
65 int sampleCount, GrSurfaceOrigin, | 54 int sampleCount, GrSurfaceOrigin, |
66 const SkSurfaceProps*, InitContents); | 55 const SkSurfaceProps*, InitContents); |
67 | 56 |
68 ~SkGpuDevice() override {} | 57 ~SkGpuDevice() override {} |
69 | 58 |
70 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { | |
71 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage, | |
72 props.pixelGeometry( )), | |
73 nullptr); | |
74 return static_cast<SkGpuDevice*>(dev); | |
75 } | |
76 | |
77 GrContext* context() const override { return fContext; } | 59 GrContext* context() const override { return fContext; } |
78 | 60 |
79 // set all pixels to 0 | 61 // set all pixels to 0 |
80 void clearAll(); | 62 void clearAll(); |
81 | 63 |
82 void replaceDrawContext(bool shouldRetainContent); | 64 void replaceDrawContext(bool shouldRetainContent); |
83 | 65 |
84 GrDrawContext* accessDrawContext() override; | 66 GrDrawContext* accessDrawContext() override; |
85 | 67 |
86 SkImageInfo imageInfo() const override { | 68 SkImageInfo imageInfo() const override { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 int sampleCount, | 253 int sampleCount, |
272 GrSurfaceOrigin, | 254 GrSurfaceOrigin, |
273 const SkSurfaceProps*); | 255 const SkSurfaceProps*); |
274 | 256 |
275 friend class GrAtlasTextContext; | 257 friend class GrAtlasTextContext; |
276 friend class SkSurface_Gpu; // for access to surfaceProps | 258 friend class SkSurface_Gpu; // for access to surfaceProps |
277 typedef SkBaseDevice INHERITED; | 259 typedef SkBaseDevice INHERITED; |
278 }; | 260 }; |
279 | 261 |
280 #endif | 262 #endif |
OLD | NEW |