OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 /** | 43 /** |
44 * 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 |
45 * 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). |
46 */ | 46 */ |
47 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height, | 47 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height, |
48 const SkSurfaceProps*, InitContents); | 48 const SkSurfaceProps*, InitContents); |
49 | 49 |
50 /** | 50 /** |
51 * 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 |
52 * 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 |
53 * the resource cache budget. On failure, returns NULL. | 53 * the resource cache budget. On failure, returns nullptr. |
54 */ | 54 */ |
55 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf
o&, | 55 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf
o&, |
56 int sampleCount, const SkSurfaceProps*, InitConte
nts); | 56 int sampleCount, const SkSurfaceProps*, InitConte
nts); |
57 | 57 |
58 virtual ~SkGpuDevice(); | 58 virtual ~SkGpuDevice(); |
59 | 59 |
60 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { | 60 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { |
61 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k
Possible_TileUsage, | 61 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k
Possible_TileUsage, |
62 props.pixelGeometry(
)), | 62 props.pixelGeometry(
)), |
63 NULL); | 63 nullptr); |
64 return static_cast<SkGpuDevice*>(dev); | 64 return static_cast<SkGpuDevice*>(dev); |
65 } | 65 } |
66 | 66 |
67 GrContext* context() const { return fContext; } | 67 GrContext* context() const { return fContext; } |
68 | 68 |
69 // set all pixels to 0 | 69 // set all pixels to 0 |
70 void clearAll(); | 70 void clearAll(); |
71 | 71 |
72 void replaceRenderTarget(bool shouldRetainContent); | 72 void replaceRenderTarget(bool shouldRetainContent); |
73 | 73 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 // sets the render target and clip on context | 178 // sets the render target and clip on context |
179 void prepareDraw(const SkDraw&); | 179 void prepareDraw(const SkDraw&); |
180 | 180 |
181 /** | 181 /** |
182 * Implementation for both drawBitmap and drawBitmapRect. | 182 * Implementation for both drawBitmap and drawBitmapRect. |
183 */ | 183 */ |
184 void drawBitmapCommon(const SkDraw&, | 184 void drawBitmapCommon(const SkDraw&, |
185 const SkBitmap& bitmap, | 185 const SkBitmap& bitmap, |
186 const SkRect* srcRectPtr, | 186 const SkRect* srcRectPtr, |
187 const SkSize* dstSizePtr, // ignored iff srcRectP
tr == NULL | 187 const SkSize* dstSizePtr, // ignored iff srcRectP
tr == nullptr |
188 const SkPaint&, | 188 const SkPaint&, |
189 SkCanvas::SrcRectConstraint); | 189 SkCanvas::SrcRectConstraint); |
190 | 190 |
191 /** | 191 /** |
192 * Helper functions called by drawBitmapCommon. By the time these are called
the SkDraw's | 192 * Helper functions called by drawBitmapCommon. By the time these are called
the SkDraw's |
193 * matrix, clip, and the device's render target has already been set on GrCo
ntext. | 193 * matrix, clip, and the device's render target has already been set on GrCo
ntext. |
194 */ | 194 */ |
195 | 195 |
196 // The tileSize and clippedSrcRect will be valid only if true is returned. | 196 // The tileSize and clippedSrcRect will be valid only if true is returned. |
197 bool shouldTileBitmap(const SkBitmap& bitmap, | 197 bool shouldTileBitmap(const SkBitmap& bitmap, |
(...skipping 25 matching lines...) Expand all Loading... |
223 | 223 |
224 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, | 224 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, |
225 int sampleCount); | 225 int sampleCount); |
226 | 226 |
227 friend class GrAtlasTextContext; | 227 friend class GrAtlasTextContext; |
228 friend class SkSurface_Gpu; // for access to surfaceProps | 228 friend class SkSurface_Gpu; // for access to surfaceProps |
229 typedef SkBaseDevice INHERITED; | 229 typedef SkBaseDevice INHERITED; |
230 }; | 230 }; |
231 | 231 |
232 #endif | 232 #endif |
OLD | NEW |