summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-07-13 15:24:42 -0700
committerMathias Agopian <mathias@google.com>2011-07-19 13:05:11 -0700
commit09d7ed7b395d66be97c6bcb052039f5c0dce646c (patch)
treef707f6e46bd9a0edeaac9b33bffe054a64e3062c /native
parent9d29d155c51a26d789cce2c4c24c659487c63554 (diff)
downloadframeworks_base-09d7ed7b395d66be97c6bcb052039f5c0dce646c.zip
frameworks_base-09d7ed7b395d66be97c6bcb052039f5c0dce646c.tar.gz
frameworks_base-09d7ed7b395d66be97c6bcb052039f5c0dce646c.tar.bz2
Add set_scaling_mode() to ANativeWindow.
This allows to specify the scaling mode independently from the buffer size. Change-Id: Iaa2baa660445531a97d3fac192e580f4929c5d3b
Diffstat (limited to 'native')
-rw-r--r--native/android/native_window.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp
index 5c016c4..36fc9bf 100644
--- a/native/android/native_window.cpp
+++ b/native/android/native_window.cpp
@@ -76,7 +76,15 @@ int32_t ANativeWindow_getFormat(ANativeWindow* window) {
int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
int32_t height, int32_t format) {
- return native_window_set_buffers_geometry(window, width, height, format);
+ int32_t err = native_window_set_buffers_geometry(window, width, height, format);
+ if (!err) {
+ int mode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
+ if (width && height) {
+ mode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW;
+ }
+ err = native_window_set_scaling_mode(window, mode);
+ }
+ return err;
}
int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,