diff --git a/rainbow/WinGl/Ctrl.h b/rainbow/WinGl/Ctrl.h index 8076b9784..b34a1538c 100644 --- a/rainbow/WinGl/Ctrl.h +++ b/rainbow/WinGl/Ctrl.h @@ -30,4 +30,5 @@ public: static Ctrl *GetDesktop() { return desktop; } static void SetWindowSize(Size sz); + static void DrawScreen(); //$ }; diff --git a/rainbow/WinGl/Image.cpp b/rainbow/WinGl/Image.cpp index 176cfa38b..d58628271 100644 --- a/rainbow/WinGl/Image.cpp +++ b/rainbow/WinGl/Image.cpp @@ -96,29 +96,278 @@ ImageDraw::ImageDraw(int cx, int cy) { has_alpha = false; } +/* -#define IMAGECLASS FBImg -#define IMAGEFILE +void Image::SetCursorCheat(LPCSTR id) +{ + data->Sys().cursor_cheat = id; +} + +LPCSTR Image::GetCursorCheat() const +{ + return data ? data->Sys().cursor_cheat : NULL; +} + +Image::Data::SystemData& Image::Data::Sys() const +{ + ASSERT(sizeof(system_buffer) >= sizeof(SystemData)); + return *(SystemData *)system_buffer; +} + +class BitmapInfo32__ { + Buffer data; + +public: + operator BITMAPINFO *() { return (BITMAPINFO *)~data; } + operator BITMAPINFOHEADER *() { return (BITMAPINFOHEADER *)~data; } + BITMAPINFOHEADER *operator->() { return (BITMAPINFOHEADER *)~data; } + + BitmapInfo32__(int cx, int cy); +}; + +BitmapInfo32__::BitmapInfo32__(int cx, int cy) +{ + data.Alloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256); + BITMAPINFOHEADER *hi = (BITMAPINFOHEADER *) ~data;; + memset(hi, 0, sizeof(BITMAPINFOHEADER)); + hi->biSize = sizeof(BITMAPINFOHEADER); + hi->biPlanes = 1; +#ifdef PLATFORM_WINCE + hi->biBitCount = 32; + hi->biCompression = BI_BITFIELDS; + dword *x = (dword *)(~data + sizeof(BITMAPINFOHEADER)); + x[2] = 0xff; + x[1] = 0xff00; + x[0] = 0xff0000; +#else + hi->biBitCount = 32; + hi->biCompression = BI_RGB; +#endif + hi->biSizeImage = 0; + hi->biClrUsed = 0; + hi->biClrImportant = 0; + hi->biWidth = cx; + hi->biHeight = -cy; +} + +static Image sWin32Icon(HICON icon, bool cursor) +{ + GuiLock __; + ICONINFO iconinfo; + if(!icon || !GetIconInfo(icon, &iconinfo)) + return Image(); + BITMAP bm; + ::GetObject((HGDIOBJ)iconinfo.hbmMask, sizeof(BITMAP), (LPVOID)&bm); + HDC dcMem = ::CreateCompatibleDC(NULL); + Size sz(bm.bmWidth, bm.bmHeight); + BitmapInfo32__ bi(sz.cx, sz.cy); + int len = sz.cx * sz.cy; + Buffer mask(len); + ::SelectObject(dcMem, iconinfo.hbmColor); + ::GetDIBits(dcMem, iconinfo.hbmMask, 0, sz.cy, ~mask, bi, DIB_RGB_COLORS); + ImageBuffer b(sz.cx, iconinfo.hbmColor ? sz.cy : sz.cy / 2); + b.SetHotSpot(Point(iconinfo.xHotspot, iconinfo.yHotspot)); + if(iconinfo.hbmColor) { + ::SelectObject(dcMem, iconinfo.hbmColor); + ::GetDIBits(dcMem, iconinfo.hbmColor, 0, sz.cy, ~b, bi, DIB_RGB_COLORS); + RGBA *s = ~b; + RGBA *e = s + len; + RGBA *m = mask; + while(s < e) { + if(s->a != 255 && s->a != 0) { + Premultiply(b); + goto alpha; + } + s++; + } + s = ~b; + while(s < e) { + s->a = m->r ? 0 : 255; + s++; + m++; + } + } + else { + len /= 2; + RGBA *s = ~b; + RGBA *e = s + len; + RGBA *c = mask + len; + RGBA *m = mask; + while(s < e) { + s->a = (m->r & ~c->r) ? 0 : 255; + s->r = s->g = s->b = (c->r & ~m->r) ? 255 : 0; + s++; + m++; + c++; + } + } +alpha: + ::DeleteDC(dcMem); + ::DeleteObject(iconinfo.hbmColor); + ::DeleteObject(iconinfo.hbmMask); + Image img(b); + ::DestroyIcon(icon); + return img; +} + +Image Win32IconCursor(LPCSTR id, int iconsize, bool cursor) +{ + HICON icon; + if(cursor) + icon = (HICON)LoadCursor(0, id); + else + if(iconsize) + icon = (HICON)LoadImage(GetModuleHandle(NULL), id, + IMAGE_ICON, iconsize, iconsize, LR_DEFAULTCOLOR); + else + icon = LoadIcon(0, id); + Image img = sWin32Icon(icon, cursor); + if(cursor) + img.SetCursorCheat(id); + return img; +} + +Image Win32Icon(LPCSTR id, int iconsize) +{ + return Win32IconCursor(id, iconsize, false); +} + +Image Win32Icon(int id, int iconsize) +{ + return Win32Icon(MAKEINTRESOURCE(id), iconsize); +} + +Image Win32Cursor(LPCSTR id) +{ + return Win32IconCursor(id, 0, true); +} + +Image Win32Cursor(int id) +{ + return Win32Cursor(MAKEINTRESOURCE(id)); +} + +HBITMAP CreateBitMask(const RGBA *data, Size sz, Size tsz, Size csz, RGBA *ct) +{ + GuiLock __; + memset(ct, 0, tsz.cx * tsz.cy * sizeof(RGBA)); + int linelen = (tsz.cx + 15) >> 4 << 1; + Buffer mask(tsz.cy * linelen, 0xff); + byte *m = mask; + RGBA *ty = ct; + const RGBA *sy = data; + for(int y = 0; y < csz.cy; y++) { + const RGBA *s = sy; + RGBA *t = ty; + for(int x = 0; x < csz.cx; x++) { + if(s->a > 128) { + *t = *s; + m[x >> 3] &= ~(0x80 >> (x & 7)); + } + else + t->r = t->g = t->b = 0; + t->a = 0; + t++; + s++; + } + m += linelen; + sy += sz.cx; + ty += tsz.cx; + } + return ::CreateBitmap(tsz.cx, tsz.cy, 1, 1, mask); +} + +HICON IconWin32(const Image& img, bool cursor) +{ + GuiLock __; + if(img.IsEmpty()) + return NULL; + if(cursor) { + LPCSTR id = img.GetCursorCheat(); + if(id) + return (HICON)LoadCursor(0, id); + } + Size sz = img.GetSize(); + ICONINFO iconinfo; + iconinfo.fIcon = !cursor; + Point p = img.GetHotSpot(); + iconinfo.xHotspot = p.x; + iconinfo.yHotspot = p.y; + static Size cursor_size(GetSystemMetrics(SM_CXCURSOR), GetSystemMetrics(SM_CYCURSOR)); + Size tsz = sz; + if(!IsWin2K() && cursor) + tsz = cursor_size; + Size csz = Size(min(tsz.cx, sz.cx), min(tsz.cy, sz.cy)); + if(IsWinXP() && !ImageFallBack) { + RGBA *pixels; + BitmapInfo32__ bi(tsz.cx, tsz.cy); + HDC dcMem = ::CreateCompatibleDC(NULL); + iconinfo.hbmColor = ::CreateDIBSection(dcMem, bi, DIB_RGB_COLORS, (void **)&pixels, NULL, 0); + iconinfo.hbmMask = ::CreateBitmap(tsz.cx, tsz.cy, 1, 1, NULL); + memset(pixels, 0, tsz.cx * tsz.cy * sizeof(RGBA)); + for(int y = 0; y < csz.cy; y++) + memcpy(pixels + y * tsz.cx, img[y], csz.cx * sizeof(RGBA)); + ::DeleteDC(dcMem); + } + else { + Buffer h(tsz.cx * tsz.cy); + HDC dc = ::GetDC(NULL); + BitmapInfo32__ bi(tsz.cx, tsz.cy); + iconinfo.hbmMask = CreateBitMask(~img, sz, tsz, csz, h); + iconinfo.hbmColor = ::CreateDIBitmap(dc, bi, CBM_INIT, h, bi, DIB_RGB_COLORS); + ::ReleaseDC(NULL, dc); + } + + HICON icon = ::CreateIconIndirect(&iconinfo); + ::DeleteObject(iconinfo.hbmColor); + ::DeleteObject(iconinfo.hbmMask); + return icon; +} + +#define WCURSOR_(x)\ +{ Image m; INTERLOCKED { static Image img = Win32Cursor(x); m = img; } return m; } + +Image Image::Arrow() WCURSOR_(IDC_ARROW) +Image Image::Wait() WCURSOR_(IDC_WAIT) +Image Image::IBeam() WCURSOR_(IDC_IBEAM) +Image Image::No() WCURSOR_(IDC_NO) +Image Image::SizeAll() WCURSOR_(IDC_SIZEALL) +Image Image::SizeHorz() WCURSOR_(IDC_SIZEWE) +Image Image::SizeVert() WCURSOR_(IDC_SIZENS) +Image Image::SizeTopLeft() WCURSOR_(IDC_SIZENWSE) +Image Image::SizeTop() WCURSOR_(IDC_SIZENS) +Image Image::SizeTopRight() WCURSOR_(IDC_SIZENESW) +Image Image::SizeLeft() WCURSOR_(IDC_SIZEWE) +Image Image::SizeRight() WCURSOR_(IDC_SIZEWE) +Image Image::SizeBottomLeft() WCURSOR_(IDC_SIZENESW) +Image Image::SizeBottom() WCURSOR_(IDC_SIZENS) +Image Image::SizeBottomRight() WCURSOR_(IDC_SIZENWSE) +Image Image::Cross() WCURSOR_(IDC_CROSS) +Image Image::Hand() WCURSOR_(IDC_HAND)*/ + + +#define IMAGECLASS WinGlImg +#define IMAGEFILE #include -#define IMAGECLASS FBImg -#define IMAGEFILE +#define IMAGECLASS WinGlImg +#define IMAGEFILE #include -Image Image::Arrow() { return FBImg::arrow(); } -Image Image::Wait() { return FBImg::wait(); } -Image Image::IBeam() { return FBImg::ibeam(); } -Image Image::No() { return FBImg::no(); } -Image Image::SizeAll() { return FBImg::sizeall(); } -Image Image::SizeHorz() { return FBImg::sizehorz(); } -Image Image::SizeVert() { return FBImg::sizevert(); } -Image Image::SizeTopLeft() { return FBImg::sizetopleft(); } -Image Image::SizeTop() { return FBImg::sizetop(); } -Image Image::SizeTopRight() { return FBImg::sizetopright(); } -Image Image::SizeLeft() { return FBImg::sizeleft(); } -Image Image::SizeRight() { return FBImg::sizeright(); } -Image Image::SizeBottomLeft() { return FBImg::sizebottomleft(); } -Image Image::SizeBottom() { return FBImg::sizebottom(); } -Image Image::SizeBottomRight() { return FBImg::sizebottomright(); } +Image Image::Arrow() { return WinGlImg::arrow(); } +Image Image::Wait() { return WinGlImg::wait(); } +Image Image::IBeam() { return WinGlImg::ibeam(); } +Image Image::No() { return WinGlImg::no(); } +Image Image::SizeAll() { return WinGlImg::sizeall(); } +Image Image::SizeHorz() { return WinGlImg::sizehorz(); } +Image Image::SizeVert() { return WinGlImg::sizevert(); } +Image Image::SizeTopLeft() { return WinGlImg::sizetopleft(); } +Image Image::SizeTop() { return WinGlImg::sizetop(); } +Image Image::SizeTopRight() { return WinGlImg::sizetopright(); } +Image Image::SizeLeft() { return WinGlImg::sizeleft(); } +Image Image::SizeRight() { return WinGlImg::sizeright(); } +Image Image::SizeBottomLeft() { return WinGlImg::sizebottomleft(); } +Image Image::SizeBottom() { return WinGlImg::sizebottom(); } +Image Image::SizeBottomRight() { return WinGlImg::sizebottomright(); } END_UPP_NAMESPACE diff --git a/rainbow/WinGl/Proc.cpp b/rainbow/WinGl/Proc.cpp index d5e9ea77a..4864ad90b 100644 --- a/rainbow/WinGl/Proc.cpp +++ b/rainbow/WinGl/Proc.cpp @@ -54,14 +54,6 @@ LRESULT CALLBACK glWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa #endif // LLOG("Ctrl::WindowProc(" << message << ") in " << ::Name(this) << ", focus " << (void *)::GetFocus()); switch(message) { - case WM_PAINT: - ASSERT(hwnd); - if(hwnd) { - PAINTSTRUCT ps; - HDC dc = BeginPaint(hwnd, &ps); - EndPaint(hwnd, &ps); - } - return 0L; case WM_LBUTTONDOWN: Ctrl::DoMouseGl(Ctrl::LEFTDOWN, Point((dword)lParam)); return 0L; @@ -99,12 +91,12 @@ LRESULT CALLBACK glWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa Ctrl::DoMouseGl(Ctrl::MOUSEWHEEL, Point((dword)lParam) - p, (short)HIWORD(wParam)); } return 0L; - case WM_SETCURSOR: - if(LOWORD((dword)lParam) == HTCLIENT) { + /*case WM_SETCURSOR: + if(LOWORD((dword)lParam) == HTCLIENT) { SetCursor(NULL); return TRUE; } - break; + break;*/ // case WM_MENUCHAR: // return MAKELONG(0, MNC_SELECT); case WM_KEYDOWN: @@ -159,6 +151,7 @@ LRESULT CALLBACK glWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_ERASEBKGND: return 1L; case WM_SIZE: + //ActivateGlContext(); Ctrl::SetWindowSize(Size(LOWORD(lParam), HIWORD(lParam))); return 0L; case WM_MOVE: diff --git a/rainbow/WinGl/Win.cpp b/rainbow/WinGl/Win.cpp index 01c06c2ab..9c962ee24 100644 --- a/rainbow/WinGl/Win.cpp +++ b/rainbow/WinGl/Win.cpp @@ -6,7 +6,8 @@ extern void GuiMainFn_(); NAMESPACE_UPP -HWND glHWND; +HWND hWnd; +HWND glHwnd; HDC hDC; HGLRC hRC; @@ -41,24 +42,23 @@ void GlSleep(int ms) MsgWaitForMultipleObjects(0, NULL, FALSE, ms, QS_ALLINPUT); } -void ActivateGLContext() +void ActivateGlContext() { - if (hRC != NULL && wglGetCurrentContext() != hRC) + if(hRC != NULL && wglGetCurrentContext() != hRC) wglMakeCurrent(hDC, hRC); } -void DestroyGL() +void DestroyGl(bool destroyWindow) { - if (hDC != NULL && hRC != NULL) - { - ActivateGLContext(); - wglMakeCurrent(NULL, NULL); - } + wglMakeCurrent(NULL, NULL); if(hRC) wglDeleteContext(hRC); if(hDC) - ReleaseDC(glHWND, hDC); + ::ReleaseDC(glHwnd, hDC); + + if(destroyWindow) + ::DestroyWindow(glHwnd); } int GlInit(HINSTANCE hInstance) @@ -74,25 +74,26 @@ int GlInit(HINSTANCE hInstance) wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)NULL; - wc.lpszClassName = L"UPP-FB-CLASS"; + wc.lpszClassName = L"UPP-GL-CLASS"; RegisterClassW(&wc); - glHWND = CreateWindowW( - L"UPP-FB-CLASS", L"", - WS_OVERLAPPED | WS_VISIBLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU, + + glHwnd = CreateWindowW( + L"UPP-GL-CLASS", L"", + WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); - if(!glHWND) + if(!glHwnd) return -1; - hDC = ::GetDC(glHWND); + hDC = ::GetDC(glHwnd); if(!hDC) return -2; PIXELFORMATDESCRIPTOR pfd; memset(&pfd, 0, sizeof(pfd)); pfd.nSize = sizeof(pfd); pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_SUPPORT_COMPOSITION; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_SUPPORT_COMPOSITION | PFD_GENERIC_ACCELERATED; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 24; @@ -101,12 +102,12 @@ int GlInit(HINSTANCE hInstance) int pf = ChoosePixelFormat(hDC, &pfd); if(!pf) { RLOG("OpenGL: ChoosePixelFormat error"); - DestroyGL(); + DestroyGl(); return -3; } if(!SetPixelFormat(hDC, pf, &pfd)) { RLOG("OpenGL: SetPixelFormat error"); - DestroyGL(); + DestroyGl(); return -4; } DescribePixelFormat(hDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd); @@ -114,13 +115,13 @@ int GlInit(HINSTANCE hInstance) if(!hRC) { RLOG("OpenGL: wglCreateContext error"); - DestroyGL(); + DestroyGl(); return -5; } if(!wglMakeCurrent(hDC, hRC)) { RLOG("OpenGL: wglMakeCurrent error"); - DestroyGL(); + DestroyGl(); return -6; } //ActivateGLContext(); @@ -128,7 +129,7 @@ int GlInit(HINSTANCE hInstance) if(err != GLEW_OK) { RLOG("OpenGL: Glew library initialization error: " + String((const char*) glewGetErrorString(err))); - DestroyGL(); + DestroyGl(); return -7; } @@ -136,7 +137,7 @@ int GlInit(HINSTANCE hInstance) wglSwapIntervalEXT(0); //SetTimeCallback(-10, THISBACK(Repaint), 1); - SetTimer(glHWND, 1, 10, NULL); + SetTimer(glHwnd, 1, 10, NULL); return 1; } @@ -154,7 +155,7 @@ int AppMain(HINSTANCE hInstance, LPSTR lpCmdLine) UPP::Ctrl::CloseTopCtrls(); UPP::UsrLog("---------- About to delete this log of WinGL..."); UPP::DeleteUsrLog(); - UPP::DestroyGL(); + UPP::DestroyGl(false); return UPP::GetExitCode(); } else { ::MessageBox(NULL, Format("OpenGL window could not be initialized: %d", r), NULL, MB_ICONEXCLAMATION | MB_OK); diff --git a/rainbow/WinGl/WinGl.h b/rainbow/WinGl/WinGl.h index 4d6d05f84..e4da28257 100644 --- a/rainbow/WinGl/WinGl.h +++ b/rainbow/WinGl/WinGl.h @@ -14,13 +14,14 @@ NAMESPACE_UPP -extern bool glEndSession; -extern HWND glHWND; -extern HDC hDC; -extern HGLRC hRC; +extern bool glEndSession; +extern HWND hWnd; +extern HWND glHwnd; +extern HDC hDC; +extern HGLRC hRC; -void ActivateGLContext(); -void DestroyGL(); +void ActivateGlContext(); +void DestroyGl(bool destroyWindow = true); LRESULT CALLBACK glWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); #define GUI_FB diff --git a/rainbow/WinGl/WinGl.iml b/rainbow/WinGl/WinGl.iml new file mode 100644 index 000000000..4e0424bd8 --- /dev/null +++ b/rainbow/WinGl/WinGl.iml @@ -0,0 +1,40 @@ +PREMULTIPLIED +IMAGE_ID(arrow) +IMAGE_ID(ibeam) +IMAGE_ID(wait) +IMAGE_ID(no) +IMAGE_ID(sizeall) +IMAGE_ID(sizehorz) +IMAGE_ID(sizeright) +IMAGE_ID(sizeleft) +IMAGE_ID(sizevert) +IMAGE_ID(sizetopleft) +IMAGE_ID(sizetop) +IMAGE_ID(sizetopright) +IMAGE_ID(sizebottomleft) +IMAGE_ID(sizebottom) +IMAGE_ID(sizebottomright) + +IMAGE_BEGIN_DATA +IMAGE_DATA(120,156,237,87,189,75,28,65,20,31,3,167,1,5,9,146,46,69,26,255,9,155,180,41,83,216,165,180,176,178,75,10) +IMAGE_DATA(73,76,44,36,4,66,56,3,26,36,104,188,228,34,104,66,82,108,35,162,226,89,248,129,224,7,126,128,136,34,136,32) +IMAGE_DATA(34,130,86,218,253,50,220,158,27,179,59,243,246,189,89,93,21,246,55,12,236,205,253,126,111,222,199,188,185,91,85,167) +IMAGE_DATA(30,170,6,61,170,85,149,210,128,146,1,66,13,0,145,6,231,231,143,113,118,214,200,213,224,244,180,9,39,39,79,112) +IMAGE_DATA(124,252,148,163,193,209,209,51,28,30,54,227,224,224,57,246,246,90,226,52,216,223,111,209,188,86,236,238,182,97,103,231) +IMAGE_DATA(5,54,55,95,81,26,108,111,191,196,214,86,187,230,189,197,250,250,59,172,174,126,196,242,114,183,77,131,141,141,46,172) +IMAGE_DATA(173,189,199,202,74,30,75,75,125,88,88,40,98,126,254,7,230,230,6,77,26,205,233,198,226,98,143,230,245,99,118,118) +IMAGE_DATA(4,165,82,169,50,127,99,106,170,24,214,104,91,125,154,215,143,153,153,34,166,167,255,4,124,245,175,150,151,53,154,51) +IMAGE_DATA(160,103,1,147,147,67,152,152,248,133,177,49,143,140,119,124,124,16,163,163,223,2,59,158,55,66,242,61,239,107,196,199) +IMAGE_DATA(225,225,239,214,252,152,114,80,40,124,161,248,198,125,123,123,63,137,206,97,62,255,65,124,214,59,59,223,136,246,232,232) +IMAGE_DATA(120,45,222,67,192,141,34,167,234,213,61,85,83,158,42,84,120,85,110,86,31,161,231,96,243,208,231,59,191,102,137,55) +IMAGE_DATA(146,23,85,167,19,151,211,73,203,253,159,56,238,44,107,30,253,252,76,206,75,220,52,248,164,198,192,181,106,8,110,68) +IMAGE_DATA(195,224,6,26,9,215,197,23,151,88,93,114,121,3,245,149,157,207,7,122,220,175,12,42,113,134,201,5,183,73,56,250) +IMAGE_DATA(36,223,75,252,76,170,143,20,144,97,195,124,251,184,235,109,126,73,245,92,27,146,239,227,246,224,248,72,197,73,33,46) +IMAGE_DATA(199,18,189,201,39,201,89,49,173,185,234,185,118,92,250,206,165,111,227,108,153,81,175,71,77,101,48,140,186,192,37,128) +IMAGE_DATA(176,206,69,127,97,195,21,92,173,173,185,226,214,168,198,52,173,153,26,71,58,147,236,27,199,227,172,153,144,70,141,194) +IMAGE_DATA(154,36,231,42,201,121,188,208,219,225,255,249,245,223,28,216,34,59,79,226,104,26,135,44,110,95,91,28,148,214,71,150) +IMAGE_DATA(56,99,28,148,214,71,150,56,99,28,148,214,71,232,21,223,102,200,230,168,233,30,73,114,183,166,189,22,87,8,123,130) +IMAGE_DATA(107,245,200,85,134,197,136,13,146,203,87,202,53,61,115,112,155,249,215,145,39,105,157,144,117,202,21,117,10,5,73,23) +IMAGE_DATA(81,155,39,225,114,79,158,235,111,139,11,79,210,13,105,228,143,230,103,5,79,204,187,91,5,207,174,198,171,185,26,37) +IMAGE_DATA(221,112,157,85,55,61,115,112,155,249,55,121,187,4,243,47,233,127,209,222,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(672, 15) diff --git a/rainbow/WinGl/WinGl.upp b/rainbow/WinGl/WinGl.upp index 71f9a33b7..06a29dd6e 100644 --- a/rainbow/WinGl/WinGl.upp +++ b/rainbow/WinGl/WinGl.upp @@ -27,5 +27,6 @@ file wglew.h, glew.c, Resources readonly separator, + WinGl.iml, Fonts.brc; diff --git a/rainbow/WinGl/Wnd.cpp b/rainbow/WinGl/Wnd.cpp index 7c04524bd..fc91f225a 100644 --- a/rainbow/WinGl/Wnd.cpp +++ b/rainbow/WinGl/Wnd.cpp @@ -134,19 +134,14 @@ bool Ctrl::ProcessEvent(bool *quit) return false; } -bool Ctrl::ProcessEvents(bool *quit) +void Ctrl::DrawScreen() { - if(!ProcessEvent(quit)) - return false; - while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop()) && !GlEndSession()); // LoopCtrl-MF 071008 - TimerProc(GetTickCount()); - SweepMkImageCache(); if(desktop && !painting) { painting = true; RemoveCursor(); RemoveCaret(); - ActivateGLContext(); + ActivateGlContext(); //SyncLayout(1); //InitInfoPanel(); Rect rect; @@ -165,6 +160,16 @@ bool Ctrl::ProcessEvents(bool *quit) painting = false; LOGF("Fps %.2f\n", GetFps()); } +} + +bool Ctrl::ProcessEvents(bool *quit) +{ + if(!ProcessEvent(quit)) + return false; + while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop()) && !GlEndSession()); // LoopCtrl-MF 071008 + TimerProc(GetTickCount()); + SweepMkImageCache(); + DrawScreen(); CursorSync(); return false; } @@ -358,7 +363,7 @@ bool Ctrl::HasWndCapture() const void Ctrl::WndInvalidateRect0(const Rect& r) { GuiLock __; - ::InvalidateRect(glHWND, NULL, false); + ::InvalidateRect(glHwnd, NULL, false); } void Ctrl::WndSetPos0(const Rect& rect)