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

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

Issue 2067023002: Enable viewer in non-Vulkan builds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Only include XCB if using Vulkan Created 4 years, 6 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
« no previous file with comments | « tools/viewer/sk_app/Window.cpp ('k') | tools/viewer/sk_app/unix/GLWindowContext_unix.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "../GLWindowContext.h" 9 #include "../GLWindowContext.h"
10 #ifdef SK_VULKAN
10 #include "../VulkanWindowContext.h" 11 #include "../VulkanWindowContext.h"
12 #endif
11 #include "../RasterWindowContext.h" 13 #include "../RasterWindowContext.h"
12 14
13 namespace sk_app { 15 namespace sk_app {
14 16
15 Window* Window::CreateNativeWindow(void* platformData) { 17 Window* Window::CreateNativeWindow(void* platformData) {
16 Window_android* window = new Window_android(); 18 Window_android* window = new Window_android();
17 if (!window->init((SkiaAndroidApp*)platformData)) { 19 if (!window->init((SkiaAndroidApp*)platformData)) {
18 delete window; 20 delete window;
19 return nullptr; 21 return nullptr;
20 } 22 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // The creation will be done in initDisplay, which is initiated by kSurfaceC reated event. 57 // The creation will be done in initDisplay, which is initiated by kSurfaceC reated event.
56 return true; 58 return true;
57 } 59 }
58 60
59 void Window_android::initDisplay(ANativeWindow* window) { 61 void Window_android::initDisplay(ANativeWindow* window) {
60 SkASSERT(window); 62 SkASSERT(window);
61 ContextPlatformData_android platformData; 63 ContextPlatformData_android platformData;
62 platformData.fNativeWindow = window; 64 platformData.fNativeWindow = window;
63 switch (fBackendType) { 65 switch (fBackendType) {
64 case kNativeGL_BackendType: 66 case kNativeGL_BackendType:
67 default:
65 fWindowContext = GLWindowContext::Create((void*)&platformData, fDisp layParams); 68 fWindowContext = GLWindowContext::Create((void*)&platformData, fDisp layParams);
66 break; 69 break;
67 case kRaster_BackendType: 70 case kRaster_BackendType:
68 fWindowContext = RasterWindowContext::Create((void*)&platformData, f DisplayParams); 71 fWindowContext = RasterWindowContext::Create((void*)&platformData, f DisplayParams);
69 break; 72 break;
73 #ifdef SK_VULKAN
70 case kVulkan_BackendType: 74 case kVulkan_BackendType:
71 default:
72 fWindowContext = VulkanWindowContext::Create((void*)&platformData, f DisplayParams); 75 fWindowContext = VulkanWindowContext::Create((void*)&platformData, f DisplayParams);
73 break; 76 break;
77 #endif
74 } 78 }
75 } 79 }
76 80
77 void Window_android::onDisplayDestroyed() { 81 void Window_android::onDisplayDestroyed() {
78 detach(); 82 detach();
79 } 83 }
80 84
81 void Window_android::onInval() { 85 void Window_android::onInval() {
82 fSkiaAndroidApp->postMessage(Message(kContentInvalidated)); 86 fSkiaAndroidApp->postMessage(Message(kContentInvalidated));
83 } 87 }
84 88
85 void Window_android::paintIfNeeded() { 89 void Window_android::paintIfNeeded() {
86 if (fWindowContext) { // Check if initDisplay has already been called 90 if (fWindowContext) { // Check if initDisplay has already been called
87 onPaint(); 91 onPaint();
88 } else { 92 } else {
89 markInvalProcessed(); 93 markInvalProcessed();
90 } 94 }
91 } 95 }
92 96
93 } // namespace sk_app 97 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/Window.cpp ('k') | tools/viewer/sk_app/unix/GLWindowContext_unix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698