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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const SkPaint& paint, const SkMatrix* prePathMatrix, | 96 const SkPaint& paint, const SkMatrix* prePathMatrix, |
97 bool pathIsMutable) SK_OVERRIDE; | 97 bool pathIsMutable) SK_OVERRIDE; |
98 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, | 98 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, |
99 const SkMatrix&, const SkPaint&) SK_OVERRIDE; | 99 const SkMatrix&, const SkPaint&) SK_OVERRIDE; |
100 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, | 100 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, |
101 const SkRect* srcOrNull, const SkRect& dst, | 101 const SkRect* srcOrNull, const SkRect& dst, |
102 const SkPaint& paint, | 102 const SkPaint& paint, |
103 SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE
; | 103 SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE
; |
104 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, | 104 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, |
105 int x, int y, const SkPaint& paint) SK_OVERRIDE; | 105 int x, int y, const SkPaint& paint) SK_OVERRIDE; |
| 106 virtual void drawSprite(const SkDraw&, const SkImage& image, |
| 107 int x, int y, const SkPaint& paint) SK_OVERRIDE; |
106 virtual void drawText(const SkDraw&, const void* text, size_t len, | 108 virtual void drawText(const SkDraw&, const void* text, size_t len, |
107 SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; | 109 SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; |
108 virtual void drawPosText(const SkDraw&, const void* text, size_t len, | 110 virtual void drawPosText(const SkDraw&, const void* text, size_t len, |
109 const SkScalar pos[], int scalarsPerPos, | 111 const SkScalar pos[], int scalarsPerPos, |
110 const SkPoint& offset, const SkPaint&) SK_OVERRIDE; | 112 const SkPoint& offset, const SkPaint&) SK_OVERRIDE; |
111 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou
nt, | 113 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou
nt, |
112 const SkPoint verts[], const SkPoint texs[], | 114 const SkPoint verts[], const SkPoint texs[], |
113 const SkColor colors[], SkXfermode* xmode, | 115 const SkColor colors[], SkXfermode* xmode, |
114 const uint16_t indices[], int indexCount, | 116 const uint16_t indices[], int indexCount, |
115 const SkPaint&) SK_OVERRIDE; | 117 const SkPaint&) SK_OVERRIDE; |
116 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 118 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
117 const SkPaint&) SK_OVERRIDE; | 119 const SkPaint&) SK_OVERRIDE; |
118 | 120 |
119 void flush() SK_OVERRIDE; | 121 void flush() SK_OVERRIDE; |
120 | 122 |
121 void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE; | 123 void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE; |
122 void onDetachFromCanvas() SK_OVERRIDE; | 124 void onDetachFromCanvas() SK_OVERRIDE; |
123 | 125 |
124 const SkBitmap& onAccessBitmap() SK_OVERRIDE; | 126 const SkBitmap& onAccessBitmap() SK_OVERRIDE; |
125 | 127 |
126 bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE; | 128 bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE; |
127 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, | 129 virtual bool filterImage(const SkImageFilter*, const SkImage*, |
128 const SkImageFilter::Context&, | 130 const SkImageFilter::Context&, |
129 SkBitmap*, SkIPoint*) SK_OVERRIDE; | 131 SkAutoTUnref<const SkImage>&, SkIPoint*) SK_OVERRID
E; |
130 | 132 |
131 bool filterTexture(GrContext*, GrTexture*, const SkImageFilter*, | 133 bool filterTexture(GrContext*, GrTexture*, const SkImageFilter*, |
132 const SkImageFilter::Context&, | 134 const SkImageFilter::Context&, |
133 SkBitmap* result, SkIPoint* offset); | 135 SkAutoTUnref<const SkImage>& result, SkIPoint* offset); |
134 | 136 |
135 protected: | 137 protected: |
136 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) SK_OVERRIDE; | 138 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) SK_OVERRIDE; |
137 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVE
RRIDE; | 139 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVE
RRIDE; |
138 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE; | 140 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE; |
139 | 141 |
140 /** PRIVATE / EXPERIMENTAL -- do not call */ | 142 /** PRIVATE / EXPERIMENTAL -- do not call */ |
141 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic
ture, | 143 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic
ture, |
142 const SkMatrix*, const SkPaint*) SK_OV
ERRIDE; | 144 const SkMatrix*, const SkPaint*) SK_OV
ERRIDE; |
143 | 145 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 178 |
177 enum ModifyMode { kDrawContent_ModifyMode, kDiscard_ModifyMode }; | 179 enum ModifyMode { kDrawContent_ModifyMode, kDiscard_ModifyMode }; |
178 /** Prepares the render target for modification. | 180 /** Prepares the render target for modification. |
179 * 1. Detaches the snapshot, if needed. | 181 * 1. Detaches the snapshot, if needed. |
180 * 2. Creates new render target if snapshot refers to the current render tar
get. | 182 * 2. Creates new render target if snapshot refers to the current render tar
get. |
181 * 3. Does the deferred clear, if needed. | 183 * 3. Does the deferred clear, if needed. |
182 * returns true if the render target is functional and can be rendered to. | 184 * returns true if the render target is functional and can be rendered to. |
183 */ | 185 */ |
184 bool prepareBackendRenderTarget(ModifyMode); | 186 bool prepareBackendRenderTarget(ModifyMode); |
185 | 187 |
| 188 void internalDrawSprite(const SkDraw& draw, GrTexture* texture, |
| 189 int left, int top, int width, int height, const SkPa
int& paint); |
| 190 |
186 /** | 191 /** |
187 * Implementation for both drawBitmap and drawBitmapRect. | 192 * Implementation for both drawBitmap and drawBitmapRect. |
188 */ | 193 */ |
189 void drawBitmapCommon(const SkDraw&, | 194 void drawBitmapCommon(const SkDraw&, |
190 const SkBitmap& bitmap, | 195 const SkBitmap& bitmap, |
191 const SkRect* srcRectPtr, | 196 const SkRect* srcRectPtr, |
192 const SkSize* dstSizePtr, // ignored iff srcRectP
tr == NULL | 197 const SkSize* dstSizePtr, // ignored iff srcRectP
tr == NULL |
193 const SkPaint&, | 198 const SkPaint&, |
194 SkCanvas::DrawBitmapRectFlags flags); | 199 SkCanvas::DrawBitmapRectFlags flags); |
195 | 200 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 233 |
229 static SkPicture::AccelData::Key ComputeAccelDataKey(); | 234 static SkPicture::AccelData::Key ComputeAccelDataKey(); |
230 | 235 |
231 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, | 236 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, |
232 int sampleCount); | 237 int sampleCount); |
233 | 238 |
234 typedef SkBaseDevice INHERITED; | 239 typedef SkBaseDevice INHERITED; |
235 }; | 240 }; |
236 | 241 |
237 #endif | 242 #endif |
OLD | NEW |