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

Unified Diff: gpu/command_buffer/client/gles2_demo.cc

Issue 542119: Fixed gles2 demo by switching it from a console application to a windowed one... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 11 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 | « no previous file | gpu/gpu.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_demo.cc
===================================================================
--- gpu/command_buffer/client/gles2_demo.cc (revision 36538)
+++ gpu/command_buffer/client/gles2_demo.cc (working copy)
@@ -31,6 +31,10 @@
using gpu::gles2::GLES2CmdHelper;
using gpu::gles2::GLES2Implementation;
+#if defined(OS_WIN)
+HINSTANCE g_instance;
+#endif
+
class GLES2Demo {
public:
GLES2Demo();
@@ -104,11 +108,6 @@
return 0;
}
-HINSTANCE GetInstance(void) {
- HWND hwnd = GetConsoleWindow();
- return reinterpret_cast<HINSTANCE>(GetWindowLong(hwnd, GWL_HINSTANCE));
-}
-
void ProcessMessages(void* in_hwnd) {
HWND hwnd = reinterpret_cast<HWND>(in_hwnd);
MSG msg;
@@ -133,7 +132,6 @@
void* SetupWindow() {
#if defined(OS_WIN)
- HINSTANCE instance = GetInstance();
WNDCLASSEX wc = {0};
wc.lpszClassName = L"MY_WINDOWS_CLASS";
wc.cbSize = sizeof(WNDCLASSEX);
@@ -141,10 +139,10 @@
wc.lpfnWndProc = ::WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
- wc.hInstance = instance;
- wc.hIcon = ::LoadIcon(instance, IDI_APPLICATION);
+ wc.hInstance = g_instance;
+ wc.hIcon = ::LoadIcon(g_instance, IDI_APPLICATION);
wc.hIconSm = NULL;
- wc.hCursor = ::LoadCursor(instance, IDC_ARROW);
+ wc.hCursor = ::LoadCursor(g_instance, IDC_ARROW);
wc.hbrBackground = static_cast<HBRUSH>(::GetStockObject(BLACK_BRUSH));
wc.lpszMenuName = NULL;
@@ -165,7 +163,7 @@
512,
0,
0,
- instance,
+ g_instance,
0);
if (hwnd == NULL) {
@@ -181,7 +179,16 @@
#endif
}
-int main(int argc, const char** argv) {
+#if defined(OS_WIN)
+int WINAPI WinMain(HINSTANCE instance,
+ HINSTANCE prev_instance,
+ LPSTR command_line,
+ int command_show) {
+ g_instance = instance;
+#else
+int main(int argc, char** argv) {
+#endif
+
const int32 kCommandBufferSize = 1024 * 1024;
base::AtExitManager at_exit_manager;
« no previous file with comments | « no previous file | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698