From 53389bdcdf6ffaaec533b73bc1d0abc5807ec7f6 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 7 Sep 2010 17:16:32 -0700 Subject: [PATCH] Correctly set the viewport on window resize. Change-Id: Idec325264d85feda76d4cda00fa511aaac82cf64 --- core/java/android/view/ViewRoot.java | 4 +- tests/HwAccelerationTest/AndroidManifest.xml | 10 +++ tests/HwAccelerationTest/res/layout/form.xml | 66 +++++++++++++++++++ .../android/test/hwui/ResizeActivity.java | 30 +++++++++ 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 tests/HwAccelerationTest/res/layout/form.xml create mode 100644 tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index e61eaed9fb159..e5fc859fe333a 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -946,8 +946,8 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn mSurfaceHolder.mSurfaceLock.unlock(); } } - - if (hwIntialized) { + + if (hwIntialized || (windowShouldResize && mHwRenderer != null)) { mHwRenderer.setup(mWidth, mHeight); } diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index 34cbc44efe11d..db1e5eff0d26a 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -30,6 +30,16 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java b/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java new file mode 100644 index 0000000000000..e5771b860f474 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.test.hwui; + +import android.app.Activity; +import android.os.Bundle; + +@SuppressWarnings({"UnusedDeclaration"}) +public class ResizeActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.form); + } +}