OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #if defined(SK_BUILD_FOR_WIN) | 10 #if defined(SK_BUILD_FOR_WIN) |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "gl/GrGLInterface.h" | 25 #include "gl/GrGLInterface.h" |
26 #include "GLES2/gl2.h" | 26 #include "GLES2/gl2.h" |
27 | 27 |
28 #define ANGLE_GL_CALL(IFACE, X) \ | 28 #define ANGLE_GL_CALL(IFACE, X) \ |
29 do { \ | 29 do { \ |
30 (IFACE)->fFunctions.f##X; \ | 30 (IFACE)->fFunctions.f##X; \ |
31 } while (false) | 31 } while (false) |
32 | 32 |
33 #endif | 33 #endif |
34 | 34 |
35 #define INVALIDATE_DELAY_MS 200 | |
36 | |
37 static SkOSWindow* gCurrOSWin; | 35 static SkOSWindow* gCurrOSWin; |
38 static HWND gEventTarget; | 36 static HWND gEventTarget; |
39 | 37 |
40 #define WM_EVENT_CALLBACK (WM_USER+0) | 38 #define WM_EVENT_CALLBACK (WM_USER+0) |
41 | 39 |
42 void post_skwinevent() | 40 void post_skwinevent() |
43 { | 41 { |
44 PostMessage(gEventTarget, WM_EVENT_CALLBACK, 0, 0); | 42 PostMessage(gEventTarget, WM_EVENT_CALLBACK, 0, 0); |
45 } | 43 } |
46 | 44 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 break; | 135 break; |
138 } | 136 } |
139 case WM_PAINT: { | 137 case WM_PAINT: { |
140 PAINTSTRUCT ps; | 138 PAINTSTRUCT ps; |
141 HDC hdc = BeginPaint(hWnd, &ps); | 139 HDC hdc = BeginPaint(hWnd, &ps); |
142 this->doPaint(hdc); | 140 this->doPaint(hdc); |
143 EndPaint(hWnd, &ps); | 141 EndPaint(hWnd, &ps); |
144 return true; | 142 return true; |
145 } break; | 143 } break; |
146 | 144 |
147 case WM_TIMER: { | |
148 RECT* rect = (RECT*)wParam; | |
149 InvalidateRect(hWnd, rect, FALSE); | |
150 KillTimer(hWnd, (UINT_PTR)rect); | |
151 delete rect; | |
152 return true; | |
153 } break; | |
154 | |
155 case WM_LBUTTONDOWN: | 145 case WM_LBUTTONDOWN: |
156 this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), | 146 this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), |
157 Click::kDown_State, NULL, getModifiers(message)); | 147 Click::kDown_State, NULL, getModifiers(message)); |
158 return true; | 148 return true; |
159 | 149 |
160 case WM_MOUSEMOVE: | 150 case WM_MOUSEMOVE: |
161 this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), | 151 this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), |
162 Click::kMoved_State, NULL, getModifiers(message)); | 152 Click::kMoved_State, NULL, getModifiers(message)); |
163 return true; | 153 return true; |
164 | 154 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 #if 0 | 211 #if 0 |
222 void SkOSWindow::updateSize() | 212 void SkOSWindow::updateSize() |
223 { | 213 { |
224 RECT r; | 214 RECT r; |
225 GetWindowRect((HWND)this->getHWND(), &r); | 215 GetWindowRect((HWND)this->getHWND(), &r); |
226 this->resize(r.right - r.left, r.bottom - r.top); | 216 this->resize(r.right - r.left, r.bottom - r.top); |
227 } | 217 } |
228 #endif | 218 #endif |
229 | 219 |
230 void SkOSWindow::onHandleInval(const SkIRect& r) { | 220 void SkOSWindow::onHandleInval(const SkIRect& r) { |
231 RECT* rect = new RECT; | 221 RECT rect; |
232 rect->left = r.fLeft; | 222 rect.left = r.fLeft; |
233 rect->top = r.fTop; | 223 rect.top = r.fTop; |
234 rect->right = r.fRight; | 224 rect.right = r.fRight; |
235 rect->bottom = r.fBottom; | 225 rect.bottom = r.fBottom; |
236 SetTimer((HWND)fHWND, (UINT_PTR)rect, INVALIDATE_DELAY_MS, NULL); | 226 InvalidateRect((HWND)fHWND, &rect, FALSE); |
237 } | 227 } |
238 | 228 |
239 void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) | 229 void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) |
240 { | 230 { |
241 } | 231 } |
242 | 232 |
243 void SkOSWindow::onSetTitle(const char title[]){ | 233 void SkOSWindow::onSetTitle(const char title[]){ |
244 SetWindowTextA((HWND)fHWND, title); | 234 SetWindowTextA((HWND)fHWND, title); |
245 } | 235 } |
246 | 236 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 break; | 603 break; |
614 #endif // SK_ANGLE | 604 #endif // SK_ANGLE |
615 #endif // SK_SUPPORT_GPU | 605 #endif // SK_SUPPORT_GPU |
616 default: | 606 default: |
617 SkASSERT(false); | 607 SkASSERT(false); |
618 break; | 608 break; |
619 } | 609 } |
620 } | 610 } |
621 | 611 |
622 #endif | 612 #endif |
OLD | NEW |