blob: 5185722a77e2a63de71a891726828a38d9bbff0c [file] [log] [blame]
commit-bot@chromium.org44a38772013-12-05 13:45:19 +00001/*
2 * Copyright 2013 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_DEFINED
11#define SkV8Example_DEFINED
12
13#include "SkWindow.h"
14
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000015class GrContext;
16class GrGLInterface;
17class GrRenderTarget;
commit-bot@chromium.org939560b2014-02-27 17:39:40 +000018class SkSurface;
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000019
commit-bot@chromium.orgc8d73282014-01-06 18:17:24 +000020class JsContext;
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000021
22class SkV8ExampleWindow : public SkOSWindow {
23public:
commit-bot@chromium.orgc8d73282014-01-06 18:17:24 +000024 SkV8ExampleWindow(void* hwnd, JsContext* canvas);
commit-bot@chromium.org939560b2014-02-27 17:39:40 +000025 virtual ~SkV8ExampleWindow();
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000026
27protected:
mtklein36352bf2015-03-25 18:17:31 -070028 void onDraw(SkCanvas* canvas) override;
29 void onSizeChange() override;
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000030
31#if SK_SUPPORT_GPU
mtklein36352bf2015-03-25 18:17:31 -070032 SkSurface* createSurface() override;
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000033#endif
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000034
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000035#ifdef SK_BUILD_FOR_WIN
mtklein36352bf2015-03-25 18:17:31 -070036 void onHandleInval(const SkIRect&) override;
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000037#endif
38
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000039 void windowSizeChanged();
40
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000041private:
42 typedef SkOSWindow INHERITED;
commit-bot@chromium.orgc8d73282014-01-06 18:17:24 +000043 JsContext* fJsContext;
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000044
45#if SK_SUPPORT_GPU
46 GrContext* fCurContext;
47 const GrGLInterface* fCurIntf;
48 GrRenderTarget* fCurRenderTarget;
commit-bot@chromium.org939560b2014-02-27 17:39:40 +000049 SkSurface* fCurSurface;
commit-bot@chromium.org9ee0e322014-01-06 20:03:55 +000050#endif
commit-bot@chromium.org44a38772013-12-05 13:45:19 +000051};
52
53#endif