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

Side by Side Diff: include/views/SkOSWindow_Win.h

Issue 1187643002: VisualBench on windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 6 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
« no previous file with comments | « no previous file | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 8
9 9
10 #ifndef SkOSWindow_Win_DEFINED 10 #ifndef SkOSWindow_Win_DEFINED
11 #define SkOSWindow_Win_DEFINED 11 #define SkOSWindow_Win_DEFINED
12 12
13 #include "SkWindow.h" 13 #include "SkWindow.h"
14 #include "../../src/core/SkFunction.h"
15 #include "../../src/core/SkTHash.h"
14 16
15 #if SK_ANGLE 17 #if SK_ANGLE
16 #include "EGL/egl.h" 18 #include "EGL/egl.h"
17 #endif 19 #endif
18 20
19 class SkOSWindow : public SkWindow { 21 class SkOSWindow : public SkWindow {
20 public: 22 public:
21 SkOSWindow(void* hwnd); 23 struct WindowInit {
24 TCHAR* fClass;
25 HINSTANCE fInstance;
26 };
27
28 SkOSWindow(const void* winInit);
22 virtual ~SkOSWindow(); 29 virtual ~SkOSWindow();
23 30
24 void* getHWND() const { return fHWND; }
25 void setSize(int width, int height);
26 void updateSize();
27
28 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); 31 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
29 32
30 enum SkBackEndTypes { 33 enum SkBackEndTypes {
31 kNone_BackEndType, 34 kNone_BackEndType,
32 #if SK_SUPPORT_GPU 35 #if SK_SUPPORT_GPU
33 kNativeGL_BackEndType, 36 kNativeGL_BackEndType,
34 #if SK_ANGLE 37 #if SK_ANGLE
35 kANGLE_BackEndType, 38 kANGLE_BackEndType,
36 #endif // SK_ANGLE 39 #endif // SK_ANGLE
37 #endif // SK_SUPPORT_GPU 40 #endif // SK_SUPPORT_GPU
38 }; 41 };
39 42
40 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*) ; 43 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*) ;
41 void detach(); 44 void detach();
42 void present(); 45 void present();
43 46
44 bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 47 bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
45 static bool QuitOnDeactivate(HWND hWnd); 48 static bool QuitOnDeactivate(HWND hWnd);
46 49
47 enum { 50 enum {
48 SK_WM_SkEvent = WM_APP + 1000, 51 SK_WM_SkEvent = WM_APP + 1000,
49 SK_WM_SkTimerID = 0xFFFF // just need a non-zero value 52 SK_WM_SkTimerID = 0xFFFF // just need a non-zero value
50 }; 53 };
51 54
55 void setFullscreen(bool) override;
56 void setVsync(bool) override;
57 void closeWindow() override;
58
59 static SkOSWindow* GetOSWindowForHWND(void* hwnd) {
60 SkOSWindow** win = gHwndToOSWindowMap.find(hwnd);
61 if (!win) {
62 return NULL;
63 }
64 return *win;
65 }
66
67 // Iterates SkFunction over all the SkOSWindows and their corresponding HWND s.
68 // The void* argument to the SkFunction is a HWND.
69 static void ForAllWindows(const SkFunction<void(void*, SkOSWindow**)>& f) {
70 gHwndToOSWindowMap.foreach(f);
71 }
72
52 protected: 73 protected:
53 virtual bool quitOnDeactivate() { return true; } 74 virtual bool quitOnDeactivate() { return true; }
54 75
55 // overrides from SkWindow 76 // overrides from SkWindow
56 virtual void onHandleInval(const SkIRect&); 77 virtual void onHandleInval(const SkIRect&);
57 // overrides from SkView 78 // overrides from SkView
58 virtual void onAddMenu(const SkOSMenu*); 79 virtual void onAddMenu(const SkOSMenu*);
59 80
60 virtual void onSetTitle(const char title[]); 81 virtual void onSetTitle(const char title[]);
61 82
62 private: 83 private:
84 static SkTHashMap<void*, SkOSWindow*> gHwndToOSWindowMap;
85
86 WindowInit fWinInit;
63 void* fHWND; 87 void* fHWND;
64 88
65 void doPaint(void* ctx); 89 void doPaint(void* ctx);
66 90
67 #if SK_SUPPORT_GPU 91 #if SK_SUPPORT_GPU
68 void* fHGLRC; 92 void* fHGLRC;
69 #if SK_ANGLE 93 #if SK_ANGLE
70 EGLDisplay fDisplay; 94 EGLDisplay fDisplay;
71 EGLContext fContext; 95 EGLContext fContext;
72 EGLSurface fSurface; 96 EGLSurface fSurface;
73 EGLConfig fConfig; 97 EGLConfig fConfig;
74 #endif // SK_ANGLE 98 #endif // SK_ANGLE
75 #endif // SK_SUPPORT_GPU 99 #endif // SK_SUPPORT_GPU
76 100
101 bool fFullscreen;
102 struct SavedWindowState {
103 bool fZoomed;
104 LONG fStyle;
105 LONG fExStyle;
106 RECT fRect;
107 LONG fScreenWidth;
108 LONG fScreenHeight;
109 LONG fScreenBits;
110 void* fHWND;
111 } fSavedWindowState;
112
77 HMENU fMBar; 113 HMENU fMBar;
78 114
79 SkBackEndTypes fAttached; 115 SkBackEndTypes fAttached;
80 116
117 void updateSize();
81 #if SK_SUPPORT_GPU 118 #if SK_SUPPORT_GPU
82 bool attachGL(int msaaSampleCount, AttachmentInfo* info); 119 bool attachGL(int msaaSampleCount, AttachmentInfo* info);
83 void detachGL(); 120 void detachGL();
84 void presentGL(); 121 void presentGL();
85 122
86 #if SK_ANGLE 123 #if SK_ANGLE
87 bool attachANGLE(int msaaSampleCount, AttachmentInfo* info); 124 bool attachANGLE(int msaaSampleCount, AttachmentInfo* info);
88 void detachANGLE(); 125 void detachANGLE();
89 void presentANGLE(); 126 void presentANGLE();
90 #endif // SK_ANGLE 127 #endif // SK_ANGLE
91 #endif // SK_SUPPORT_GPU 128 #endif // SK_SUPPORT_GPU
92 129
93 typedef SkWindow INHERITED; 130 typedef SkWindow INHERITED;
94 }; 131 };
95 132
96 #endif 133 #endif
OLDNEW
« no previous file with comments | « no previous file | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698