Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: include/utils/SkLuaCanvas.h

Issue 14907017: add SkLuaCanvas (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gyp/tools.gyp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2013 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 #ifndef SkProxyCanvas_DEFINED 7
9 #define SkProxyCanvas_DEFINED 8 #ifndef SkLuaCanvas_DEFINED
9 #define SkLuaCanvas_DEFINED
10 10
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkString.h"
12 13
13 /** This class overrides all virtual methods on SkCanvas, and redirects them 14 struct lua_State;
14 to a "proxy", another SkCanvas instance. It can be the basis for
15 intercepting (and possibly modifying) calls to a canvas.
16 15
17 There must be a proxy installed before the proxycanvas can be used (i.e. 16 class SkLuaCanvas : public SkCanvas {
18 before its virtual methods can be called).
19 */
20 class SkProxyCanvas : public SkCanvas {
21 public: 17 public:
22 SkProxyCanvas() : fProxy(NULL) {} 18 SkLuaCanvas(int width, int height, lua_State*, const char function[]);
23 SkProxyCanvas(SkCanvas* proxy); 19 virtual ~SkLuaCanvas();
24 virtual ~SkProxyCanvas();
25 20
26 SkCanvas* getProxy() const { return fProxy; } 21 virtual int save(SaveFlags flags) SK_OVERRIDE;
27 void setProxy(SkCanvas* proxy);
28
29 virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE;
30 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, 22 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
31 SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRID E; 23 SaveFlags flags) SK_OVERRIDE;
32 virtual void restore() SK_OVERRIDE; 24 virtual void restore() SK_OVERRIDE;
33 25
34 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE; 26 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
35 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE; 27 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
36 virtual bool rotate(SkScalar degrees) SK_OVERRIDE; 28 virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
37 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE; 29 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
38 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE; 30 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
39 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; 31 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
40 32
41 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE; 33 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
42 virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE; 34 virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
43 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; 35 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
44 virtual bool clipRegion(const SkRegion& deviceRgn, 36 virtual bool clipRegion(const SkRegion& deviceRgn,
45 SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRI DE; 37 SkRegion::Op) SK_OVERRIDE;
46 38
47 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 39 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
48 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 40 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
49 const SkPaint& paint) SK_OVERRIDE; 41 const SkPaint& paint) SK_OVERRIDE;
50 virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE; 42 virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
51 virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; 43 virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
52 virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; 44 virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
53 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; 45 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
54 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 46 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
55 const SkPaint* paint = NULL) SK_OVERRIDE; 47 const SkPaint* paint) SK_OVERRIDE;
56 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, 48 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
57 const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE; 49 const SkRect& dst, const SkPaint* paint) S K_OVERRIDE;
58 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, 50 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
59 const SkPaint* paint = NULL) SK_OVERRIDE; 51 const SkPaint* paint) SK_OVERRIDE;
60 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, 52 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
61 const SkPaint* paint = NULL) SK_OVERRIDE; 53 const SkPaint* paint) SK_OVERRIDE;
62 virtual void drawText(const void* text, size_t byteLength, SkScalar x, 54 virtual void drawText(const void* text, size_t byteLength, SkScalar x,
63 SkScalar y, const SkPaint& paint) SK_OVERRIDE; 55 SkScalar y, const SkPaint& paint) SK_OVERRIDE;
64 virtual void drawPosText(const void* text, size_t byteLength, 56 virtual void drawPosText(const void* text, size_t byteLength,
65 const SkPoint pos[], const SkPaint& paint) SK_OVERR IDE; 57 const SkPoint pos[], const SkPaint& paint) SK_OVERR IDE;
66 virtual void drawPosTextH(const void* text, size_t byteLength, 58 virtual void drawPosTextH(const void* text, size_t byteLength,
67 const SkScalar xpos[], SkScalar constY, 59 const SkScalar xpos[], SkScalar constY,
68 const SkPaint& paint) SK_OVERRIDE; 60 const SkPaint& paint) SK_OVERRIDE;
69 virtual void drawTextOnPath(const void* text, size_t byteLength, 61 virtual void drawTextOnPath(const void* text, size_t byteLength,
70 const SkPath& path, const SkMatrix* matrix, 62 const SkPath& path, const SkMatrix* matrix,
71 const SkPaint& paint) SK_OVERRIDE; 63 const SkPaint& paint) SK_OVERRIDE;
72 virtual void drawPicture(SkPicture&) SK_OVERRIDE; 64 virtual void drawPicture(SkPicture&) SK_OVERRIDE;
73 virtual void drawVertices(VertexMode vmode, int vertexCount, 65 virtual void drawVertices(VertexMode vmode, int vertexCount,
74 const SkPoint vertices[], const SkPoint texs[], 66 const SkPoint vertices[], const SkPoint texs[],
75 const SkColor colors[], SkXfermode* xmode, 67 const SkColor colors[], SkXfermode* xmode,
76 const uint16_t indices[], int indexCount, 68 const uint16_t indices[], int indexCount,
77 const SkPaint& paint) SK_OVERRIDE; 69 const SkPaint& paint) SK_OVERRIDE;
78 virtual void drawData(const void* data, size_t length) SK_OVERRIDE; 70 virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
79 71
80 virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
81 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
82
83 private: 72 private:
84 SkCanvas* fProxy; 73 lua_State* fL;
74 SkString fFunc;
75
76 void sendverb(const char verb[]);
85 77
86 typedef SkCanvas INHERITED; 78 typedef SkCanvas INHERITED;
87 }; 79 };
88 80
89 #endif 81 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698