Remove redundant getDisplayportOrigin method from ViewportMetrics; use getOrigin instead
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 23 Feb 2012 15:08:05 -0500
changeset 89235 61386b8c2272c57d899b12d59aa5ad7e56b157ef
parent 89234 1f96ca787c9fdc04ec1615fc155350017df29a29
child 89236 60fdcec15ed3b4fb920ba2bdcbeff83b34aa8d03
push id22242
push userkgupta@mozilla.com
push dateWed, 14 Mar 2012 15:19:09 +0000
treeherdermozilla-central@936ef50fa498 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone13.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
Remove redundant getDisplayportOrigin method from ViewportMetrics; use getOrigin instead
mobile/android/base/GeckoApp.java
mobile/android/base/gfx/GeckoLayerClient.java
mobile/android/base/gfx/PlaceholderLayerClient.java
mobile/android/base/gfx/ViewportMetrics.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1513,17 +1513,17 @@ abstract public class GeckoApp
         ViewportMetrics metrics;
         try {
             metrics = new ViewportMetrics(new JSONObject(metadata));
         } catch (JSONException e) {
             Log.e(LOGTAG, "Bad viewport metadata: ", e);
             return;
         }
 
-        PointF origin = metrics.getDisplayportOrigin();
+        PointF origin = metrics.getOrigin();
         x = x + (int)origin.x;
         y = y + (int)origin.y;
 
         LayerView layerView = mLayerController.getView();
         SurfaceTextureLayer layer = (SurfaceTextureLayer)tab.getPluginLayer(surface);
         if (layer == null)
             return;
 
@@ -2789,17 +2789,17 @@ class PluginLayoutParams extends Absolut
             } else {
                 width = (int)(((float)width/(float)height) * MAX_DIMENSION);
                 height = MAX_DIMENSION;
             }
         }
     }
 
     public void reset(int aX, int aY, int aWidth, int aHeight, ViewportMetrics aViewport) {
-        PointF origin = aViewport.getDisplayportOrigin();
+        PointF origin = aViewport.getOrigin();
 
         x = mOriginalX = aX + (int)origin.x;
         y = mOriginalY = aY + (int)origin.y;
         width = mOriginalWidth = aWidth;
         height = mOriginalHeight = aHeight;
         mOriginalViewport = aViewport;
         mLastResolution = aViewport.getZoomFactor();
 
@@ -2815,18 +2815,18 @@ class PluginLayoutParams extends Absolut
             height = Math.round(aResolution * mOriginalHeight);
             mLastResolution = aResolution;
 
             clampToMaxSize();
         }
     }
 
     public void reposition(ViewportMetrics viewport) {
-        PointF targetOrigin = viewport.getDisplayportOrigin();
-        PointF originalOrigin = mOriginalViewport.getDisplayportOrigin();
+        PointF targetOrigin = viewport.getOrigin();
+        PointF originalOrigin = mOriginalViewport.getOrigin();
 
         Point offset = new Point(Math.round(originalOrigin.x - targetOrigin.x),
                                  Math.round(originalOrigin.y - targetOrigin.y));
 
         reposition(offset, viewport.getZoomFactor());
     }
 
     public float getLastResolution() {
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -171,17 +171,17 @@ public class GeckoLayerClient implements
             // send to Gecko if adjustViewport were called now.
             ViewportMetrics currentMetrics = mLayerController.getViewportMetrics();
             PointF currentBestOrigin = RectUtils.getOrigin(currentMetrics.getClampedViewport());
 
             Rect currentRect = RectUtils.round(new RectF(currentBestOrigin.x, currentBestOrigin.y,
                                                          currentBestOrigin.x + width, currentBestOrigin.y + height));
 
             // Second, store Gecko's displayport.
-            PointF currentOrigin = mNewGeckoViewport.getDisplayportOrigin();
+            PointF currentOrigin = mNewGeckoViewport.getOrigin();
             bufferRect = RectUtils.round(new RectF(currentOrigin.x, currentOrigin.y,
                                                    currentOrigin.x + width, currentOrigin.y + height));
 
             int area = width * height;
 
             // Take the intersection of the two as the area we're interested in rendering.
             if (!bufferRect.intersect(currentRect)) {
                 Log.w(LOGTAG, "Prediction would avoid useless paint of " + area + " pixels (100.0%)");
@@ -237,18 +237,18 @@ public class GeckoLayerClient implements
         // save and restore the viewport size stored in java; never let the
         // JS-side viewport dimensions override the java-side ones because
         // java is the One True Source of this information, and allowing JS
         // to override can lead to race conditions where this data gets clobbered.
         FloatSize viewportSize = mLayerController.getViewportSize();
         mGeckoViewport = mNewGeckoViewport;
         mGeckoViewport.setSize(viewportSize);
 
-        PointF displayportOrigin = mGeckoViewport.getDisplayportOrigin();
-        mTileLayer.setOrigin(PointUtils.round(displayportOrigin));
+        PointF origin = mGeckoViewport.getOrigin();
+        mTileLayer.setOrigin(PointUtils.round(origin));
         mTileLayer.setResolution(mGeckoViewport.getZoomFactor());
 
         // Set the new origin and resolution instantly.
         mTileLayer.performUpdates(null);
 
         Log.e(LOGTAG, "### updateViewport onlyUpdatePageSize=" + onlyUpdatePageSize +
               " getTileViewport " + mGeckoViewport);
 
--- a/mobile/android/base/gfx/PlaceholderLayerClient.java
+++ b/mobile/android/base/gfx/PlaceholderLayerClient.java
@@ -84,17 +84,17 @@ public class PlaceholderLayerClient {
             mViewport.setViewport(mLayerController.getViewport());
         mLayerController.setViewportMetrics(mViewport);
 
         BufferedCairoImage image = new BufferedCairoImage(mBuffer, mWidth, mHeight, mFormat);
         SingleTileLayer tileLayer = new SingleTileLayer(image);
 
         tileLayer.beginTransaction();   // calling thread irrelevant; nobody else has a ref to tileLayer yet
         try {
-            tileLayer.setOrigin(PointUtils.round(mViewport.getDisplayportOrigin()));
+            tileLayer.setOrigin(PointUtils.round(mViewport.getOrigin()));
         } finally {
             tileLayer.endTransaction();
         }
 
         mLayerController.setRoot(tileLayer);
     }
 
     public void destroy() {
--- a/mobile/android/base/gfx/ViewportMetrics.java
+++ b/mobile/android/base/gfx/ViewportMetrics.java
@@ -92,21 +92,16 @@ public class ViewportMetrics {
         mViewportRect = new RectF(x, y, x + width, y + height);
         mZoomFactor = zoom;
     }
 
     public PointF getOrigin() {
         return new PointF(mViewportRect.left, mViewportRect.top);
     }
 
-    public PointF getDisplayportOrigin() {
-        return new PointF(mViewportRect.left,
-                          mViewportRect.top);
-    }
-
     public FloatSize getSize() {
         return new FloatSize(mViewportRect.width(), mViewportRect.height());
     }
 
     public RectF getViewport() {
         return mViewportRect;
     }