Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
|
robertphillips
2014/10/27 16:11:17
Do we need this?
jcgregorio
2014/10/27 16:30:23
Done.
| |
| 15 #include "SkPaint.h" | |
| 16 | |
| 17 class SkCanvas; | |
| 18 class Global; | |
| 19 | |
| 20 // DrawingMethods contains common functionality for both Context, Image2Builder, | |
| 21 // and DisplayListBuiler. | |
| 22 class DrawingMethods { | |
| 23 public: | |
| 24 DrawingMethods(Global* global) | |
| 25 : fGlobal(global) | |
| 26 {} | |
| 27 virtual ~DrawingMethods() {} | |
| 28 | |
| 29 // Retrieve the SkCanvas to draw on. May return NULL. | |
| 30 virtual SkCanvas* getCanvas() = 0; | |
| 31 | |
|
robertphillips
2014/10/27 16:11:17
overlength ?
jcgregorio
2014/10/27 16:30:23
Done.
| |
| 32 // Add the Javascript attributes and methods that DrawingMethods implements to the ObjectTemplate. | |
| 33 void addAttributesAndMethods(v8::Handle<v8::ObjectTemplate> tmpl); | |
| 34 | |
| 35 protected: | |
| 36 // Get the pointer out of obj. | |
| 37 static DrawingMethods* Unwrap(v8::Handle<v8::Object> obj); | |
| 38 | |
| 39 Global* fGlobal; | |
| 40 | |
| 41 private: | |
| 42 // JS Attributes | |
| 43 static void GetWidth(v8::Local<v8::String> name, | |
| 44 const v8::PropertyCallbackInfo<v8::Value>& info); | |
| 45 static void GetHeight(v8::Local<v8::String> name, | |
| 46 const v8::PropertyCallbackInfo<v8::Value>& info); | |
| 47 | |
| 48 // JS Methods | |
| 49 static void Save(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 50 static void Restore(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 51 static void Rotate(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 52 static void Translate(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 53 static void ResetTransform(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 54 | |
| 55 static void DrawPath(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 56 }; | |
| 57 | |
| 58 #endif | |
| OLD | NEW |