Bug 883646 - Update the ViewTransform class to have a LayoutToScreen scale factor. r=kentuckyfriedtakahe, BenWa
☠☠ backed out by 3a96c5cf458c ☠ ☠
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 20 Jun 2013 16:10:58 -0400
changeset 135899 e39d3bdf847a1c69e2ea2b6b4b0f7be8878c04a8
parent 135898 bf46fc332efec683eedab80be3043edee7172344
child 135900 2272804a8e711e9047b2f17252f6f7155f8bd421
push id24856
push useremorley@mozilla.com
push dateFri, 21 Jun 2013 14:42:16 +0000
treeherdermozilla-central@61c3c8b85563 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe, BenWa
bugs883646
milestone24.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 883646 - Update the ViewTransform class to have a LayoutToScreen scale factor. r=kentuckyfriedtakahe, BenWa
gfx/layers/composite/AsyncCompositionManager.cpp
gfx/layers/composite/AsyncCompositionManager.h
gfx/layers/ipc/AsyncPanZoomController.cpp
layout/base/Units.h
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -453,17 +453,17 @@ AsyncCompositionManager::TransformScroll
   LayerToScreenScale zoomAdjust = userZoom / geckoZoom;
 
   LayerIntPoint geckoScroll(0, 0);
   if (metrics.IsScrollable()) {
     geckoScroll = scrollOffsetLayerPixels;
   }
 
   LayerPoint translation = (userScroll / zoomAdjust) - geckoScroll;
-  treeTransform = gfx3DMatrix(ViewTransform(-translation, userZoom));
+  treeTransform = gfx3DMatrix(ViewTransform(-translation, userZoom / metrics.mDevPixelsPerCSSPixel));
 
   // Translate fixed position layers so that they stay in the correct position
   // when userScroll and geckoScroll differ.
   gfxPoint fixedOffset;
   gfxSize scaleDiff;
 
   LayerRect content = mContentRect * geckoZoom;
   // If the contents can fit entirely within the widget area on a particular
--- a/gfx/layers/composite/AsyncCompositionManager.h
+++ b/gfx/layers/composite/AsyncCompositionManager.h
@@ -23,30 +23,30 @@ namespace layers {
 class AsyncPanZoomController;
 class Layer;
 class LayerManagerComposite;
 class AutoResolveRefLayers;
 
 // Represents (affine) transforms that are calculated from a content view.
 struct ViewTransform {
   ViewTransform(LayerPoint aTranslation = LayerPoint(),
-                CSSToScreenScale aScale = CSSToScreenScale())
+                LayoutDeviceToScreenScale aScale = LayoutDeviceToScreenScale())
     : mTranslation(aTranslation)
     , mScale(aScale)
   {}
 
   operator gfx3DMatrix() const
   {
     return
       gfx3DMatrix::Translation(mTranslation.x, mTranslation.y, 0) *
       gfx3DMatrix::ScalingMatrix(mScale.scale, mScale.scale, 1);
   }
 
   LayerPoint mTranslation;
-  CSSToScreenScale mScale;
+  LayoutDeviceToScreenScale mScale;
 };
 
 /**
  * Manage async composition effects. This class is only used with OMTC and only
  * lives on the compositor thread. It is a layer on top of the layer manager
  * (LayerManagerComposite) which deals with elements of composition which are
  * usually dealt with by dom or layout when main thread rendering, but which can
  * short circuit that stuff to directly affect layers as they are composited,
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1172,17 +1172,17 @@ bool AsyncPanZoomController::SampleConte
   }
 
   // Scales on the root layer, on what's currently painted.
   const gfx3DMatrix& currentTransform = aLayer->GetTransform();
   CSSToLayerScale rootScale = frame.mDevPixelsPerCSSPixel
       / LayerToLayoutDeviceScale(currentTransform.GetXScale(), currentTransform.GetYScale());
 
   LayerPoint translation = (scrollOffset * rootScale) - metricsScrollOffset;
-  *aNewTransform = ViewTransform(-translation, localScale);
+  *aNewTransform = ViewTransform(-translation, localScale / frame.mDevPixelsPerCSSPixel);
   aScrollOffset = scrollOffset * localScale;
 
   mLastSampleTime = aSampleTime;
 
   return requestAnimationFrame;
 }
 
 void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aViewportFrame, bool aIsFirstPaint) {
--- a/layout/base/Units.h
+++ b/layout/base/Units.h
@@ -50,16 +50,18 @@ typedef gfx::IntRectTyped<ScreenPixel> S
 typedef gfx::ScaleFactor<CSSPixel, LayoutDevicePixel> CSSToLayoutDeviceScale;
 typedef gfx::ScaleFactor<LayoutDevicePixel, CSSPixel> LayoutDeviceToCSSScale;
 typedef gfx::ScaleFactor<CSSPixel, LayerPixel> CSSToLayerScale;
 typedef gfx::ScaleFactor<LayerPixel, CSSPixel> LayerToCSSScale;
 typedef gfx::ScaleFactor<CSSPixel, ScreenPixel> CSSToScreenScale;
 typedef gfx::ScaleFactor<ScreenPixel, CSSPixel> ScreenToCSSScale;
 typedef gfx::ScaleFactor<LayoutDevicePixel, LayerPixel> LayoutDeviceToLayerScale;
 typedef gfx::ScaleFactor<LayerPixel, LayoutDevicePixel> LayerToLayoutDeviceScale;
+typedef gfx::ScaleFactor<LayoutDevicePixel, ScreenPixel> LayoutDeviceToScreenScale;
+typedef gfx::ScaleFactor<ScreenPixel, LayoutDevicePixel> ScreenToLayoutDeviceScale;
 typedef gfx::ScaleFactor<LayerPixel, ScreenPixel> LayerToScreenScale;
 typedef gfx::ScaleFactor<ScreenPixel, LayerPixel> ScreenToLayerScale;
 typedef gfx::ScaleFactor<ScreenPixel, ScreenPixel> ScreenToScreenScale;
 
 /*
  * The pixels that content authors use to specify sizes in.
  */
 struct CSSPixel {