Bug 929513 Part 2: Use gfx::IntSize for TiledContentClient's resolution r=nical
authorDavid Zbarsky <dzbarsky@gmail.com>
Sun, 27 Oct 2013 17:53:27 -0400
changeset 152420 6efcb3826227bd99b3d28c895f7a731279a91f37
parent 152419 9b86b4e60b29f3ee7ed54541a6806c726394ff8d
child 152421 02bc8f1178a6d4bd6f17804dcb524e7493bf0415
push id25540
push userphilringnalda@gmail.com
push dateMon, 28 Oct 2013 04:45:12 +0000
treeherdermozilla-central@59ff3a2a708a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs929513
milestone27.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 929513 Part 2: Use gfx::IntSize for TiledContentClient's resolution r=nical
gfx/layers/client/TiledContentClient.cpp
gfx/layers/client/TiledContentClient.h
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/ThebesLayerComposite.cpp
gfx/layers/composite/ThebesLayerComposite.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/TiledContentHost.h
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -416,17 +416,17 @@ BasicTiledLayerBuffer::ValidateTile(Basi
   }
 
   return aTile;
 }
 
 static nsIntRect
 RoundedTransformViewportBounds(const gfx::Rect& aViewport,
                                const CSSPoint& aScrollOffset,
-                               const gfxSize& aResolution,
+                               const LayerSize& aResolution,
                                float aScaleX,
                                float aScaleY,
                                const gfx3DMatrix& aTransform)
 {
   gfxRect transformedViewport(aViewport.x - (aScrollOffset.x * aResolution.width),
                               aViewport.y - (aScrollOffset.y * aResolution.height),
                               aViewport.width, aViewport.height);
   transformedViewport.Scale((aScaleX / aResolution.width) / aResolution.width,
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -9,17 +9,16 @@
 #include <stddef.h>                     // for size_t
 #include <stdint.h>                     // for uint16_t
 #include <algorithm>                    // for swap
 #include "Layers.h"                     // for LayerManager, etc
 #include "TiledLayerBuffer.h"           // for TiledLayerBuffer
 #include "Units.h"                      // for CSSPoint
 #include "gfx3DMatrix.h"                // for gfx3DMatrix
 #include "gfxTypes.h"
-#include "gfxPoint.h"                   // for gfxSize
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/layers/CompositableClient.h"  // for CompositableClient
 #include "mozilla/layers/CompositorTypes.h"  // for TextureInfo, etc
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsPoint.h"                    // for nsIntPoint
@@ -103,17 +102,17 @@ struct BasicTiledLayerTile {
  * This struct stores all the data necessary to perform a paint so that it
  * doesn't need to be recalculated on every repeated transaction.
  */
 struct BasicTiledLayerPaintData {
   CSSPoint mScrollOffset;
   CSSPoint mLastScrollOffset;
   gfx3DMatrix mTransformScreenToLayer;
   nsIntRect mLayerCriticalDisplayPort;
-  gfxSize mResolution;
+  LayerSize mResolution;
   nsIntRect mCompositionBounds;
   uint16_t mLowPrecisionPaintCount;
   bool mFirstPaint : 1;
   bool mPaintFinished : 1;
 };
 
 class ClientTiledThebesLayer;
 class ClientLayerManager;
@@ -175,18 +174,18 @@ public:
 
   void ReadLock() {
     for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
       if (mRetainedTiles[i].IsPlaceholderTile()) continue;
       mRetainedTiles[i].ReadLock();
     }
   }
 
-  const gfxSize& GetFrameResolution() { return mFrameResolution; }
-  void SetFrameResolution(const gfxSize& aResolution) { mFrameResolution = aResolution; }
+  const LayerSize& GetFrameResolution() { return mFrameResolution; }
+  void SetFrameResolution(const LayerSize& aResolution) { mFrameResolution = aResolution; }
 
   bool HasFormatChanged() const;
 
   /**
    * Performs a progressive update of a given tiled buffer.
    * See ComputeProgressiveUpdateRegion below for parameter documentation.
    */
   bool ProgressiveUpdate(nsIntRegion& aValidRegion,
@@ -221,17 +220,17 @@ protected:
   BasicTiledLayerTile GetPlaceholderTile() const { return BasicTiledLayerTile(); }
 
 private:
   gfxContentType GetContentType() const;
   ClientTiledThebesLayer* mThebesLayer;
   ClientLayerManager* mManager;
   LayerManager::DrawThebesLayerCallback mCallback;
   void* mCallbackData;
-  gfxSize mFrameResolution;
+  LayerSize mFrameResolution;
   bool mLastPaintOpaque;
 
   // The buffer we use when UseSinglePaintBuffer() above is true.
   nsRefPtr<gfxImageSurface>     mSinglePaintBuffer;
   RefPtr<gfx::DrawTarget>       mSinglePaintDrawTarget;
   nsIntPoint                    mSinglePaintBufferOffset;
 
   BasicTiledLayerTile ValidateTileInternal(BasicTiledLayerTile aTile,
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -3,32 +3,32 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_BUFFERHOST_H
 #define MOZILLA_GFX_BUFFERHOST_H
 
 #include <stdint.h>                     // for uint64_t
 #include <stdio.h>                      // for FILE
-#include "gfxPoint.h"                   // for gfxSize
 #include "gfxRect.h"                    // for gfxRect
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/RefPtr.h"             // for RefPtr, RefCounted, etc
 #include "mozilla/gfx/Point.h"          // for Point
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Filter
 #include "mozilla/ipc/ProtocolUtils.h"
 #include "mozilla/layers/CompositorTypes.h"  // for TextureInfo, etc
 #include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
 #include "mozilla/layers/PCompositableParent.h"
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsRegion.h"                   // for nsIntRegion
 #include "nscore.h"                     // for nsACString
+#include "Units.h"
 
 class gfxImageSurface;
 struct nsIntPoint;
 struct nsIntRect;
 
 namespace mozilla {
 namespace gfx {
 class Matrix4x4;
@@ -37,17 +37,17 @@ class Matrix4x4;
 namespace layers {
 
 // Some properties of a Layer required for tiling
 struct TiledLayerProperties
 {
   nsIntRegion mVisibleRegion;
   nsIntRegion mValidRegion;
   gfxRect mDisplayPort;
-  gfxSize mEffectiveResolution;
+  LayerSize mEffectiveResolution;
   gfxRect mCompositionBounds;
   bool mRetainTiles;
 };
 
 class Layer;
 class DeprecatedTextureHost;
 class TextureHost;
 class SurfaceDescriptor;
--- a/gfx/layers/composite/ThebesLayerComposite.cpp
+++ b/gfx/layers/composite/ThebesLayerComposite.cpp
@@ -171,25 +171,25 @@ void
 ThebesLayerComposite::CleanupResources()
 {
   if (mBuffer) {
     mBuffer->Detach(this);
   }
   mBuffer = nullptr;
 }
 
-gfxSize
+LayerSize
 ThebesLayerComposite::GetEffectiveResolution()
 {
   // Work out render resolution by multiplying the resolution of our ancestors.
   // Only container layers can have frame metrics, so we start off with a
   // resolution of 1, 1.
   // XXX For large layer trees, it would be faster to do this once from the
   //     root node upwards and store the value on each layer.
-  gfxSize resolution(1, 1);
+  LayerSize resolution(1, 1);
   for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
     const FrameMetrics& metrics = parent->GetFrameMetrics();
     resolution.width *= metrics.mResolution.scale;
     resolution.height *= metrics.mResolution.scale;
   }
 
   return resolution;
 }
@@ -201,17 +201,17 @@ ThebesLayerComposite::GetDisplayPort()
   // as we want the transform of the shadowable layers and not that of the
   // shadow layers, which may have been modified due to async scrolling/
   // zooming.
   gfx3DMatrix transform = GetTransform();
 
   // Find out the area of the nearest display-port to invalidate retained
   // tiles.
   gfxRect displayPort;
-  gfxSize parentResolution = GetEffectiveResolution();
+  LayerSize parentResolution = GetEffectiveResolution();
   for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
     const FrameMetrics& metrics = parent->GetFrameMetrics();
     if (displayPort.IsEmpty()) {
       if (!metrics.mDisplayPort.IsEmpty()) {
           // We use the bounds to cut down on complication/computation time.
           // This will be incorrect when the transform involves rotation, but
           // it'd be quite hard to retain invalid tiles correctly in this
           // situation anyway.
--- a/gfx/layers/composite/ThebesLayerComposite.h
+++ b/gfx/layers/composite/ThebesLayerComposite.h
@@ -81,17 +81,17 @@ public:
 protected:
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
 #endif
 
 private:
   gfxRect GetDisplayPort();
-  gfxSize GetEffectiveResolution();
+  LayerSize GetEffectiveResolution();
   gfxRect GetCompositionBounds();
 
   RefPtr<ContentHost> mBuffer;
   bool mRequiresTiledProperties;
 };
 
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -23,17 +23,17 @@ using namespace gfx;
 namespace layers {
 
 class Layer;
 
 void
 TiledLayerBufferComposite::Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
                                   const nsIntRegion& aNewValidRegion,
                                   const nsIntRegion& aInvalidateRegion,
-                                  const gfxSize& aResolution)
+                                  const LayerSize& aResolution)
 {
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   printf_stderr("Upload %i, %i, %i, %i\n", aInvalidateRegion.GetBounds().x, aInvalidateRegion.GetBounds().y, aInvalidateRegion.GetBounds().width, aInvalidateRegion.GetBounds().height);
   long start = PR_IntervalNow();
 #endif
 
   mFrameResolution = aResolution;
   mMainMemoryTiledBuffer = aMainMemoryTiledBuffer;
@@ -222,22 +222,22 @@ TiledContentHost::RenderLayerBuffer(Tile
                                     nsIntRect aVisibleRect,
                                     gfx::Matrix4x4 aTransform)
 {
   if (!mCompositor) {
     NS_WARNING("Can't render tiled content host - no compositor");
     return;
   }
   float resolution = aLayerBuffer.GetResolution();
-  gfxSize layerScale(1, 1);
+  LayerSize layerScale(1, 1);
   // We assume that the current frame resolution is the one used in our primary
   // layer buffer. Compensate for a changing frame resolution.
   if (aLayerBuffer.GetFrameResolution() != mVideoMemoryTiledBuffer.GetFrameResolution()) {
-    const gfxSize& layerResolution = aLayerBuffer.GetFrameResolution();
-    const gfxSize& localResolution = mVideoMemoryTiledBuffer.GetFrameResolution();
+    const LayerSize& layerResolution = aLayerBuffer.GetFrameResolution();
+    const LayerSize& localResolution = mVideoMemoryTiledBuffer.GetFrameResolution();
     layerScale.width = layerResolution.width / localResolution.width;
     layerScale.height = layerResolution.height / localResolution.height;
     aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height);
   }
   aTransform.Scale(1/(resolution * layerScale.width),
                    1/(resolution * layerScale.height), 1);
 
   uint32_t rowCount = 0;
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -7,17 +7,16 @@
 #define GFX_TILEDCONTENTHOST_H
 
 #include <stdint.h>                     // for uint16_t
 #include <stdio.h>                      // for FILE
 #include <algorithm>                    // for swap
 #include "ContentHost.h"                // for ContentHost
 #include "TiledLayerBuffer.h"           // for TiledLayerBuffer, etc
 #include "CompositableHost.h"
-#include "gfxPoint.h"                   // for gfxSize
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/Point.h"          // for Point
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Filter
 #include "mozilla/layers/CompositorTypes.h"  // for TextureInfo, etc
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
@@ -101,23 +100,23 @@ public:
   typedef TiledLayerBuffer<TiledLayerBufferComposite, TiledTexture>::Iterator Iterator;
   TiledLayerBufferComposite()
     : mCompositor(nullptr)
   {}
 
   void Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
               const nsIntRegion& aNewValidRegion,
               const nsIntRegion& aInvalidateRegion,
-              const gfxSize& aResolution);
+              const LayerSize& aResolution);
 
   TiledTexture GetPlaceholderTile() const { return TiledTexture(); }
 
   // Stores the absolute resolution of the containing frame, calculated
   // by the sum of the resolutions of all parent layers' FrameMetrics.
-  const gfxSize& GetFrameResolution() { return mFrameResolution; }
+  const LayerSize& GetFrameResolution() { return mFrameResolution; }
 
   void SetCompositor(Compositor* aCompositor)
   {
     mCompositor = aCompositor;
   }
 
 protected:
   TiledTexture ValidateTile(TiledTexture aTile,
@@ -129,17 +128,17 @@ protected:
 
   void SwapTiles(TiledTexture& aTileA, TiledTexture& aTileB) {
     std::swap(aTileA, aTileB);
   }
 
 private:
   Compositor* mCompositor;
   const BasicTiledLayerBuffer* mMainMemoryTiledBuffer;
-  gfxSize mFrameResolution;
+  LayerSize mFrameResolution;
 };
 
 /**
  * ContentHost for tiled Thebes layers. Since tiled layers are special snow
  * flakes, we don't call UpdateThebes or AddTextureHost, etc. We do call Composite
  * in the usual way though.
  *
  * There is no corresponding content client - on the client side we use a