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

Unified Diff: experimental/SkV8Example/DrawingMethods.h

Issue 676423002: Start moving to the new canvas structure. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/BaseContext.cpp ('k') | experimental/SkV8Example/DrawingMethods.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/DrawingMethods.h
diff --git a/experimental/SkV8Example/DrawingMethods.h b/experimental/SkV8Example/DrawingMethods.h
new file mode 100644
index 0000000000000000000000000000000000000000..d72a3df018e9b42d28c7271ba008bc9ae09f8ef9
--- /dev/null
+++ b/experimental/SkV8Example/DrawingMethods.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ */
+
+#ifndef SkV8Example_DrawingMethods_DEFINED
+#define SkV8Example_DrawingMethods_DEFINED
+
+#include <v8.h>
+
+class SkCanvas;
+class Global;
+
+// DrawingMethods contains common functionality for both Context, Image2Builder,
+// and DisplayListBuiler.
+class DrawingMethods {
+public:
+ DrawingMethods(Global* global)
+ : fGlobal(global)
+ {}
+ virtual ~DrawingMethods() {}
+
+ // Retrieve the SkCanvas to draw on. May return NULL.
+ virtual SkCanvas* getCanvas() = 0;
+
+ // Add the Javascript attributes and methods that DrawingMethods
+ // implements to the ObjectTemplate.
+ void addAttributesAndMethods(v8::Handle<v8::ObjectTemplate> tmpl);
+
+protected:
+ // Get the pointer out of obj.
+ static DrawingMethods* Unwrap(v8::Handle<v8::Object> obj);
+
+ Global* fGlobal;
+
+private:
+ // JS Attributes
+ static void GetWidth(v8::Local<v8::String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info);
+ static void GetHeight(v8::Local<v8::String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info);
+
+ // JS Methods
+ static void Save(const v8::FunctionCallbackInfo<v8::Value>& args);
+ static void Restore(const v8::FunctionCallbackInfo<v8::Value>& args);
+ static void Rotate(const v8::FunctionCallbackInfo<v8::Value>& args);
+ static void Translate(const v8::FunctionCallbackInfo<v8::Value>& args);
+ static void ResetTransform(const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ static void DrawPath(const v8::FunctionCallbackInfo<v8::Value>& args);
+};
+
+#endif
« no previous file with comments | « experimental/SkV8Example/BaseContext.cpp ('k') | experimental/SkV8Example/DrawingMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698