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 SkWindow_DEFINED | 8 #ifndef SkWindow_DEFINED |
9 #define SkWindow_DEFINED | 9 #define SkWindow_DEFINED |
10 | 10 |
11 #include "SkView.h" | 11 #include "SkView.h" |
12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
14 #include "SkRegion.h" | 14 #include "SkRegion.h" |
15 #include "SkEvent.h" | 15 #include "SkEvent.h" |
16 #include "SkKey.h" | 16 #include "SkKey.h" |
| 17 #include "SkSurfaceProps.h" |
17 #include "SkTDArray.h" | 18 #include "SkTDArray.h" |
18 | 19 |
19 #ifdef SK_BUILD_FOR_WINCEx | 20 #ifdef SK_BUILD_FOR_WINCEx |
20 #define SHOW_FPS | 21 #define SHOW_FPS |
21 #endif | 22 #endif |
22 //#define USE_GX_SCREEN | 23 //#define USE_GX_SCREEN |
23 | 24 |
24 class SkSurface; | 25 class SkSurface; |
25 class SkOSMenu; | 26 class SkOSMenu; |
26 | 27 |
27 class SkWindow : public SkView { | 28 class SkWindow : public SkView { |
28 public: | 29 public: |
29 SkWindow(); | 30 SkWindow(); |
30 virtual ~SkWindow(); | 31 virtual ~SkWindow(); |
31 | 32 |
| 33 SkSurfaceProps getSurfaceProps() const { return fSurfaceProps; } |
| 34 void setSurfaceProps(const SkSurfaceProps& props) { |
| 35 fSurfaceProps = props; |
| 36 } |
| 37 |
32 const SkBitmap& getBitmap() const { return fBitmap; } | 38 const SkBitmap& getBitmap() const { return fBitmap; } |
33 | 39 |
34 void setColorType(SkColorType); | 40 void setColorType(SkColorType); |
35 void resize(int width, int height, SkColorType = kUnknown_SkColorType); | 41 void resize(int width, int height, SkColorType = kUnknown_SkColorType); |
36 | 42 |
37 bool isDirty() const { return !fDirtyRgn.isEmpty(); } | 43 bool isDirty() const { return !fDirtyRgn.isEmpty(); } |
38 bool update(SkIRect* updateArea); | 44 bool update(SkIRect* updateArea); |
39 // does not call through to onHandleInval(), but does force the fDirtyRgn | 45 // does not call through to onHandleInval(), but does force the fDirtyRgn |
40 // to be wide open. Call before update() to ensure we redraw everything. | 46 // to be wide open. Call before update() to ensure we redraw everything. |
41 void forceInvalAll(); | 47 void forceInvalAll(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 virtual void onAddMenu(const SkOSMenu*) {}; | 79 virtual void onAddMenu(const SkOSMenu*) {}; |
74 virtual void onUpdateMenu(const SkOSMenu*) {}; | 80 virtual void onUpdateMenu(const SkOSMenu*) {}; |
75 virtual void onSetTitle(const char title[]) {} | 81 virtual void onSetTitle(const char title[]) {} |
76 | 82 |
77 // overrides from SkView | 83 // overrides from SkView |
78 virtual bool handleInval(const SkRect*); | 84 virtual bool handleInval(const SkRect*); |
79 virtual bool onGetFocusView(SkView** focus) const; | 85 virtual bool onGetFocusView(SkView** focus) const; |
80 virtual bool onSetFocusView(SkView* focus); | 86 virtual bool onSetFocusView(SkView* focus); |
81 | 87 |
82 private: | 88 private: |
| 89 SkSurfaceProps fSurfaceProps; |
83 SkColorType fColorType; | 90 SkColorType fColorType; |
84 SkBitmap fBitmap; | 91 SkBitmap fBitmap; |
85 SkRegion fDirtyRgn; | 92 SkRegion fDirtyRgn; |
86 | 93 |
87 SkTDArray<Click*> fClicks; // to track clicks | 94 SkTDArray<Click*> fClicks; // to track clicks |
88 | 95 |
89 SkTDArray<SkOSMenu*> fMenus; | 96 SkTDArray<SkOSMenu*> fMenus; |
90 | 97 |
91 SkView* fFocusView; | 98 SkView* fFocusView; |
92 bool fWaitingOnInval; | 99 bool fWaitingOnInval; |
(...skipping 16 matching lines...) Expand all Loading... |
109 #include "SkOSWindow_Android.h" | 116 #include "SkOSWindow_Android.h" |
110 #elif defined(SK_BUILD_FOR_UNIX) | 117 #elif defined(SK_BUILD_FOR_UNIX) |
111 #include "SkOSWindow_Unix.h" | 118 #include "SkOSWindow_Unix.h" |
112 #elif defined(SK_BUILD_FOR_SDL) | 119 #elif defined(SK_BUILD_FOR_SDL) |
113 #include "SkOSWindow_SDL.h" | 120 #include "SkOSWindow_SDL.h" |
114 #elif defined(SK_BUILD_FOR_IOS) | 121 #elif defined(SK_BUILD_FOR_IOS) |
115 #include "SkOSWindow_iOS.h" | 122 #include "SkOSWindow_iOS.h" |
116 #endif | 123 #endif |
117 | 124 |
118 #endif | 125 #endif |
OLD | NEW |