OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkOSWindow_Unix_DEFINED | 8 #ifndef SkOSWindow_Unix_DEFINED |
9 #define SkOSWindow_Unix_DEFINED | 9 #define SkOSWindow_Unix_DEFINED |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class SkOSWindow : public SkWindow { | 26 class SkOSWindow : public SkWindow { |
27 public: | 27 public: |
28 SkOSWindow(void*); | 28 SkOSWindow(void*); |
29 ~SkOSWindow(); | 29 ~SkOSWindow(); |
30 | 30 |
31 void* getHWND() const { return (void*)fUnixWindow.fWin; } | 31 void* getHWND() const { return (void*)fUnixWindow.fWin; } |
32 void* getDisplay() const { return (void*)fUnixWindow.fDisplay; } | 32 void* getDisplay() const { return (void*)fUnixWindow.fDisplay; } |
33 void* getUnixWindow() const { return (void*)&fUnixWindow; } | 33 void* getUnixWindow() const { return (void*)&fUnixWindow; } |
34 void loop(); | 34 void loop(); |
35 void post_linuxevent(); | |
36 | 35 |
37 enum SkBackEndTypes { | 36 enum SkBackEndTypes { |
38 kNone_BackEndType, | 37 kNone_BackEndType, |
39 kNativeGL_BackEndType, | 38 kNativeGL_BackEndType, |
40 }; | 39 }; |
41 | 40 |
42 struct AttachmentInfo { | 41 struct AttachmentInfo { |
43 int fSampleCount; | 42 int fSampleCount; |
44 int fStencilBits; | 43 int fStencilBits; |
45 }; | 44 }; |
46 | 45 |
47 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*)
; | 46 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*)
; |
48 void detach(); | 47 void detach(); |
49 void present(); | 48 void present(); |
50 | 49 |
51 int getMSAASampleCount() const { return fMSAASampleCount; } | 50 int getMSAASampleCount() const { return fMSAASampleCount; } |
52 | 51 |
53 //static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); | 52 //static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); |
54 | 53 |
55 protected: | 54 protected: |
56 // Overridden from from SkWindow: | 55 // Overridden from from SkWindow: |
57 virtual bool onEvent(const SkEvent&) SK_OVERRIDE; | |
58 virtual void onHandleInval(const SkIRect&) SK_OVERRIDE; | |
59 virtual bool onHandleChar(SkUnichar) SK_OVERRIDE; | |
60 virtual bool onHandleKey(SkKey) SK_OVERRIDE; | |
61 virtual bool onHandleKeyUp(SkKey) SK_OVERRIDE; | |
62 virtual void onSetTitle(const char title[]) SK_OVERRIDE; | 56 virtual void onSetTitle(const char title[]) SK_OVERRIDE; |
63 | 57 |
64 private: | 58 private: |
| 59 enum NextXEventResult { |
| 60 kContinue_NextXEventResult, |
| 61 kQuitRequest_NextXEventResult, |
| 62 kPaintRequest_NextXEventResult |
| 63 }; |
| 64 |
| 65 NextXEventResult nextXEvent(); |
65 void doPaint(); | 66 void doPaint(); |
66 void mapWindowAndWait(); | 67 void mapWindowAndWait(); |
67 | 68 |
68 void closeWindow(); | 69 void closeWindow(); |
69 void initWindow(int newMSAASampleCount, AttachmentInfo* info); | 70 void initWindow(int newMSAASampleCount, AttachmentInfo* info); |
70 | 71 |
71 SkUnixWindow fUnixWindow; | 72 SkUnixWindow fUnixWindow; |
72 | 73 |
73 // Needed for GL | 74 // Needed for GL |
74 XVisualInfo* fVi; | 75 XVisualInfo* fVi; |
75 // we recreate the underlying xwindow if this changes | 76 // we recreate the underlying xwindow if this changes |
76 int fMSAASampleCount; | 77 int fMSAASampleCount; |
77 | 78 |
78 typedef SkWindow INHERITED; | 79 typedef SkWindow INHERITED; |
79 }; | 80 }; |
80 | 81 |
81 #endif | 82 #endif |
OLD | NEW |