Index: tools/viewer/sk_app/android/RasterWindowContext_android.cpp |
diff --git a/tools/viewer/sk_app/android/RasterWindowContext_android.cpp b/tools/viewer/sk_app/android/RasterWindowContext_android.cpp |
index 306f291de8f80fadc10c5c2822a7b92b2b3096fa..3ba564635e2da2aeca87af682d3c6846e6185938 100644 |
--- a/tools/viewer/sk_app/android/RasterWindowContext_android.cpp |
+++ b/tools/viewer/sk_app/android/RasterWindowContext_android.cpp |
@@ -32,8 +32,12 @@ RasterWindowContext_android::RasterWindowContext_android( |
fNativeWindow = androidPlatformData->fNativeWindow; |
fWidth = ANativeWindow_getWidth(fNativeWindow); |
fHeight = ANativeWindow_getHeight(fNativeWindow); |
+ this->setBuffersGeometry(); |
+} |
+ |
+void RasterWindowContext_android::setBuffersGeometry() { |
int32_t format; |
- switch(params.fColorType) { |
+ switch(fDisplayParams.fColorType) { |
case kRGBA_8888_SkColorType: |
format = WINDOW_FORMAT_RGBA_8888; |
break; |
@@ -46,6 +50,17 @@ RasterWindowContext_android::RasterWindowContext_android( |
ANativeWindow_setBuffersGeometry(fNativeWindow, fWidth, fHeight, format); |
} |
+void RasterWindowContext_android::setDisplayParams(const DisplayParams& params) { |
+ fDisplayParams = params; |
+ this->setBuffersGeometry(); |
+} |
+ |
+void RasterWindowContext_android::resize(uint32_t w, uint32_t h) { |
+ fWidth = w; |
+ fHeight = h; |
+ this->setBuffersGeometry(); |
+} |
+ |
sk_sp<SkSurface> RasterWindowContext_android::getBackbufferSurface() { |
if (nullptr == fBackbufferSurface) { |
ANativeWindow_lock(fNativeWindow, &fBuffer, &fBounds); |