Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tools/viewer/sk_app/android/Window_android.cpp

Issue 1944413005: More refactoring for Viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix up Android Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "VulkanTestContext_android.h" 10 #include "VulkanWindowContext_android.h"
11 11
12 namespace sk_app { 12 namespace sk_app {
13 13
14 Window* Window::CreateNativeWindow(void* platformData) { 14 Window* Window::CreateNativeWindow(void* platformData) {
15 Window_android* window = new Window_android(); 15 Window_android* window = new Window_android();
16 if (!window->init((android_app*)platformData)) { 16 if (!window->init((android_app*)platformData)) {
17 delete window; 17 delete window;
18 return nullptr; 18 return nullptr;
19 } 19 }
20 return window; 20 return window;
(...skipping 25 matching lines...) Expand all
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 fTestContext = VulkanTestContext::Create((void*)&platformData, mSampleCount) ; 56 fWindowContext = VulkanWindowContext::Create((void*)&platformData, mSampleCo unt);
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
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
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/android/Window_android.h ('k') | tools/viewer/sk_app/android/main_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698