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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/egltest/eglplatform_shim.h"
6
7 #include <string.h>
8 #include <X11/Xlib.h>
9 #include <X11/Xatom.h>
10 #include <X11/Xutil.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 Display* g_display;
17
18 const int kDefaultX = 0;
19 const int kDefaultY = 0;
20 const int kDefaultWidth = 800;
21 const int kDefaultHeight = 600;
22 const int kDefaultBorderWidth = 0;
23
24 const char* ShimQueryString(int name) {
25 switch (name) {
26 case SHIM_EGL_LIBRARY:
27 return "libEGL.so.1";
28 case SHIM_GLES_LIBRARY:
29 return "libGLESv2.so.2";
30 default:
31 return NULL;
32 }
33 }
34
35 bool ShimInitialize() {
36 g_display = XOpenDisplay(NULL);
37 return g_display != NULL;
38 }
39
40 bool ShimTerminate() {
41 XCloseDisplay(g_display);
42 return true;
43 }
44
45 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.
46 XSetWindowAttributes swa;
47 memset(&swa, 0, sizeof(swa));
48 swa.event_mask = 0;
49
50 Window window = XCreateWindow(g_display,
51 DefaultRootWindow(g_display),
52 kDefaultX,
53 kDefaultY,
54 kDefaultWidth,
55 kDefaultHeight,
56 kDefaultBorderWidth,
57 CopyFromParent,
58 InputOutput,
59 CopyFromParent,
60 CWEventMask,
61 &swa);
62
63 XMapWindow(g_display, window);
64 XStoreName(g_display, window, "EGL test");
65 XFlush(g_display);
66
67 return window;
68 }
69
70 bool ShimQueryWindow(ShimNativeWindowId window_id, int attribute, int* value) {
71 XWindowAttributes window_attributes;
72 switch (attribute) {
73 case SHIM_WINDOW_WIDTH:
74 XGetWindowAttributes(g_display, window_id, &window_attributes);
75 *value = window_attributes.width;
76 return true;
77 case SHIM_WINDOW_HEIGHT:
78 XGetWindowAttributes(g_display, window_id, &window_attributes);
79 *value = window_attributes.height;
80 return true;
81 default:
82 return false;
83 }
84 }
85
86 bool ShimDestroyWindow(ShimNativeWindowId window_id) {
87 XDestroyWindow(g_display, window_id);
88 return true;
89 }
90
91 EGLNativeDisplayType ShimGetNativeDisplay() {
92 return g_display;
93 }
94
95 EGLNativeWindowType ShimGetNativeWindow(ShimNativeWindowId native_window_id) {
96 return native_window_id;
97 }
98
99 bool ShimReleaseNativeWindow(EGLNativeWindowType native_window) {
100 return true;
101 }
102
103 #ifdef __cplusplus
104 }
105 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698