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

Unified Diff: experimental/SkV8Example/JsContext.h

Issue 122373003: Add the gears.js demo and all the code changes needed to get it working, including (Closed) Base URL: https://skia.googlesource.com/skia.git@gl
Patch Set: rename 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 | « no previous file | experimental/SkV8Example/JsContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/JsContext.h
diff --git a/experimental/SkV8Example/JsContext.h b/experimental/SkV8Example/JsContext.h
index 0fc180d956d9a441ece5c2e869a2641f1526d635..c1466a08dda05e4cb7dc3b99dcc68865e6493c36 100644
--- a/experimental/SkV8Example/JsContext.h
+++ b/experimental/SkV8Example/JsContext.h
@@ -32,7 +32,12 @@ public:
: fGlobal(global)
, fCanvas(NULL)
{
- fFillStyle.setColor(SK_ColorRED);
+ fFillStyle.setColor(SK_ColorBLACK);
+ fFillStyle.setAntiAlias(true);
+ fFillStyle.setStyle(SkPaint::kFill_Style);
+ fStrokeStyle.setColor(SK_ColorBLACK);
+ fStrokeStyle.setAntiAlias(true);
+ fStrokeStyle.setStyle(SkPaint::kStroke_Style);
}
~JsContext();
@@ -43,29 +48,34 @@ public:
void onDraw(SkCanvas* canvas);
private:
- // Implementation of the context.fillStyle field.
+ static void GetStyle(Local<String> name,
+ const PropertyCallbackInfo<Value>& info,
+ const SkPaint& style);
+ static void SetStyle(Local<String> name, Local<Value> value,
+ const PropertyCallbackInfo<void>& info,
+ SkPaint& style);
+ // JS Attributes
static void GetFillStyle(Local<String> name,
- const PropertyCallbackInfo<Value>& info);
+ const PropertyCallbackInfo<Value>& info);
static void SetFillStyle(Local<String> name, Local<Value> value,
- const PropertyCallbackInfo<void>& info);
+ const PropertyCallbackInfo<void>& info);
+ static void GetStrokeStyle(Local<String> name,
+ const PropertyCallbackInfo<Value>& info);
+ static void SetStrokeStyle(Local<String> name, Local<Value> value,
+ const PropertyCallbackInfo<void>& info);
static void GetWidth(Local<String> name,
const PropertyCallbackInfo<Value>& info);
static void GetHeight(Local<String> name,
const PropertyCallbackInfo<Value>& info);
- // Implementation of the context.fillRect() JS function.
+ // JS Methods
static void FillRect(const v8::FunctionCallbackInfo<Value>& args);
-
- // Implementation of the context.stroke(Path path) JS function.
static void Stroke(const v8::FunctionCallbackInfo<Value>& args);
-
- // Implementation of the context.fill(Path path) JS function.
static void Fill(const v8::FunctionCallbackInfo<Value>& args);
-
- // Implementation of the context.translate(dx, dy) JS function.
+ static void Rotate(const v8::FunctionCallbackInfo<Value>& args);
+ static void Save(const v8::FunctionCallbackInfo<Value>& args);
+ static void Restore(const v8::FunctionCallbackInfo<Value>& args);
static void Translate(const v8::FunctionCallbackInfo<Value>& args);
-
- // Implementation of the context.resetTransform() JS function.
static void ResetTransform(const v8::FunctionCallbackInfo<Value>& args);
// Get the pointer out of obj.
@@ -84,6 +94,7 @@ private:
SkCanvas* fCanvas;
SkPaint fFillStyle;
+ SkPaint fStrokeStyle;
// A handle to the onDraw function defined in the script.
Persistent<Function> fOnDraw;
« no previous file with comments | « no previous file | experimental/SkV8Example/JsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698