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 |
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 | 25 |
| 26 class SkSpecialImage; |
| 27 |
26 /** | 28 /** |
27 * 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 |
28 * canvas. | 30 * canvas. |
29 */ | 31 */ |
30 class SK_API SkGpuDevice : public SkBaseDevice { | 32 class SK_API SkGpuDevice : public SkBaseDevice { |
31 public: | 33 public: |
32 enum InitContents { | 34 enum InitContents { |
33 kClear_InitContents, | 35 kClear_InitContents, |
34 kUninit_InitContents | 36 kUninit_InitContents |
35 }; | 37 }; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 const SkPoint& offset, const SkPaint&) override; | 113 const SkPoint& offset, const SkPaint&) override; |
112 virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkSc
alar y, | 114 virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkSc
alar y, |
113 const SkPaint& paint, SkDrawFilter* drawFilter) ov
erride; | 115 const SkPaint& paint, SkDrawFilter* drawFilter) ov
erride; |
114 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou
nt, | 116 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou
nt, |
115 const SkPoint verts[], const SkPoint texs[], | 117 const SkPoint verts[], const SkPoint texs[], |
116 const SkColor colors[], SkXfermode* xmode, | 118 const SkColor colors[], SkXfermode* xmode, |
117 const uint16_t indices[], int indexCount, | 119 const uint16_t indices[], int indexCount, |
118 const SkPaint&) override; | 120 const SkPaint&) override; |
119 void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const
SkRect[], | 121 void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const
SkRect[], |
120 const SkColor[], int count, SkXfermode::Mode, const SkPai
nt&) override; | 122 const SkColor[], int count, SkXfermode::Mode, const SkPai
nt&) override; |
121 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 123 void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&)
override; |
122 const SkPaint&) override; | 124 |
123 void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const
SkPaint&) override; | 125 void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const
SkPaint&) override; |
124 void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const S
kRect& dst, | 126 void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const S
kRect& dst, |
125 const SkPaint&, SkCanvas::SrcRectConstraint) override; | 127 const SkPaint&, SkCanvas::SrcRectConstraint) override; |
126 | 128 |
127 void drawImageNine(const SkDraw& draw, const SkImage* image, const SkIRect&
center, | 129 void drawImageNine(const SkDraw& draw, const SkImage* image, const SkIRect&
center, |
128 const SkRect& dst, const SkPaint& paint) override; | 130 const SkRect& dst, const SkPaint& paint) override; |
129 void drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, const SkIRec
t& center, | 131 void drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, const SkIRec
t& center, |
130 const SkRect& dst, const SkPaint& paint) override; | 132 const SkRect& dst, const SkPaint& paint) override; |
131 | 133 |
| 134 void drawSpecial(const SkDraw& draw, SkSpecialImage*, |
| 135 int left, int top, const SkPaint& paint); |
| 136 |
132 void flush() override; | 137 void flush() override; |
133 | 138 |
134 void onAttachToCanvas(SkCanvas* canvas) override; | 139 void onAttachToCanvas(SkCanvas* canvas) override; |
135 void onDetachFromCanvas() override; | 140 void onDetachFromCanvas() override; |
136 | 141 |
137 const SkBitmap& onAccessBitmap() override; | 142 const SkBitmap& onAccessBitmap() override; |
138 bool onAccessPixels(SkPixmap*) override; | 143 bool onAccessPixels(SkPixmap*) override; |
139 | 144 |
140 // for debugging purposes only | 145 // for debugging purposes only |
141 void drawTexture(GrTexture*, const SkRect& dst, const SkPaint&); | 146 void drawTexture(GrTexture*, const SkRect& dst, const SkPaint&); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 212 |
208 void internalDrawBitmap(const SkBitmap&, | 213 void internalDrawBitmap(const SkBitmap&, |
209 const SkMatrix& viewMatrix, | 214 const SkMatrix& viewMatrix, |
210 const SkRect&, | 215 const SkRect&, |
211 const GrTextureParams& params, | 216 const GrTextureParams& params, |
212 const SkPaint& paint, | 217 const SkPaint& paint, |
213 SkCanvas::SrcRectConstraint, | 218 SkCanvas::SrcRectConstraint, |
214 bool bicubic, | 219 bool bicubic, |
215 bool needsTextureDomain); | 220 bool needsTextureDomain); |
216 | 221 |
| 222 sk_sp<SkSpecialImage> filterTexture(const SkDraw&, |
| 223 SkSpecialImage*, |
| 224 int left, int top, |
| 225 SkIPoint* offset, |
| 226 const SkImageFilter* filter); |
| 227 |
217 void drawTiledBitmap(const SkBitmap& bitmap, | 228 void drawTiledBitmap(const SkBitmap& bitmap, |
218 const SkMatrix& viewMatrix, | 229 const SkMatrix& viewMatrix, |
219 const SkRect& srcRect, | 230 const SkRect& srcRect, |
220 const SkIRect& clippedSrcRect, | 231 const SkIRect& clippedSrcRect, |
221 const GrTextureParams& params, | 232 const GrTextureParams& params, |
222 const SkPaint& paint, | 233 const SkPaint& paint, |
223 SkCanvas::SrcRectConstraint, | 234 SkCanvas::SrcRectConstraint, |
224 int tileSize, | 235 int tileSize, |
225 bool bicubic); | 236 bool bicubic); |
226 | 237 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 269 |
259 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, | 270 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, |
260 const SkPaint&) override; | 271 const SkPaint&) override; |
261 | 272 |
262 friend class GrAtlasTextContext; | 273 friend class GrAtlasTextContext; |
263 friend class SkSurface_Gpu; // for access to surfaceProps | 274 friend class SkSurface_Gpu; // for access to surfaceProps |
264 typedef SkBaseDevice INHERITED; | 275 typedef SkBaseDevice INHERITED; |
265 }; | 276 }; |
266 | 277 |
267 #endif | 278 #endif |
OLD | NEW |