Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Unified Diff: tools/vulkan/Window.h

Issue 1848833005: First pass at VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments, plus add GM rendering Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/vulkan/Window.h
diff --git a/tools/vulkan/Window.h b/tools/vulkan/Window.h
new file mode 100644
index 0000000000000000000000000000000000000000..2247ca16ca1ae9369ccf8c47964d7c61f8587b0f
--- /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 {
+ int fSampleCount;
+ int fStencilBits;
+ };
+
+ enum BackEndTypes {
+ kNativeGL_BackendType,
+ kVulkan_BackendType
+ };
+
+ virtual bool attach(BackEndTypes attachType, int msaaSampleCount, AttachmentInfo*) = 0;
+ void detach();
+
+ // 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

Powered by Google App Engine
This is Rietveld 408576698