Chromium Code Reviews| Index: experimental/SkV8Example/SkV8Example.h |
| diff --git a/experimental/SkV8Example/SkV8Example.h b/experimental/SkV8Example/SkV8Example.h |
| index 878e1f0f1f8db13a1ce9a5d863711af648637576..2b650f2ee5035746f631f9fa95da239f28a29813 100644 |
| --- a/experimental/SkV8Example/SkV8Example.h |
| +++ b/experimental/SkV8Example/SkV8Example.h |
| @@ -13,6 +13,7 @@ |
| #include <v8.h> |
| #include "SkWindow.h" |
| +#include "SkPaint.h" |
| using namespace v8; |
| @@ -32,7 +33,6 @@ protected: |
| private: |
| typedef SkOSWindow INHERITED; |
| - SkScalar fRotationAngle; |
| JsCanvas* fJsCanvas; |
| }; |
| @@ -41,17 +41,19 @@ private: |
| // that's used to bridge from C++ to JS. Should be used in JS as: |
| // |
| // function onDraw(canvas) { |
| -// canvas.drawRect(); |
| -// canvas.inval(); |
| +// canvas.fillStyle="#FF0000"; |
| +// canvas.fillRect(x, y, w, h); |
| +// canvas.inval(); |
| // } |
| -// |
| class JsCanvas { |
| public: |
| JsCanvas(Isolate* isolate) |
| : fIsolate(isolate) |
| , fCanvas(NULL) |
| , fWindow(NULL) |
| - {} |
| + { |
| + fFillStyle.setColor(SK_ColorRED); |
| + } |
| ~JsCanvas(); |
| // Parse the script. |
| @@ -61,8 +63,14 @@ public: |
| void onDraw(SkCanvas* canvas, SkOSWindow* window); |
| private: |
| - // Implementation of the canvas.drawRect() JS function. |
| - static void drawRect(const v8::FunctionCallbackInfo<Value>& args); |
| + // Implementation of the canvas.fillStyle field. |
|
robertphillips
2013/12/11 16:45:46
GetFillStyle & SetFillStyle - since static
jcgregorio
2013/12/11 17:23:47
Done.
|
| + static void getFillStyle(Local<String> name, |
| + const PropertyCallbackInfo<Value>& info); |
|
robertphillips
2013/12/11 16:45:46
put const on same line as 'info'?
jcgregorio
2013/12/11 17:23:47
Done.
|
| + static void setFillStyle(Local<String> name, Local<Value> value, const |
| + PropertyCallbackInfo<void>& info); |
| + |
| + // Implementation of the canvas.fillRect() JS function. |
|
robertphillips
2013/12/11 16:45:46
FillRect
jcgregorio
2013/12/11 17:23:47
Done.
|
| + static void fillRect(const v8::FunctionCallbackInfo<Value>& args); |
| // Implementation of the canvas.inval() JS function. |
|
robertphillips
2013/12/11 16:45:46
Inval
jcgregorio
2013/12/11 17:23:47
Done.
|
| static void inval(const v8::FunctionCallbackInfo<Value>& args); |
| @@ -82,6 +90,8 @@ private: |
| // Only valid when inside OnDraw(). |
| SkCanvas* fCanvas; |
| + SkPaint fFillStyle; |
| + |
| // Only valid when inside OnDraw(). |
| SkOSWindow* fWindow; |