Bug 1418816 - Part 1: Add repeat size property to ImageLayer. r=mattwoodrow
☠☠ backed out by c03ebd9cf525 ☠ ☠
authorJamie Nicol <jnicol@mozilla.com>
Wed, 19 Sep 2018 04:44:26 +0000
changeset 492952 3c4cec04f28d6eb088c802ff59d63a820b8bdebc
parent 492951 8f1ea035b4e3486d0f7628c46b72d520bec0b0b3
child 492953 807f0f510c25c27dee013ca7f07985a255997712
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1418816
milestone64.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 1418816 - Part 1: Add repeat size property to ImageLayer. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D6024
gfx/layers/ImageLayers.h
gfx/layers/Layers.cpp
gfx/layers/client/ClientImageLayer.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayersMessages.ipdlh
--- a/gfx/layers/ImageLayers.h
+++ b/gfx/layers/ImageLayers.h
@@ -56,21 +56,35 @@ public:
   {
     if (mScaleToSize != aSize || mScaleMode != aMode) {
       mScaleToSize = aSize;
       mScaleMode = aMode;
       Mutated();
     }
   }
 
+  /**
+   * CONSTRUCTION PHASE ONLY
+   * Set the repeat size.
+   * IntSize(0, 0) means do not repeat.
+   */
+  void SetRepeatSize(const gfx::IntSize& aRepeatSize)
+  {
+    if (mRepeatSize == aRepeatSize) {
+      return;
+    }
+    mRepeatSize = aRepeatSize;
+    Mutated();
+  }
 
   ImageContainer* GetContainer() { return mContainer; }
   gfx::SamplingFilter GetSamplingFilter() { return mSamplingFilter; }
   const gfx::IntSize& GetScaleToSize() { return mScaleToSize; }
   ScaleMode GetScaleMode() { return mScaleMode; }
+  const gfx::IntSize& GetRepeatSize() { return mRepeatSize; }
 
   MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE)
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override;
 
   virtual const gfx::Matrix4x4& GetEffectiveTransformForBuffer() const override
   {
     return mEffectiveTransformForBuffer;
@@ -83,15 +97,16 @@ protected:
   ~ImageLayer();
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
   virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
 
   RefPtr<ImageContainer> mContainer;
   gfx::SamplingFilter mSamplingFilter;
   gfx::IntSize mScaleToSize;
   ScaleMode mScaleMode;
+  gfx::IntSize mRepeatSize;
   gfx::Matrix4x4 mEffectiveTransformForBuffer;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* GFX_IMAGELAYER_H */
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -2194,16 +2194,17 @@ CanvasLayer::CreateOrGetCanvasRenderer()
 
 void
 ImageLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
   Layer::PrintInfo(aStream, aPrefix);
   if (mSamplingFilter != SamplingFilter::GOOD) {
     AppendToString(aStream, mSamplingFilter, " [filter=", "]");
   }
+  AppendToString(aStream, mRepeatSize, " [repeatSize=", "]");
 }
 
 void
 ImageLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
 {
   Layer::DumpPacket(aPacket, aParent);
   // Get this layer data
   using namespace layerscope;
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -72,17 +72,20 @@ protected:
   {
     if (mImageClient) {
       mImageClient->HandleMemoryPressure();
     }
   }
 
   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override
   {
-    aAttrs = ImageLayerAttributes(mSamplingFilter, mScaleToSize, mScaleMode);
+    aAttrs = ImageLayerAttributes(mSamplingFilter,
+                                  mScaleToSize,
+                                  mScaleMode,
+                                  mRepeatSize);
   }
 
   virtual Layer* AsLayer() override { return this; }
   virtual ShadowableLayer* AsShadowableLayer() override { return this; }
 
   virtual void Disconnect() override
   {
     DestroyBackBuffer();
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -633,16 +633,17 @@ LayerTransactionParent::SetLayerAttribut
 
     ImageLayer* imageLayer = layer->AsImageLayer();
     if (!imageLayer) {
       return false;
     }
     const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
     imageLayer->SetSamplingFilter(attrs.samplingFilter());
     imageLayer->SetScaleToSize(attrs.scaleToSize(), attrs.scaleMode());
+    imageLayer->SetRepeatSize(attrs.repeatSize());
     break;
   }
   default:
     MOZ_CRASH("not reached");
   }
 
   return true;
 }
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -301,17 +301,23 @@ struct GlyphArray
 };
 
 struct ColorLayerAttributes     { LayerColor color; IntRect bounds; };
 struct CanvasLayerAttributes    { SamplingFilter samplingFilter; IntRect bounds; };
 struct RefLayerAttributes {
   LayersId id;
   EventRegionsOverride eventRegionsOverride;
 };
-struct ImageLayerAttributes     { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
+
+struct ImageLayerAttributes {
+  SamplingFilter samplingFilter;
+  IntSize scaleToSize;
+  ScaleMode scaleMode;
+  IntSize repeatSize;
+};
 
 union SpecificLayerAttributes {
   null_t;
   PaintedLayerAttributes;
   ContainerLayerAttributes;
   ColorLayerAttributes;
   CanvasLayerAttributes;
   RefLayerAttributes;