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

Unified Diff: ui/ozone/platform/egltest/eglplatform_shim_xeleven.cc

Issue 288603002: ozone: Add egltest platform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: deofficialize Created 6 years, 7 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: ui/ozone/platform/egltest/eglplatform_shim_xeleven.cc
diff --git a/ui/ozone/platform/egltest/eglplatform_shim_xeleven.cc b/ui/ozone/platform/egltest/eglplatform_shim_xeleven.cc
new file mode 100644
index 0000000000000000000000000000000000000000..68de8921f1b6dfd69905f41bf683827788232145
--- /dev/null
+++ b/ui/ozone/platform/egltest/eglplatform_shim_xeleven.cc
@@ -0,0 +1,105 @@
+// Copyright 2014 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 "ui/ozone/platform/egltest/eglplatform_shim.h"
+
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Display* g_display;
+
+const int kDefaultX = 0;
+const int kDefaultY = 0;
+const int kDefaultWidth = 800;
+const int kDefaultHeight = 600;
+const int kDefaultBorderWidth = 0;
+
+const char* ShimQueryString(int name) {
+ switch (name) {
+ case SHIM_EGL_LIBRARY:
+ return "libEGL.so.1";
+ case SHIM_GLES_LIBRARY:
+ return "libGLESv2.so.2";
+ default:
+ return NULL;
+ }
+}
+
+bool ShimInitialize() {
+ g_display = XOpenDisplay(NULL);
+ return g_display != NULL;
+}
+
+bool ShimTerminate() {
+ XCloseDisplay(g_display);
+ return true;
+}
+
+ShimNativeWindowId ShimCreateWindow(const int* attrib_list) {
alexst (slow to review) 2014/05/13 22:11:14 I am assuming this is future use? If so maybe add
spang 2014/05/13 22:28:08 Done.
+ XSetWindowAttributes swa;
+ memset(&swa, 0, sizeof(swa));
+ swa.event_mask = 0;
+
+ Window window = XCreateWindow(g_display,
+ DefaultRootWindow(g_display),
+ kDefaultX,
+ kDefaultY,
+ kDefaultWidth,
+ kDefaultHeight,
+ kDefaultBorderWidth,
+ CopyFromParent,
+ InputOutput,
+ CopyFromParent,
+ CWEventMask,
+ &swa);
+
+ XMapWindow(g_display, window);
+ XStoreName(g_display, window, "EGL test");
+ XFlush(g_display);
+
+ return window;
+}
+
+bool ShimQueryWindow(ShimNativeWindowId window_id, int attribute, int* value) {
+ XWindowAttributes window_attributes;
+ switch (attribute) {
+ case SHIM_WINDOW_WIDTH:
+ XGetWindowAttributes(g_display, window_id, &window_attributes);
+ *value = window_attributes.width;
+ return true;
+ case SHIM_WINDOW_HEIGHT:
+ XGetWindowAttributes(g_display, window_id, &window_attributes);
+ *value = window_attributes.height;
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ShimDestroyWindow(ShimNativeWindowId window_id) {
+ XDestroyWindow(g_display, window_id);
+ return true;
+}
+
+EGLNativeDisplayType ShimGetNativeDisplay() {
+ return g_display;
+}
+
+EGLNativeWindowType ShimGetNativeWindow(ShimNativeWindowId native_window_id) {
+ return native_window_id;
+}
+
+bool ShimReleaseNativeWindow(EGLNativeWindowType native_window) {
+ return true;
+}
+
+#ifdef __cplusplus
+}
+#endif

Powered by Google App Engine
This is Rietveld 408576698