| 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 #ifndef SkLuaCanvas_DEFINED | 8 #ifndef SkLuaCanvas_DEFINED |
| 9 #define SkLuaCanvas_DEFINED | 9 #define SkLuaCanvas_DEFINED |
| 10 | 10 |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkString.h" | 12 #include "SkString.h" |
| 13 | 13 |
| 14 struct lua_State; | 14 struct lua_State; |
| 15 | 15 |
| 16 class SkLuaCanvas : public SkCanvas { | 16 class SkLuaCanvas : public SkCanvas { |
| 17 public: | 17 public: |
| 18 void pushThis(); | 18 void pushThis(); |
| 19 | 19 |
| 20 SkLuaCanvas(int width, int height, lua_State*, const char function[]); | 20 SkLuaCanvas(int width, int height, lua_State*, const char function[]); |
| 21 virtual ~SkLuaCanvas(); | 21 virtual ~SkLuaCanvas(); |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 void willSave() SK_OVERRIDE; | 24 void willSave() override; |
| 25 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; | 25 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) ov
erride; |
| 26 void willRestore() SK_OVERRIDE; | 26 void willRestore() override; |
| 27 | 27 |
| 28 void didConcat(const SkMatrix&) SK_OVERRIDE; | 28 void didConcat(const SkMatrix&) override; |
| 29 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 29 void didSetMatrix(const SkMatrix&) override; |
| 30 | 30 |
| 31 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 31 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
| 32 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 32 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
| 33 const SkPaint&) SK_OVERRIDE; | 33 const SkPaint&) override; |
| 34 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 34 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
| 35 const SkPaint&) SK_OVERRIDE; | 35 const SkPaint&) override; |
| 36 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 36 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
| 37 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 37 SkScalar constY, const SkPaint&) override; |
| 38 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 38 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
| 39 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 39 const SkMatrix* matrix, const SkPaint&) overri
de; |
| 40 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 40 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 41 const SkPaint& paint) SK_OVERRIDE; | 41 const SkPaint& paint) override; |
| 42 | 42 |
| 43 void onDrawPaint(const SkPaint&) SK_OVERRIDE; | 43 void onDrawPaint(const SkPaint&) override; |
| 44 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) SK_OVERRIDE; | 44 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
| 45 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; | 45 void onDrawRect(const SkRect&, const SkPaint&) override; |
| 46 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 46 void onDrawOval(const SkRect&, const SkPaint&) override; |
| 47 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 47 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 48 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE; | 48 void onDrawPath(const SkPath&, const SkPaint&) override; |
| 49 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) SK_OVERRIDE; | 49 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; |
| 50 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | 50 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
| 51 DrawBitmapRectFlags flags) SK_OVERRIDE; | 51 DrawBitmapRectFlags flags) override; |
| 52 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE; | 52 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; |
| 53 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 53 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
| 54 const SkPaint*) SK_OVERRIDE; | 54 const SkPaint*) override; |
| 55 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | 55 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
| 56 const SkPaint*) SK_OVERRIDE; | 56 const SkPaint*) override; |
| 57 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | 57 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri
de; |
| 58 void onDrawVertices(VertexMode vmode, int vertexCount, | 58 void onDrawVertices(VertexMode vmode, int vertexCount, |
| 59 const SkPoint vertices[], const SkPoint texs[], | 59 const SkPoint vertices[], const SkPoint texs[], |
| 60 const SkColor colors[], SkXfermode* xmode, | 60 const SkColor colors[], SkXfermode* xmode, |
| 61 const uint16_t indices[], int indexCount, | 61 const uint16_t indices[], int indexCount, |
| 62 const SkPaint&) SK_OVERRIDE; | 62 const SkPaint&) override; |
| 63 | 63 |
| 64 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 64 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 65 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 65 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 66 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 66 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
| 67 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 67 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
| 68 | 68 |
| 69 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; | 69 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 lua_State* fL; | 72 lua_State* fL; |
| 73 SkString fFunc; | 73 SkString fFunc; |
| 74 | 74 |
| 75 void sendverb(const char verb[]); | 75 void sendverb(const char verb[]); |
| 76 | 76 |
| 77 typedef SkCanvas INHERITED; | 77 typedef SkCanvas INHERITED; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif | 80 #endif |
| OLD | NEW |