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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/util/ViewUtils.java

Issue 2221483002: Only gather transparent regions inside their own view bounds in views that might have children exte… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 4 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarControlContainer.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/util/ViewUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/ViewUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/util/ViewUtils.java
index da29da5f4deffbff4c59c4f70285a41cade0732e..c612cbe5b31e98a1c0661513f380a2d052f89a35 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/util/ViewUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/util/ViewUtils.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.util;
import android.graphics.Canvas;
+import android.graphics.Region;
import android.view.View;
import android.view.ViewGroup;
@@ -12,6 +13,8 @@ import android.view.ViewGroup;
* View-related utility methods.
*/
public class ViewUtils {
+ private static final int[] sLocationTmp = new int[2];
+
/**
* Invalidates a view and all of its descendants.
*/
@@ -76,4 +79,17 @@ public class ViewUtils {
childView = (View) childView.getParent();
}
}
+
+ /**
+ * Helper for overriding {@link View#gatherTransparentRegions()} for views that are fully opaque
+ * and have children extending beyond their bounds. If the transparent region optimization is
+ * turned on (which is the case whenever the view hierarchy contains a SurfaceView somewhere),
+ * the children might otherwise confuse the SurfaceFlinger.
+ */
+ public static void gatherTransparentRegionsForOpaqueView(View view, Region region) {
+ view.getLocationInWindow(sLocationTmp);
+ region.op(sLocationTmp[0], sLocationTmp[1],
+ sLocationTmp[0] + view.getRight() - view.getLeft(),
+ sLocationTmp[1] + view.getBottom() - view.getTop(), Region.Op.DIFFERENCE);
+ }
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarControlContainer.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698