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

Side by Side Diff: gpu/gles2_conform_support/native/egl_native_win.cc

Issue 7057033: Move OpenGL ES 2.0 conformance test support into main tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for osx Created 9 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 (c) 2011 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 extern "C" {
6 #if defined(GLES2_CONFORM_SUPPORT_ONLY)
7 #include "gpu/gles2_conform_support/gtf/gtf_stubs.h"
8 #else
9 #include "third_party/gles2_conform/GTF_ES/glsl/GTF/Source/eglNative.h"
10 #endif
11 }
12
13 #include <string>
14
15 namespace {
16 LPCTSTR kWindowClassName = TEXT("ES2CONFORM");
17
18 LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg,
19 WPARAM w_param, LPARAM l_param) {
20 LRESULT result = 0;
21 switch (msg) {
22 case WM_CLOSE:
23 ::DestroyWindow(hwnd);
24 break;
25 case WM_DESTROY:
26 ::PostQuitMessage(0);
27 break;
28 case WM_ERASEBKGND:
29 // Return a non-zero value to indicate that the background has been
30 // erased.
31 result = 1;
32 break;
33 default:
34 result = ::DefWindowProc(hwnd, msg, w_param, l_param);
35 break;
36 }
37 return result;
38 }
39 } // namespace.
40
41 GTFbool GTFNativeCreateDisplay(EGLNativeDisplayType *pNativeDisplay) {
42 *pNativeDisplay = EGL_DEFAULT_DISPLAY;
43 return GTFtrue;
44 }
45
46 void GTFNativeDestroyDisplay(EGLNativeDisplayType nativeDisplay) {
47 // Nothing to destroy since we are using EGL_DEFAULT_DISPLAY
48 }
49
50 GTFbool GTFNativeCreateWindow(EGLNativeDisplayType nativeDisplay,
51 EGLDisplay eglDisplay, EGLConfig eglConfig,
52 const char* title, int width, int height,
53 EGLNativeWindowType *pNativeWindow) {
54 WNDCLASS wnd_class = {0};
55 HINSTANCE instance = GetModuleHandle(NULL);
56 wnd_class.style = CS_OWNDC;
57 wnd_class.lpfnWndProc = WindowProc;
58 wnd_class.hInstance = instance;
59 wnd_class.hbrBackground =
60 reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
61 wnd_class.lpszClassName = kWindowClassName;
62 if (!RegisterClass(&wnd_class))
63 return GTFfalse;
64
65 DWORD wnd_style = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
66 RECT wnd_rect;
67 wnd_rect.left = 0;
68 wnd_rect.top = 0;
69 wnd_rect.right = width;
70 wnd_rect.bottom = height;
71 if (!AdjustWindowRect(&wnd_rect, wnd_style, FALSE))
72 return GTFfalse;
73
74 #ifdef UNICODE
75 // Convert ascii string to wide string.
76 const std::wstring wnd_title(title, title + strlen(title));
77 #else
78 const std::string wnd_title = title;
79 #endif // UNICODE
80
81 HWND hwnd = CreateWindow(
82 wnd_class.lpszClassName,
83 wnd_title.c_str(),
84 wnd_style,
85 0,
86 0,
87 wnd_rect.right - wnd_rect.left,
88 wnd_rect.bottom - wnd_rect.top,
89 NULL,
90 NULL,
91 instance,
92 NULL);
93 if (hwnd == NULL)
94 return GTFfalse;
95
96 ShowWindow(hwnd, SW_SHOWNORMAL);
97 *pNativeWindow = hwnd;
98 return GTFtrue;
99 }
100
101 void GTFNativeDestroyWindow(EGLNativeDisplayType nativeDisplay,
102 EGLNativeWindowType nativeWindow) {
103 DestroyWindow(nativeWindow);
104 UnregisterClass(kWindowClassName, GetModuleHandle(NULL));
105 }
106
107 EGLImageKHR GTFCreateEGLImage(int width, int height,
108 GLenum format, GLenum type) {
109 return (EGLImageKHR)NULL;
110 }
111
112 void GTFDestroyEGLImage(EGLImageKHR image) {
113 }
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/native/egl_native_linux.cc ('k') | gpu/gles2_conform_support/native/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698