Bug 1186278 - Regression: Some doorhangers have round-corner-looking artifacts; r=sebastian
authorMartyn Haigh <mhaigh@mozilla.org>
Wed, 05 Aug 2015 15:34:21 +0100
changeset 288053 90922d258d627ab32fad50be611219258fab7611
parent 288000 ca2464a414a677c789ca69e5fb1fafd372de480a
child 288054 d2a22e5315dd9409ce7d4e409ec6873a2fbc86c6
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1186278
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1186278 - Regression: Some doorhangers have round-corner-looking artifacts; r=sebastian
mobile/android/base/widget/RoundedCornerLayout.java
--- a/mobile/android/base/widget/RoundedCornerLayout.java
+++ b/mobile/android/base/widget/RoundedCornerLayout.java
@@ -49,27 +49,33 @@ public class RoundedCornerLayout extends
         paint = new Paint(Paint.ANTI_ALIAS_FLAG);
 
         maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
         maskPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
 
         setWillNotDraw(false);
     }
 
+
+    @Override
+    protected void onLayout(final boolean changed, final int l, final int t, final int r, final int b) {
+        super.onLayout(changed, l, t, r, b);
+        if (changed) {
+            maskBitmap = createMask(r, b);
+        }
+    }
+
+
     @Override
     public void draw(Canvas canvas) {
         Bitmap offscreenBitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
         Canvas offscreenCanvas = new Canvas(offscreenBitmap);
 
         super.draw(offscreenCanvas);
 
-        if (maskBitmap == null) {
-            maskBitmap = createMask(canvas.getWidth(), canvas.getHeight());
-        }
-
         offscreenCanvas.drawBitmap(maskBitmap, 0f, 0f, maskPaint);
         canvas.drawBitmap(offscreenBitmap, 0f, 0f, paint);
     }
 
     private Bitmap createMask(int width, int height) {
         Bitmap mask = Bitmap.createBitmap(width, height, Bitmap.Config.ALPHA_8);
         Canvas canvas = new Canvas(mask);