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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « experimental/SkV8Example/BaseContext.cpp ('k') | experimental/SkV8Example/DrawingMethods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 *
8 */
9
10 #ifndef SkV8Example_DrawingMethods_DEFINED
11 #define SkV8Example_DrawingMethods_DEFINED
12
13 #include <v8.h>
14
15 class SkCanvas;
16 class Global;
17
18 // DrawingMethods contains common functionality for both Context, Image2Builder,
19 // and DisplayListBuiler.
20 class DrawingMethods {
21 public:
22 DrawingMethods(Global* global)
23 : fGlobal(global)
24 {}
25 virtual ~DrawingMethods() {}
26
27 // Retrieve the SkCanvas to draw on. May return NULL.
28 virtual SkCanvas* getCanvas() = 0;
29
30 // Add the Javascript attributes and methods that DrawingMethods
31 // implements to the ObjectTemplate.
32 void addAttributesAndMethods(v8::Handle<v8::ObjectTemplate> tmpl);
33
34 protected:
35 // Get the pointer out of obj.
36 static DrawingMethods* Unwrap(v8::Handle<v8::Object> obj);
37
38 Global* fGlobal;
39
40 private:
41 // JS Attributes
42 static void GetWidth(v8::Local<v8::String> name,
43 const v8::PropertyCallbackInfo<v8::Value>& info);
44 static void GetHeight(v8::Local<v8::String> name,
45 const v8::PropertyCallbackInfo<v8::Value>& info);
46
47 // JS Methods
48 static void Save(const v8::FunctionCallbackInfo<v8::Value>& args);
49 static void Restore(const v8::FunctionCallbackInfo<v8::Value>& args);
50 static void Rotate(const v8::FunctionCallbackInfo<v8::Value>& args);
51 static void Translate(const v8::FunctionCallbackInfo<v8::Value>& args);
52 static void ResetTransform(const v8::FunctionCallbackInfo<v8::Value>& args);
53
54 static void DrawPath(const v8::FunctionCallbackInfo<v8::Value>& args);
55 };
56
57 #endif
OLDNEW
« 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