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

Unified Diff: gpu/vulkan/tests/native_window_x11.cc

Issue 1776453003: Added initial implementation of Vulkan Render Passes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_vulkan
Patch Set: Adding logging/macros headers Created 4 years, 9 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
« no previous file with comments | « gpu/vulkan/tests/native_window.h ('k') | gpu/vulkan/tests/vulkan_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/vulkan/tests/native_window_x11.cc
diff --git a/gpu/vulkan/tests/native_window_x11.cc b/gpu/vulkan/tests/native_window_x11.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e9da1e9c1a54b18d13bf5c22d65ceb12ee8415f1
--- /dev/null
+++ b/gpu/vulkan/tests/native_window_x11.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/vulkan/tests/native_window.h"
+
+#include <X11/Xlib.h>
+
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/x/x11_types.h"
+
+namespace gpu {
+
+gfx::AcceleratedWidget CreateNativeWindow(const gfx::Rect& bounds) {
+ XDisplay* display = gfx::GetXDisplay();
+ XSetWindowAttributes swa;
+ swa.event_mask = StructureNotifyMask | ExposureMask;
+ swa.override_redirect = True;
+ XID window = XCreateWindow(
+ display, RootWindow(display, DefaultScreen(display)), // parent
+ bounds.x(), bounds.y(), bounds.width(), bounds.height(),
+ 0, // border width
+ CopyFromParent, // depth
+ InputOutput,
+ CopyFromParent, // visual
+ CWEventMask | CWOverrideRedirect, &swa);
+ XMapWindow(display, window);
+
+ while (1) {
+ XEvent event;
+ XNextEvent(display, &event);
+ if (event.type == MapNotify && event.xmap.window == window)
+ break;
+ }
+
+ return window;
+}
+
+void DestroyNativeWindow(gfx::AcceleratedWidget window) {
+ XDestroyWindow(gfx::GetXDisplay(), window);
+}
+
+} // namespace gpu
« no previous file with comments | « gpu/vulkan/tests/native_window.h ('k') | gpu/vulkan/tests/vulkan_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698