Don't draw a fullscreen background when not necessary.
This change removes the window's background as soon as one WebView
has drawn its content. This avoids a full screen draw, which saves
one third of the fillrate budget per frame.
Change-Id: I29295dfc33b551ef0500afe45538a58c497b8e7e
diff --git a/src/com/android/browser/ScrollWebView.java b/src/com/android/browser/ScrollWebView.java
index 51df958..e2ef902 100644
--- a/src/com/android/browser/ScrollWebView.java
+++ b/src/com/android/browser/ScrollWebView.java
@@ -30,6 +30,7 @@
private ScrollListener mScrollListener;
private boolean mIsCancelled;
+ private boolean mBackgroundRemoved = false;
/**
* @param context
@@ -113,4 +114,16 @@
public void onScroll(int visibleTitleHeight);
}
+ @Override
+ protected void onDraw(android.graphics.Canvas c) {
+ super.onDraw(c);
+ if (!mBackgroundRemoved && getRootView().getBackground() != null) {
+ mBackgroundRemoved = true;
+ post(new Runnable() {
+ public void run() {
+ getRootView().setBackgroundDrawable(null);
+ }
+ });
+ }
+ }
}