OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkLuaCanvas.h" | 8 #include "SkLuaCanvas.h" |
9 #include "SkLua.h" | 9 #include "SkLua.h" |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 lua.pushPath(path, "path"); | 155 lua.pushPath(path, "path"); |
156 lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa"); | 156 lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa"); |
157 this->INHERITED::onClipPath(path, op, edgeStyle); | 157 this->INHERITED::onClipPath(path, op, edgeStyle); |
158 } | 158 } |
159 | 159 |
160 void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { | 160 void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
161 AUTO_LUA("clipRegion"); | 161 AUTO_LUA("clipRegion"); |
162 this->INHERITED::onClipRegion(deviceRgn, op); | 162 this->INHERITED::onClipRegion(deviceRgn, op); |
163 } | 163 } |
164 | 164 |
165 void SkLuaCanvas::drawPaint(const SkPaint& paint) { | 165 void SkLuaCanvas::onDrawPaint(const SkPaint& paint) { |
166 AUTO_LUA("drawPaint"); | 166 AUTO_LUA("drawPaint"); |
167 lua.pushPaint(paint, "paint"); | 167 lua.pushPaint(paint, "paint"); |
168 } | 168 } |
169 | 169 |
170 void SkLuaCanvas::drawPoints(PointMode mode, size_t count, | 170 void SkLuaCanvas::onDrawPoints(PointMode mode, size_t count, |
171 const SkPoint pts[], const SkPaint& paint) { | 171 const SkPoint pts[], const SkPaint& paint) { |
172 AUTO_LUA("drawPoints"); | 172 AUTO_LUA("drawPoints"); |
173 lua.pushArrayPoint(pts, SkToInt(count), "points"); | 173 lua.pushArrayPoint(pts, SkToInt(count), "points"); |
174 lua.pushPaint(paint, "paint"); | 174 lua.pushPaint(paint, "paint"); |
175 } | 175 } |
176 | 176 |
177 void SkLuaCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { | 177 void SkLuaCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { |
178 AUTO_LUA("drawOval"); | 178 AUTO_LUA("drawOval"); |
179 lua.pushRect(rect, "rect"); | 179 lua.pushRect(rect, "rect"); |
180 lua.pushPaint(paint, "paint"); | 180 lua.pushPaint(paint, "paint"); |
181 } | 181 } |
182 | 182 |
183 void SkLuaCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { | 183 void SkLuaCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { |
184 AUTO_LUA("drawRect"); | 184 AUTO_LUA("drawRect"); |
185 lua.pushRect(rect, "rect"); | 185 lua.pushRect(rect, "rect"); |
186 lua.pushPaint(paint, "paint"); | 186 lua.pushPaint(paint, "paint"); |
187 } | 187 } |
188 | 188 |
189 void SkLuaCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { | 189 void SkLuaCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { |
190 AUTO_LUA("drawRRect"); | 190 AUTO_LUA("drawRRect"); |
191 lua.pushRRect(rrect, "rrect"); | 191 lua.pushRRect(rrect, "rrect"); |
192 lua.pushPaint(paint, "paint"); | 192 lua.pushPaint(paint, "paint"); |
193 } | 193 } |
194 | 194 |
195 void SkLuaCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, | 195 void SkLuaCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, |
196 const SkPaint& paint) { | 196 const SkPaint& paint) { |
197 AUTO_LUA("drawDRRect"); | 197 AUTO_LUA("drawDRRect"); |
198 lua.pushRRect(outer, "outer"); | 198 lua.pushRRect(outer, "outer"); |
199 lua.pushRRect(inner, "inner"); | 199 lua.pushRRect(inner, "inner"); |
200 lua.pushPaint(paint, "paint"); | 200 lua.pushPaint(paint, "paint"); |
201 } | 201 } |
202 | 202 |
203 void SkLuaCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 203 void SkLuaCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { |
204 AUTO_LUA("drawPath"); | 204 AUTO_LUA("drawPath"); |
205 lua.pushPath(path, "path"); | 205 lua.pushPath(path, "path"); |
206 lua.pushPaint(paint, "paint"); | 206 lua.pushPaint(paint, "paint"); |
207 } | 207 } |
208 | 208 |
209 void SkLuaCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, | 209 void SkLuaCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, |
210 const SkPaint* paint) { | 210 const SkPaint* paint) { |
211 AUTO_LUA("drawBitmap"); | 211 AUTO_LUA("drawBitmap"); |
212 if (paint) { | 212 if (paint) { |
213 lua.pushPaint(*paint, "paint"); | 213 lua.pushPaint(*paint, "paint"); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 void SkLuaCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src
, | 217 void SkLuaCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, co
nst SkRect& dst, |
218 const SkRect& dst, const SkPaint* paint, | 218 const SkPaint* paint, DrawBitmapRectFlags fla
gs) { |
219 DrawBitmapRectFlags flags) { | 219 AUTO_LUA("drawBitmapRect"); |
220 AUTO_LUA("drawBitmapRectToRect"); | |
221 if (paint) { | 220 if (paint) { |
222 lua.pushPaint(*paint, "paint"); | 221 lua.pushPaint(*paint, "paint"); |
223 } | 222 } |
224 } | 223 } |
225 | 224 |
226 void SkLuaCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, | 225 void SkLuaCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center
, const SkRect& dst, |
227 const SkPaint* paint) { | 226 const SkPaint* paint) { |
| 227 AUTO_LUA("drawBitmapNine"); |
| 228 if (paint) { |
| 229 lua.pushPaint(*paint, "paint"); |
| 230 } |
| 231 } |
| 232 |
| 233 void SkLuaCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, cons
t SkPaint* paint) { |
| 234 AUTO_LUA("drawImage"); |
| 235 if (paint) { |
| 236 lua.pushPaint(*paint, "paint"); |
| 237 } |
| 238 } |
| 239 |
| 240 void SkLuaCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const
SkRect& dst, |
| 241 const SkPaint* paint) { |
| 242 AUTO_LUA("drawImageRect"); |
| 243 if (paint) { |
| 244 lua.pushPaint(*paint, "paint"); |
| 245 } |
| 246 } |
| 247 |
| 248 void SkLuaCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPai
nt* paint) { |
228 AUTO_LUA("drawSprite"); | 249 AUTO_LUA("drawSprite"); |
229 if (paint) { | 250 if (paint) { |
230 lua.pushPaint(*paint, "paint"); | 251 lua.pushPaint(*paint, "paint"); |
231 } | 252 } |
232 } | 253 } |
233 | 254 |
234 void SkLuaCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, Sk
Scalar y, | 255 void SkLuaCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, Sk
Scalar y, |
235 const SkPaint& paint) { | 256 const SkPaint& paint) { |
236 AUTO_LUA("drawText"); | 257 AUTO_LUA("drawText"); |
237 lua.pushEncodedText(paint.getTextEncoding(), text, byteLength); | 258 lua.pushEncodedText(paint.getTextEncoding(), text, byteLength); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 lua.pushPaint(paint, "paint"); | 290 lua.pushPaint(paint, "paint"); |
270 } | 291 } |
271 | 292 |
272 void SkLuaCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix
, | 293 void SkLuaCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix
, |
273 const SkPaint* paint) { | 294 const SkPaint* paint) { |
274 AUTO_LUA("drawPicture"); | 295 AUTO_LUA("drawPicture"); |
275 // call through so we can see the nested picture ops | 296 // call through so we can see the nested picture ops |
276 this->INHERITED::onDrawPicture(picture, matrix, paint); | 297 this->INHERITED::onDrawPicture(picture, matrix, paint); |
277 } | 298 } |
278 | 299 |
279 void SkLuaCanvas::drawVertices(VertexMode vmode, int vertexCount, | 300 void SkLuaCanvas::onDrawVertices(VertexMode vmode, int vertexCount, |
280 const SkPoint vertices[], const SkPoint texs[], | 301 const SkPoint vertices[], const SkPoint texs[], |
281 const SkColor colors[], SkXfermode* xmode, | 302 const SkColor colors[], SkXfermode* xmode, |
282 const uint16_t indices[], int indexCount, | 303 const uint16_t indices[], int indexCount, |
283 const SkPaint& paint) { | 304 const SkPaint& paint) { |
284 AUTO_LUA("drawVertices"); | 305 AUTO_LUA("drawVertices"); |
285 lua.pushPaint(paint, "paint"); | 306 lua.pushPaint(paint, "paint"); |
286 } | 307 } |
OLD | NEW |