Index: tools/vulkan/Window.h |
diff --git a/tools/vulkan/Window.h b/tools/vulkan/Window.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2bf7015489528cee1d81f54083d3b4ac06c43639 |
--- /dev/null |
+++ b/tools/vulkan/Window.h |
@@ -0,0 +1,73 @@ |
+/* |
+* Copyright 2016 Google Inc. |
+* |
+* Use of this source code is governed by a BSD-style license that can be |
+* found in the LICENSE file. |
+*/ |
+ |
+#ifndef Window_DEFINED |
+#define Window_DEFINED |
+ |
+class SkCanvas; |
+class VulkanTestContext; |
+ |
+class Window { |
+public: |
+ static Window* CreateNativeWindow(void* platformData); |
+ |
+ virtual ~Window() {}; |
+ |
+ virtual void setTitle(const char*) = 0; |
+ virtual void show() = 0; |
+ |
+ struct AttachmentInfo { |
bsalomon
2016/04/05 18:44:41
Should sample count go into attachment info?
|
+ int fSampleCount; |
+ int fStencilBits; |
+ }; |
+ |
+ enum BackEndTypes { |
+ kNativeGL_BackendType, |
+ kVulkan_BackendType |
+ }; |
+ |
+ virtual bool attach(BackEndTypes attachType, int msaaSampleCount, AttachmentInfo*) = 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
|
+ 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.
|
+ |
+ // input handling |
+ typedef bool(*OnKeyFunc)(int key, bool down, void* userData); |
+ typedef bool(*OnMouseFunc)(int x, int y, bool down, void* userData); |
+ typedef void(*OnPaintFunc)(SkCanvas*, void* userData); |
+ |
+ void registerKeyFunc(OnKeyFunc func, void* userData) { |
+ fKeyFunc = func; |
+ fKeyUserData = userData; |
+ } |
+ |
+ void registerMouseFunc(OnMouseFunc func, void* userData) { |
+ fMouseFunc = func; |
+ fMouseUserData = userData; |
+ } |
+ |
+ void registerPaintFunc(OnPaintFunc func, void* userData) { |
+ fPaintFunc = func; |
+ fPaintUserData = userData; |
+ } |
+ |
+ void onPaint(); |
+ void onSize(); |
+ |
+protected: |
+ Window(); |
+ |
+ OnKeyFunc fKeyFunc; |
+ void* fKeyUserData; |
+ OnMouseFunc fMouseFunc; |
+ void* fMouseUserData; |
+ OnPaintFunc fPaintFunc; |
+ void* fPaintUserData; |
+ |
+ VulkanTestContext* fTestContext; |
+}; |
+ |
+ |
+#endif |