Chromium Code Reviews| 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 |
| 11 #include "DisplayParams.h" | 11 #include "DisplayParams.h" |
| 12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 #include "SkTouchGesture.h" | |
| 14 | 15 |
| 15 class SkCanvas; | 16 class SkCanvas; |
| 16 | 17 |
| 17 namespace sk_app { | 18 namespace sk_app { |
| 18 | 19 |
| 19 class WindowContext; | 20 class WindowContext; |
| 20 | 21 |
| 21 class Window { | 22 class Window { |
| 22 public: | 23 public: |
| 23 static Window* CreateNativeWindow(void* platformData); | 24 static Window* CreateNativeWindow(void* platformData); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 } | 118 } |
| 118 | 119 |
| 119 void registerPaintFunc(OnPaintFunc func, void* userData) { | 120 void registerPaintFunc(OnPaintFunc func, void* userData) { |
| 120 fPaintFunc = func; | 121 fPaintFunc = func; |
| 121 fPaintUserData = userData; | 122 fPaintUserData = userData; |
| 122 } | 123 } |
| 123 | 124 |
| 124 bool onChar(SkUnichar c, uint32_t modifiers); | 125 bool onChar(SkUnichar c, uint32_t modifiers); |
| 125 bool onKey(Key key, InputState state, uint32_t modifiers); | 126 bool onKey(Key key, InputState state, uint32_t modifiers); |
| 126 bool onMouse(int x, int y, InputState state, uint32_t modifiers); | 127 bool onMouse(int x, int y, InputState state, uint32_t modifiers); |
| 128 bool onTouch(int owner, InputState state, float x, float y); // multi-owner = multi-touch | |
| 127 void onPaint(); | 129 void onPaint(); |
| 128 void onResize(uint32_t width, uint32_t height); | 130 void onResize(uint32_t width, uint32_t height); |
| 129 | 131 |
| 130 uint32_t width() { return fWidth; } | 132 uint32_t width() { return fWidth; } |
| 131 uint32_t height() { return fHeight; } | 133 uint32_t height() { return fHeight; } |
| 132 | 134 |
| 133 virtual const DisplayParams& getDisplayParams(); | 135 virtual const DisplayParams& getDisplayParams(); |
| 134 void setDisplayParams(const DisplayParams& params); | 136 void setDisplayParams(const DisplayParams& params); |
| 135 | 137 |
| 138 const SkMatrix& getGestureLocalM(); | |
|
djsollen
2016/05/16 18:16:00
why can't this function be const as well?
liyuqian
2016/05/16 18:32:37
Because SkTouchGesture's globalM has const while i
| |
| 139 const SkMatrix& getGestureGlobalM() const; | |
| 140 | |
| 136 protected: | 141 protected: |
| 137 Window(); | 142 Window(); |
| 138 | 143 |
| 139 uint32_t fWidth; | 144 uint32_t fWidth; |
| 140 uint32_t fHeight; | 145 uint32_t fHeight; |
| 141 | 146 |
| 142 OnCharFunc fCharFunc; | 147 OnCharFunc fCharFunc; |
| 143 void* fCharUserData; | 148 void* fCharUserData; |
| 144 OnKeyFunc fKeyFunc; | 149 OnKeyFunc fKeyFunc; |
| 145 void* fKeyUserData; | 150 void* fKeyUserData; |
| 146 OnMouseFunc fMouseFunc; | 151 OnMouseFunc fMouseFunc; |
| 147 void* fMouseUserData; | 152 void* fMouseUserData; |
| 148 OnPaintFunc fPaintFunc; | 153 OnPaintFunc fPaintFunc; |
| 149 void* fPaintUserData; | 154 void* fPaintUserData; |
| 150 | 155 |
| 151 WindowContext* fWindowContext; | 156 WindowContext* fWindowContext = nullptr; |
| 157 | |
| 158 SkTouchGesture fGesture; | |
| 152 }; | 159 }; |
| 153 | 160 |
| 154 } // namespace sk_app | 161 } // namespace sk_app |
| 155 #endif | 162 #endif |
| OLD | NEW |