OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef Window_DEFINED | |
9 #define Window_DEFINED | |
10 | |
11 class SkCanvas; | |
12 class VulkanTestContext; | |
13 | |
14 class Window { | |
15 public: | |
16 static Window* CreateNativeWindow(void* platformData); | |
17 | |
18 virtual ~Window() {}; | |
19 | |
20 virtual void setTitle(const char*) = 0; | |
21 virtual void show() = 0; | |
22 | |
23 struct AttachmentInfo { | |
bsalomon
2016/04/05 18:44:41
Should sample count go into attachment info?
| |
24 int fSampleCount; | |
25 int fStencilBits; | |
26 }; | |
27 | |
28 enum BackEndTypes { | |
29 kNativeGL_BackendType, | |
30 kVulkan_BackendType | |
31 }; | |
32 | |
33 virtual bool attach(BackEndTypes attachType, int msaaSampleCount, Attachment Info*) = 0; | |
bsalomon
2016/04/05 14:24:44
Is the window unusable until attach is called?
jvanverth1
2016/04/05 18:16:49
I'm not sure I understand. It's unusable for rende
bsalomon
2016/04/05 18:44:41
nm, I was just making sure I understood how the Wi
| |
34 void release(); | |
bsalomon
2016/04/05 14:24:44
Not totally obvious that this is related to attach
jvanverth1
2016/04/05 18:16:49
Done.
| |
35 | |
36 // input handling | |
37 typedef bool(*OnKeyFunc)(int key, bool down, void* userData); | |
38 typedef bool(*OnMouseFunc)(int x, int y, bool down, void* userData); | |
39 typedef void(*OnPaintFunc)(SkCanvas*, void* userData); | |
40 | |
41 void registerKeyFunc(OnKeyFunc func, void* userData) { | |
42 fKeyFunc = func; | |
43 fKeyUserData = userData; | |
44 } | |
45 | |
46 void registerMouseFunc(OnMouseFunc func, void* userData) { | |
47 fMouseFunc = func; | |
48 fMouseUserData = userData; | |
49 } | |
50 | |
51 void registerPaintFunc(OnPaintFunc func, void* userData) { | |
52 fPaintFunc = func; | |
53 fPaintUserData = userData; | |
54 } | |
55 | |
56 void onPaint(); | |
57 void onSize(); | |
58 | |
59 protected: | |
60 Window(); | |
61 | |
62 OnKeyFunc fKeyFunc; | |
63 void* fKeyUserData; | |
64 OnMouseFunc fMouseFunc; | |
65 void* fMouseUserData; | |
66 OnPaintFunc fPaintFunc; | |
67 void* fPaintUserData; | |
68 | |
69 VulkanTestContext* fTestContext; | |
70 }; | |
71 | |
72 | |
73 #endif | |
OLD | NEW |