aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-06-16 07:04:43 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-16 07:04:43 -0700
commit1e7951ffdb28e2991930cc47b4c99b2c17c19196 (patch)
tree7cf78657787569f3b2cbf161f2d54c0e68874e82 /include
parent5cf19498f9455e4aa8685a9d7775fefe42deb22b (diff)
There are still things to sort out but this seems to run correctly.
Diffstat (limited to 'include')
-rw-r--r--include/views/SkOSWindow_Win.h47
1 files changed, 42 insertions, 5 deletions
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
index fe65459f4d..7a0cb7c0fd 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -11,6 +11,8 @@
#define SkOSWindow_Win_DEFINED
#include "SkWindow.h"
+#include "../../src/core/SkFunction.h"
+#include "../../src/core/SkTHash.h"
#if SK_ANGLE
#include "EGL/egl.h"
@@ -18,12 +20,13 @@
class SkOSWindow : public SkWindow {
public:
- SkOSWindow(void* hwnd);
- virtual ~SkOSWindow();
+ struct WindowInit {
+ TCHAR* fClass;
+ HINSTANCE fInstance;
+ };
- void* getHWND() const { return fHWND; }
- void setSize(int width, int height);
- void updateSize();
+ SkOSWindow(const void* winInit);
+ virtual ~SkOSWindow();
static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
@@ -49,6 +52,24 @@ public:
SK_WM_SkTimerID = 0xFFFF // just need a non-zero value
};
+ void setFullscreen(bool) override;
+ void setVsync(bool) override;
+ void closeWindow() override;
+
+ static SkOSWindow* GetOSWindowForHWND(void* hwnd) {
+ SkOSWindow** win = gHwndToOSWindowMap.find(hwnd);
+ if (!win) {
+ return NULL;
+ }
+ return *win;
+ }
+
+ // Iterates SkFunction over all the SkOSWindows and their corresponding HWNDs.
+ // The void* argument to the SkFunction is a HWND.
+ static void ForAllWindows(const SkFunction<void(void*, SkOSWindow**)>& f) {
+ gHwndToOSWindowMap.foreach(f);
+ }
+
protected:
virtual bool quitOnDeactivate() { return true; }
@@ -60,6 +81,9 @@ protected:
virtual void onSetTitle(const char title[]);
private:
+ static SkTHashMap<void*, SkOSWindow*> gHwndToOSWindowMap;
+
+ WindowInit fWinInit;
void* fHWND;
void doPaint(void* ctx);
@@ -74,10 +98,23 @@ private:
#endif // SK_ANGLE
#endif // SK_SUPPORT_GPU
+ bool fFullscreen;
+ struct SavedWindowState {
+ bool fZoomed;
+ LONG fStyle;
+ LONG fExStyle;
+ RECT fRect;
+ LONG fScreenWidth;
+ LONG fScreenHeight;
+ LONG fScreenBits;
+ void* fHWND;
+ } fSavedWindowState;
+
HMENU fMBar;
SkBackEndTypes fAttached;
+ void updateSize();
#if SK_SUPPORT_GPU
bool attachGL(int msaaSampleCount, AttachmentInfo* info);
void detachGL();