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

Unified Diff: experimental/SkV8Example/SkV8Example.h

Issue 121303004: Fleshed out a lot of the Path interfac (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused imports Created 6 years, 11 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 | « experimental/SkV8Example/Path.cpp ('k') | experimental/SkV8Example/SkV8Example.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/SkV8Example.h
diff --git a/experimental/SkV8Example/SkV8Example.h b/experimental/SkV8Example/SkV8Example.h
index 30737963f3b3b07f0ebddd17ba7f4cb49c0529ba..770597f55d9ee2565a09a263b595387881d80d68 100644
--- a/experimental/SkV8Example/SkV8Example.h
+++ b/experimental/SkV8Example/SkV8Example.h
@@ -10,20 +10,13 @@
#ifndef SkV8Example_DEFINED
#define SkV8Example_DEFINED
-#include <v8.h>
-
#include "SkWindow.h"
-#include "SkPaint.h"
-
-using namespace v8;
-class SkCanvas;
-class JsCanvas;
-class Global;
+class JsContext;
class SkV8ExampleWindow : public SkOSWindow {
public:
- SkV8ExampleWindow(void* hwnd, JsCanvas* canvas);
+ SkV8ExampleWindow(void* hwnd, JsContext* canvas);
protected:
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE;
@@ -34,66 +27,7 @@ protected:
private:
typedef SkOSWindow INHERITED;
- JsCanvas* fJsCanvas;
-};
-
-
-// Provides the canvas implementation in JS, and the OnDraw() method in C++
-// that's used to bridge from C++ to JS. Should be used in JS as:
-//
-// function onDraw(canvas) {
-// canvas.fillStyle="#FF0000";
-// canvas.fillRect(x, y, w, h);
-// }
-class JsCanvas {
-public:
- JsCanvas(Global* global)
- : fGlobal(global)
- , fCanvas(NULL)
- {
- fFillStyle.setColor(SK_ColorRED);
- }
- ~JsCanvas();
-
- // Parse the script.
- bool initialize();
-
- // Call this with the SkCanvas you want onDraw to draw on.
- void onDraw(SkCanvas* canvas);
-
-private:
- // Implementation of the canvas.fillStyle field.
- static void GetFillStyle(Local<String> name,
- const PropertyCallbackInfo<Value>& info);
- static void SetFillStyle(Local<String> name, Local<Value> value,
- const PropertyCallbackInfo<void>& info);
-
- // Implementation of the canvas.fillRect() JS function.
- static void FillRect(const v8::FunctionCallbackInfo<Value>& args);
-
- // Get the pointer out of obj.
- static JsCanvas* Unwrap(Handle<Object> obj);
-
- // Create a template for JS object associated with JsCanvas, called lazily
- // by Wrap() and the results are stored in fCanvasTemplate;
- Handle<ObjectTemplate> makeCanvasTemplate();
-
- // Wrap the 'this' pointer into an Object. Can be retrieved via Unwrap.
- Handle<Object> wrap();
-
- Global* fGlobal;
-
- // Only valid when inside OnDraw().
- SkCanvas* fCanvas;
-
- SkPaint fFillStyle;
-
- // A handle to the onDraw function defined in the script.
- Persistent<Function> fOnDraw;
-
- // The template for what a canvas object looks like. The canvas object is
- // what's passed into the JS onDraw() function.
- static Persistent<ObjectTemplate> fCanvasTemplate;
+ JsContext* fJsContext;
};
#endif
« no previous file with comments | « experimental/SkV8Example/Path.cpp ('k') | experimental/SkV8Example/SkV8Example.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698