diff options
author | Brian Osman <brianosman@google.com> | 2017-11-21 11:33:04 -0500 |
---|---|---|
committer | Brian Osman <brianosman@google.com> | 2017-11-21 16:46:32 +0000 |
commit | 9e021d2441031042bb2aa7ce8c44e69a05ef992b (patch) | |
tree | fafd6e28941dd9027a4b017626b715c6b8db7bfe /experimental/SkV8Example/JsContext.h | |
parent | 08604583338379892b70356b8197f33df7721269 (diff) |
Remove SkV8Example
Bug: skia:
Change-Id: I411787ae3ef7185e2909a683537799e51096fd62
Reviewed-on: https://skia-review.googlesource.com/74201
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'experimental/SkV8Example/JsContext.h')
-rw-r--r-- | experimental/SkV8Example/JsContext.h | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/experimental/SkV8Example/JsContext.h b/experimental/SkV8Example/JsContext.h deleted file mode 100644 index a6b5e4cae5..0000000000 --- a/experimental/SkV8Example/JsContext.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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_JsContext_DEFINED -#define SkV8Example_JsContext_DEFINED - -#include <v8.h> - -#include "SkPaint.h" -#include "DrawingMethods.h" - -class SkCanvas; -class Global; - -// Provides the canvas context implementation in JS, and the OnDraw() method in -// C++ that's used to bridge from C++ to JS. Should be used in JS as: -// -// function onDraw(context) { -// context.fillStyle="#FF0000"; -// context.fillRect(x, y, w, h); -// } -class JsContext : public DrawingMethods { -public: - JsContext(Global* global) - : INHERITED(global) - , fCanvas(NULL) - { - } - virtual ~JsContext() {} - - // Parse the script. - bool initialize(); - - // Call this with the SkCanvas you want onDraw to draw on. - void onDraw(SkCanvas* canvas); - - virtual SkCanvas* getCanvas() { return fCanvas; }; - -private: - - // Wrap the 'this' pointer into an Object. Can be retrieved via Unwrap. - v8::Handle<v8::Object> wrap(); - - // A handle to the onDraw function defined in the script. - v8::Persistent<v8::Function> fOnDraw; - - // The template for what a canvas context object looks like. The canvas - // context object is what's passed into the JS onDraw() function. - static v8::Persistent<v8::ObjectTemplate> gContextTemplate; - - // Only valid when inside OnDraw(). - SkCanvas* fCanvas; - - typedef DrawingMethods INHERITED; -}; - -#endif |