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

Unified Diff: experimental/SkV8Example/SkV8Example.h

Issue 108813004: Added canvas.fillStyle with support for just the "#RRGGBB" style of colors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix more 80 cols Created 7 years 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 | « no previous file | experimental/SkV8Example/SkV8Example.cpp » ('j') | experimental/SkV8Example/SkV8Example.cpp » ('J')
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 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;
« no previous file with comments | « no previous file | experimental/SkV8Example/SkV8Example.cpp » ('j') | experimental/SkV8Example/SkV8Example.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698