OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
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 Window_DEFINED | 8 #ifndef Window_DEFINED |
9 #define Window_DEFINED | 9 #define Window_DEFINED |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 bool onChar(SkUnichar c, uint32_t modifiers); | 153 bool onChar(SkUnichar c, uint32_t modifiers); |
154 bool onKey(Key key, InputState state, uint32_t modifiers); | 154 bool onKey(Key key, InputState state, uint32_t modifiers); |
155 bool onMouse(int x, int y, InputState state, uint32_t modifiers); | 155 bool onMouse(int x, int y, InputState state, uint32_t modifiers); |
156 bool onTouch(intptr_t owner, InputState state, float x, float y); // multi-
owner = multi-touch | 156 bool onTouch(intptr_t owner, InputState state, float x, float y); // multi-
owner = multi-touch |
157 void onUIStateChanged(const SkString& stateName, const SkString& stateValue)
; | 157 void onUIStateChanged(const SkString& stateName, const SkString& stateValue)
; |
158 void onPaint(); | 158 void onPaint(); |
159 void onResize(uint32_t width, uint32_t height); | 159 void onResize(uint32_t width, uint32_t height); |
160 | 160 |
161 uint32_t width() { return fWidth; } | 161 int width() { return fWidth; } |
162 uint32_t height() { return fHeight; } | 162 int height() { return fHeight; } |
163 | 163 |
164 virtual const DisplayParams& getDisplayParams(); | 164 virtual const DisplayParams& getDisplayParams(); |
165 void setDisplayParams(const DisplayParams& params); | 165 void setDisplayParams(const DisplayParams& params); |
166 | 166 |
167 // This is just for the sRGB split screen | 167 // This is just for the sRGB split screen |
168 sk_sp<SkSurface> getOffscreenSurface(bool forceSRGB); | 168 sk_sp<SkSurface> getOffscreenSurface(bool forceSRGB); |
169 | 169 |
170 protected: | 170 protected: |
171 Window(); | 171 Window(); |
172 | 172 |
173 uint32_t fWidth; | 173 int fWidth; |
174 uint32_t fHeight; | 174 int fHeight; |
175 | 175 |
176 OnCharFunc fCharFunc; | 176 OnCharFunc fCharFunc; |
177 void* fCharUserData; | 177 void* fCharUserData; |
178 OnKeyFunc fKeyFunc; | 178 OnKeyFunc fKeyFunc; |
179 void* fKeyUserData; | 179 void* fKeyUserData; |
180 OnMouseFunc fMouseFunc; | 180 OnMouseFunc fMouseFunc; |
181 void* fMouseUserData; | 181 void* fMouseUserData; |
182 OnTouchFunc fTouchFunc; | 182 OnTouchFunc fTouchFunc; |
183 void* fTouchUserData; | 183 void* fTouchUserData; |
184 OnUIStateChangedFunc | 184 OnUIStateChangedFunc |
185 fUIStateChangedFunc; | 185 fUIStateChangedFunc; |
186 void* fUIStateChangedUserData; | 186 void* fUIStateChangedUserData; |
187 OnPaintFunc fPaintFunc; | 187 OnPaintFunc fPaintFunc; |
188 void* fPaintUserData; | 188 void* fPaintUserData; |
189 | 189 |
190 WindowContext* fWindowContext = nullptr; | 190 WindowContext* fWindowContext = nullptr; |
191 | 191 |
192 virtual void onInval() = 0; | 192 virtual void onInval() = 0; |
193 | 193 |
194 // Uncheck fIsContentInvalided to allow future inval/onInval. | 194 // Uncheck fIsContentInvalided to allow future inval/onInval. |
195 void markInvalProcessed(); | 195 void markInvalProcessed(); |
196 | 196 |
197 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events | 197 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events |
198 }; | 198 }; |
199 | 199 |
200 } // namespace sk_app | 200 } // namespace sk_app |
201 #endif | 201 #endif |
OLD | NEW |