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 #include "Window_android.h" | 8 #include "Window_android.h" |
9 | 9 |
10 #include "VulkanWindowContext_android.h" | 10 #include "VulkanWindowContext_android.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 mApp->onAppCmd = handle_cmd; | 30 mApp->onAppCmd = handle_cmd; |
31 mApp->onInputEvent = handle_input; | 31 mApp->onInputEvent = handle_input; |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 void Window_android::setTitle(const char* title) { | 35 void Window_android::setTitle(const char* title) { |
36 //todo | 36 //todo |
37 SkDebugf("Title: %s", title); | 37 SkDebugf("Title: %s", title); |
38 } | 38 } |
39 | 39 |
40 bool Window_android::attach(BackEndType attachType, int msaaSampleCount) { | 40 bool Window_android::attach(BackEndType attachType, const DisplayParams& params)
{ |
41 if (kVulkan_BackendType != attachType) { | 41 if (kVulkan_BackendType != attachType) { |
42 return false; | 42 return false; |
43 } | 43 } |
44 | 44 |
45 mSampleCount = msaaSampleCount; | 45 fDisplayParams = params; |
46 | 46 |
47 // We delay the creation of fTestContext until Android informs us that | 47 // We delay the creation of fTestContext until Android informs us that |
48 // the native window is ready to use. | 48 // the native window is ready to use. |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 void Window_android::initDisplay(ANativeWindow* window) { | 52 void Window_android::initDisplay(ANativeWindow* window) { |
53 SkASSERT(window); | 53 SkASSERT(window); |
54 ContextPlatformData_android platformData; | 54 ContextPlatformData_android platformData; |
55 platformData.fNativeWindow = window; | 55 platformData.fNativeWindow = window; |
56 fWindowContext = VulkanWindowContext::Create((void*)&platformData, mSampleCo
unt); | 56 fWindowContext = VulkanWindowContext::Create((void*)&platformData, mSampleCo
unt, fSRGB); |
57 } | 57 } |
58 | 58 |
59 static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) { | 59 static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) { |
60 if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) { | 60 if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) { |
61 SkDebugf("Failure writing android_app cmd: %s\n", strerror(errno)); | 61 SkDebugf("Failure writing android_app cmd: %s\n", strerror(errno)); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 void Window_android::inval() { | 65 void Window_android::inval() { |
66 android_app_write_cmd(mApp, APP_CMD_INVAL_WINDOW); | 66 android_app_write_cmd(mApp, APP_CMD_INVAL_WINDOW); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 Window::Key key = get_key(AKeyEvent_getKeyCode(event)); | 174 Window::Key key = get_key(AKeyEvent_getKeyCode(event)); |
175 Window::InputState state = get_action(AKeyEvent_getAction(event)); | 175 Window::InputState state = get_action(AKeyEvent_getAction(event)); |
176 int32_t mod = get_key_modifiers(event); | 176 int32_t mod = get_key_modifiers(event); |
177 window->onKey(key, state, mod); | 177 window->onKey(key, state, mod); |
178 return true; // eat all key events | 178 return true; // eat all key events |
179 } | 179 } |
180 return 0; | 180 return 0; |
181 } | 181 } |
182 | 182 |
183 } // namespace sk_app | 183 } // namespace sk_app |
OLD | NEW |