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

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

Issue 2050613003: Support resize in Android Viewer App (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Nits 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/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);
« no previous file with comments | « tools/viewer/sk_app/android/RasterWindowContext_android.h ('k') | tools/viewer/sk_app/android/surface_glue_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698