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

Unified Diff: tools/viewer/sk_app/android/Window_android.cpp

Issue 2041193004: Implement Raster Backend on Android Viewer App (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: RasterDirect 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 side-by-side diff with in-line comments
Download patch
Index: tools/viewer/sk_app/android/Window_android.cpp
diff --git a/tools/viewer/sk_app/android/Window_android.cpp b/tools/viewer/sk_app/android/Window_android.cpp
index 926c7cd17d09433b3c600ba2077242dc8e076c15..159d6a033debff07642855cd7f861d6e1b2003c4 100644
--- a/tools/viewer/sk_app/android/Window_android.cpp
+++ b/tools/viewer/sk_app/android/Window_android.cpp
@@ -8,6 +8,7 @@
#include "Window_android.h"
#include "../GLWindowContext.h"
#include "../VulkanWindowContext.h"
+#include "RasterWindowContext_android.h"
namespace sk_app {
@@ -49,11 +50,7 @@ bool Window_android::attach(BackendType attachType, const DisplayParams& params)
fBackendType = attachType;
fDisplayParams = params;
- if (fNativeWindow) {
- this->initDisplay(fNativeWindow);
- }
- // If fNativeWindow is not set,
- // we delay the creation of fWindowContext until Android informs us that
+ // We delay the creation of fWindowContext until Android informs us that
// the native window is ready to use.
// The creation will be done in initDisplay, which is initiated by kSurfaceCreated event.
return true;
@@ -61,14 +58,15 @@ bool Window_android::attach(BackendType attachType, const DisplayParams& params)
void Window_android::initDisplay(ANativeWindow* window) {
SkASSERT(window);
- fNativeWindow = window;
ContextPlatformData_android platformData;
platformData.fNativeWindow = window;
switch (fBackendType) {
case kNativeGL_BackendType:
fWindowContext = GLWindowContext::Create((void*)&platformData, fDisplayParams);
break;
-
+ case kRaster_BackendType:
+ fWindowContext = new RasterWindowContext_android((void*)&platformData, fDisplayParams);
djsollen 2016/06/07 19:31:48 use RasterWindowContext::Create for consistency.
liyuqian 2016/06/07 19:53:02 Done.
+ break;
case kVulkan_BackendType:
default:
fWindowContext = VulkanWindowContext::Create((void*)&platformData, fDisplayParams);
@@ -78,7 +76,6 @@ void Window_android::initDisplay(ANativeWindow* window) {
void Window_android::onDisplayDestroyed() {
detach();
- fNativeWindow = nullptr;
}
void Window_android::onInval() {

Powered by Google App Engine
This is Rietveld 408576698