Bug 749164 - Fix viewport intersection with page rect and guard against zero screen area. r=jrmuizel
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 26 Apr 2012 14:23:28 -0400
changeset 92544 ead719dd0ec1d4b359314d98a05f3876aa109ad4
parent 92543 bf2eb02383fd6b8ca9305a14b75ab506afa2aadc
child 92545 c978a9f2d1d880a9eacf405e79d890e6c756189d
push id22544
push useremorley@mozilla.com
push dateFri, 27 Apr 2012 11:53:27 +0000
treeherdermozilla-central@d871849ac3a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs749164
milestone15.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 749164 - Fix viewport intersection with page rect and guard against zero screen area. r=jrmuizel
mobile/android/base/gfx/LayerRenderer.java
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -669,27 +669,28 @@ public class LayerRenderer implements GL
             if ((rootLayer != null) &&
                 (mProfileRender || PanningPerfAPI.isRecordingCheckerboard())) {
                 // Find out how much of the viewport area is valid
                 Rect viewport = RectUtils.round(mPageContext.viewport);
                 Region validRegion = rootLayer.getValidRegion(mPageContext);
 
                 /* restrict the viewport to page bounds so we don't
                  * count overscroll as checkerboard */
-                if (!viewport.intersect(mPageRect)) {
+                if (!viewport.intersect(0, 0, mPageRect.width(), mPageRect.height())) {
                     /* if the rectangles don't intersect
                        intersect() doesn't change viewport
                        so we set it to empty by hand */
                     viewport.setEmpty();
                 }
                 validRegion.op(viewport, Region.Op.INTERSECT);
 
                 float checkerboard = 0.0f;
-                if (!(validRegion.isRect() && validRegion.getBounds().equals(viewport))) {
-                    int screenArea = viewport.width() * viewport.height();
+
+                int screenArea = viewport.width() * viewport.height();
+                if (screenArea > 0 && !(validRegion.isRect() && validRegion.getBounds().equals(viewport))) {
                     validRegion.op(viewport, Region.Op.REVERSE_DIFFERENCE);
 
                     // XXX The assumption here is that a Region never has overlapping
                     //     rects. This is true, as evidenced by reading the SkRegion
                     //     source, but is not mentioned in the Android documentation,
                     //     and so is liable to change.
                     //     If it does change, this code will need to be reevaluated.
                     Rect r = new Rect();