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 |
11 | 11 |
12 #include "SkGr.h" | 12 #include "SkGr.h" |
13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
14 #include "SkDevice.h" | 14 #include "SkDevice.h" |
15 #include "SkPicture.h" | 15 #include "SkPicture.h" |
16 #include "SkRegion.h" | 16 #include "SkRegion.h" |
17 #include "SkSurface.h" | 17 #include "SkSurface.h" |
18 #include "GrContext.h" | 18 #include "GrContext.h" |
19 #include "GrSurfacePriv.h" | 19 #include "GrSurfacePriv.h" |
20 | 20 |
21 struct SkDrawProcs; | 21 struct SkDrawProcs; |
22 struct GrSkDrawProcs; | 22 struct GrSkDrawProcs; |
23 | 23 |
24 class GrAccelData; | 24 class GrAccelData; |
25 class GrTextureAdjuster; | 25 class GrTextureProducer; |
26 struct GrCachedLayer; | 26 struct GrCachedLayer; |
27 | 27 |
28 /** | 28 /** |
29 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th
e | 29 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th
e |
30 * canvas. | 30 * canvas. |
31 */ | 31 */ |
32 class SK_API SkGpuDevice : public SkBaseDevice { | 32 class SK_API SkGpuDevice : public SkBaseDevice { |
33 public: | 33 public: |
34 enum InitContents { | 34 enum InitContents { |
35 kClear_InitContents, | 35 kClear_InitContents, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; | 175 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; |
176 | 176 |
177 SkImageFilter::Cache* getImageFilterCache() override; | 177 SkImageFilter::Cache* getImageFilterCache() override; |
178 | 178 |
179 bool forceConservativeRasterClip() const override { return true; } | 179 bool forceConservativeRasterClip() const override { return true; } |
180 | 180 |
181 // sets the render target and clip on context | 181 // sets the render target and clip on context |
182 void prepareDraw(const SkDraw&); | 182 void prepareDraw(const SkDraw&); |
183 | 183 |
184 /** | 184 /** |
185 * Implementation for both drawBitmap and drawBitmapRect. | |
186 */ | |
187 void drawBitmapCommon(const SkDraw&, | |
188 const SkBitmap& bitmap, | |
189 const SkRect* srcRectPtr, | |
190 const SkSize* dstSizePtr, // ignored iff srcRectP
tr == nullptr | |
191 const SkPaint&, | |
192 SkCanvas::SrcRectConstraint); | |
193 | |
194 /** | |
195 * Helper functions called by drawBitmapCommon. By the time these are called
the SkDraw's | 185 * Helper functions called by drawBitmapCommon. By the time these are called
the SkDraw's |
196 * matrix, clip, and the device's render target has already been set on GrCo
ntext. | 186 * matrix, clip, and the device's render target has already been set on GrCo
ntext. |
197 */ | 187 */ |
198 | 188 |
199 // The tileSize and clippedSrcRect will be valid only if true is returned. | 189 // The tileSize and clippedSrcRect will be valid only if true is returned. |
200 bool shouldTileImageID(uint32_t imageID, const SkIRect& imageRect, | 190 bool shouldTileImageID(uint32_t imageID, const SkIRect& imageRect, |
201 const SkMatrix& viewMatrix, | 191 const SkMatrix& viewMatrix, |
202 const GrTextureParams& params, | 192 const GrTextureParams& params, |
203 const SkRect* srcRectPtr, | 193 const SkRect* srcRectPtr, |
204 int maxTileSize, | 194 int maxTileSize, |
(...skipping 24 matching lines...) Expand all Loading... |
229 void drawTiledBitmap(const SkBitmap& bitmap, | 219 void drawTiledBitmap(const SkBitmap& bitmap, |
230 const SkMatrix& viewMatrix, | 220 const SkMatrix& viewMatrix, |
231 const SkRect& srcRect, | 221 const SkRect& srcRect, |
232 const SkIRect& clippedSrcRect, | 222 const SkIRect& clippedSrcRect, |
233 const GrTextureParams& params, | 223 const GrTextureParams& params, |
234 const SkPaint& paint, | 224 const SkPaint& paint, |
235 SkCanvas::SrcRectConstraint, | 225 SkCanvas::SrcRectConstraint, |
236 int tileSize, | 226 int tileSize, |
237 bool bicubic); | 227 bool bicubic); |
238 | 228 |
239 void drawTextureAdjuster(GrTextureAdjuster* adjuster, | 229 void drawTextureProducer(GrTextureProducer*, |
240 bool alphaOnly, | 230 bool alphaOnly, |
241 const SkRect* srcRect, | 231 const SkRect* srcRect, |
242 const SkRect* dstRect, | 232 const SkRect* dstRect, |
243 SkCanvas::SrcRectConstraint constraint, | 233 SkCanvas::SrcRectConstraint, |
244 const SkMatrix& viewMatrix, | 234 const SkMatrix& viewMatrix, |
245 const GrClip& clip, | 235 const GrClip&, |
246 const SkPaint& paint); | 236 const SkPaint&); |
247 | 237 |
248 void drawTextureAdjusterImpl(GrTextureAdjuster*, | 238 void drawTextureProducerImpl(GrTextureProducer*, |
249 bool alphaOnly, | 239 bool alphaOnly, |
250 const SkRect& clippedSrcRect, | 240 const SkRect& clippedSrcRect, |
251 const SkRect& clippedDstRect, | 241 const SkRect& clippedDstRect, |
252 SkCanvas::SrcRectConstraint constraint, | 242 SkCanvas::SrcRectConstraint, |
253 const SkMatrix& viewMatrix, | 243 const SkMatrix& viewMatrix, |
254 const SkMatrix& srcToDstMatrix, | 244 const SkMatrix& srcToDstMatrix, |
255 const GrClip& clip, | 245 const GrClip&, |
256 const SkPaint& paint); | 246 const SkPaint&); |
257 | 247 |
258 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); | 248 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); |
259 | 249 |
260 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, | 250 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, |
261 int sampleCount); | 251 int sampleCount); |
262 | 252 |
263 friend class GrAtlasTextContext; | 253 friend class GrAtlasTextContext; |
264 friend class SkSurface_Gpu; // for access to surfaceProps | 254 friend class SkSurface_Gpu; // for access to surfaceProps |
265 typedef SkBaseDevice INHERITED; | 255 typedef SkBaseDevice INHERITED; |
266 }; | 256 }; |
267 | 257 |
268 #endif | 258 #endif |
OLD | NEW |