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

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

Issue 2169543002: Use Windowing system-specific WindowContext factories. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more xlib Created 4 years, 4 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 #include "../GLWindowContext.h" 9 #include "WindowContextFactory_android.h"
10 #ifdef SK_VULKAN 10 #include "../WindowContext.h"
11 #include "../VulkanWindowContext.h"
12 #endif
13 #include "../RasterWindowContext.h"
14 11
15 namespace sk_app { 12 namespace sk_app {
16 13
17 Window* Window::CreateNativeWindow(void* platformData) { 14 Window* Window::CreateNativeWindow(void* platformData) {
18 Window_android* window = new Window_android(); 15 Window_android* window = new Window_android();
19 if (!window->init((SkiaAndroidApp*)platformData)) { 16 if (!window->init((SkiaAndroidApp*)platformData)) {
20 delete window; 17 delete window;
21 return nullptr; 18 return nullptr;
22 } 19 }
23 return window; 20 return window;
(...skipping 29 matching lines...) Expand all
53 fDisplayParams = params; 50 fDisplayParams = params;
54 51
55 // We delay the creation of fWindowContext until Android informs us that 52 // We delay the creation of fWindowContext until Android informs us that
56 // the native window is ready to use. 53 // the native window is ready to use.
57 // The creation will be done in initDisplay, which is initiated by kSurfaceC reated event. 54 // The creation will be done in initDisplay, which is initiated by kSurfaceC reated event.
58 return true; 55 return true;
59 } 56 }
60 57
61 void Window_android::initDisplay(ANativeWindow* window) { 58 void Window_android::initDisplay(ANativeWindow* window) {
62 SkASSERT(window); 59 SkASSERT(window);
63 ContextPlatformData_android platformData;
64 platformData.fNativeWindow = window;
65 switch (fBackendType) { 60 switch (fBackendType) {
66 case kNativeGL_BackendType: 61 case kNativeGL_BackendType:
67 default: 62 default:
68 fWindowContext = GLWindowContext::Create((void*)&platformData, fDisp layParams); 63 fWindowContext = window_context_factory::NewGLForAndroid(window, fDi splayParams);
69 break; 64 break;
70 case kRaster_BackendType: 65 case kRaster_BackendType:
71 fWindowContext = RasterWindowContext::Create((void*)&platformData, f DisplayParams); 66 fWindowContext = window_context_factory::NewRasterForAndroid(window, fDisplayParams);
72 break; 67 break;
73 #ifdef SK_VULKAN 68 #ifdef SK_VULKAN
74 case kVulkan_BackendType: 69 case kVulkan_BackendType:
75 fWindowContext = VulkanWindowContext::Create((void*)&platformData, f DisplayParams); 70 fWindowContext = window_context_factory::NewVulkanForAndroid(window, fDisplayParams);
76 break; 71 break;
77 #endif 72 #endif
78 } 73 }
79 } 74 }
80 75
81 void Window_android::onDisplayDestroyed() { 76 void Window_android::onDisplayDestroyed() {
82 detach(); 77 detach();
83 } 78 }
84 79
85 void Window_android::onInval() { 80 void Window_android::onInval() {
86 fSkiaAndroidApp->postMessage(Message(kContentInvalidated)); 81 fSkiaAndroidApp->postMessage(Message(kContentInvalidated));
87 } 82 }
88 83
89 void Window_android::paintIfNeeded() { 84 void Window_android::paintIfNeeded() {
90 if (fWindowContext) { // Check if initDisplay has already been called 85 if (fWindowContext) { // Check if initDisplay has already been called
91 onPaint(); 86 onPaint();
92 } else { 87 } else {
93 markInvalProcessed(); 88 markInvalProcessed();
94 } 89 }
95 } 90 }
96 91
97 } // namespace sk_app 92 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/android/Window_android.h ('k') | tools/viewer/sk_app/mac/GLWindowContext_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698