Bug 1434925 - Skip drawing hidden toolbar elements; r=rbarker
authorJim Chen <nchen@mozilla.com>
Thu, 08 Feb 2018 13:55:15 -0500
changeset 403040 032ad85ded1f4a4903ffc33aed865f5c968db5d1
parent 403039 ad9f6cf50e5d1859c6056094f0d3b1dc96ec95cb
child 403041 74f5b6977fbe159d5d4ee7e4fd94a15d496ee325
push id33410
push usertoros@mozilla.com
push dateFri, 09 Feb 2018 10:00:41 +0000
treeherdermozilla-central@dfd0afe71bb5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrbarker
bugs1434925
milestone60.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 1434925 - Skip drawing hidden toolbar elements; r=rbarker 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.