Bug 1434925 - Skip drawing hidden toolbar elements; r=rbarker a=lizzard
authorJim Chen <nchen@mozilla.com>
Thu, 08 Feb 2018 13:55:15 -0500
changeset 452360 70cc9d6d659f726d328bfd6b529b28adccd62b5e
parent 452359 152720a4efe7421404020e2728a05bf5af543919
child 452361 3c16503565e67e1a4046bf19016f7b4b15515532
push id8695
push userebalazs@mozilla.com
push dateTue, 13 Feb 2018 13:20:58 +0000
treeherdermozilla-beta@3c16503565e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrbarker, lizzard
bugs1434925
milestone59.0
Bug 1434925 - Skip drawing hidden toolbar elements; r=rbarker a=lizzard Apparently a toolbar element can be zero-sized when we try to draw it to the bitmap. We should just skip drawing in that case. MozReview-Commit-ID: LlFQX5uN20h
mobile/android/base/java/org/mozilla/gecko/toolbar/CanvasDelegate.java
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/CanvasDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/CanvasDelegate.java
@@ -30,16 +30,20 @@ class CanvasDelegate {
 
         // DST_IN masks, DST_OUT clips.
         mMode = new PorterDuffXfermode(mode);
 
         mPaint = paint;
     }
 
     void draw(Canvas canvas, Path path, int width, int height) {
+        if (width <= 0 || height <= 0) {
+            return;
+        }
+
         Bitmap offscreen = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
         Canvas offscreenCanvas = new Canvas(offscreen);
 
         // Do a default draw.
         mDrawManager.defaultDraw(offscreenCanvas);
 
         if (path != null && !path.isEmpty()) {
             // ICS added double-buffering, which made it easier for drawing the Path directly over the DST.