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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/tools.gyp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkLuaCanvas.h
diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkLuaCanvas.h
similarity index 68%
copy from include/utils/SkProxyCanvas.h
copy to include/utils/SkLuaCanvas.h
index bd260c77d2dc4731bd86918066829550c65c3f3e..16ea5538ab1ae92c5c99c56d0a131c149f8b0d68 100644
--- a/include/utils/SkProxyCanvas.h
+++ b/include/utils/SkLuaCanvas.h
@@ -1,49 +1,41 @@
-
/*
- * Copyright 2011 Google Inc.
+ * Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef SkProxyCanvas_DEFINED
-#define SkProxyCanvas_DEFINED
+
+#ifndef SkLuaCanvas_DEFINED
+#define SkLuaCanvas_DEFINED
#include "SkCanvas.h"
+#include "SkString.h"
-/** This class overrides all virtual methods on SkCanvas, and redirects them
- to a "proxy", another SkCanvas instance. It can be the basis for
- intercepting (and possibly modifying) calls to a canvas.
+struct lua_State;
- There must be a proxy installed before the proxycanvas can be used (i.e.
- before its virtual methods can be called).
- */
-class SkProxyCanvas : public SkCanvas {
+class SkLuaCanvas : public SkCanvas {
public:
- SkProxyCanvas() : fProxy(NULL) {}
- SkProxyCanvas(SkCanvas* proxy);
- virtual ~SkProxyCanvas();
-
- SkCanvas* getProxy() const { return fProxy; }
- void setProxy(SkCanvas* proxy);
+ SkLuaCanvas(int width, int height, lua_State*, const char function[]);
+ virtual ~SkLuaCanvas();
- virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE;
+ virtual int save(SaveFlags flags) SK_OVERRIDE;
virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRIDE;
+ SaveFlags flags) SK_OVERRIDE;
virtual void restore() SK_OVERRIDE;
-
+
virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
-
+
virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipRegion(const SkRegion& deviceRgn,
- SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
-
+ SkRegion::Op) SK_OVERRIDE;
+
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
const SkPaint& paint) SK_OVERRIDE;
@@ -52,13 +44,13 @@ public:
virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
+ const SkPaint* paint) SK_OVERRIDE;
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE;
+ const SkRect& dst, const SkPaint* paint) SK_OVERRIDE;
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
- const SkPaint* paint = NULL) SK_OVERRIDE;
+ const SkPaint* paint) SK_OVERRIDE;
virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
+ const SkPaint* paint) SK_OVERRIDE;
virtual void drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) SK_OVERRIDE;
virtual void drawPosText(const void* text, size_t byteLength,
@@ -77,11 +69,11 @@ public:
const SkPaint& paint) SK_OVERRIDE;
virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
- virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
- virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
-
private:
- SkCanvas* fProxy;
+ lua_State* fL;
+ SkString fFunc;
+
+ void sendverb(const char verb[]);
typedef SkCanvas INHERITED;
};
« 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