Bug 1264142 - Add ImageLayerComposite::GetFullyRenderedRegion() r=mattwoodrow
authorSotaro Ikeda <sotaro.ikeda.g@gmail.com>
Tue, 12 Apr 2016 23:49:40 -0700
changeset 292942 14d19fb83d3a7efaeb01d92a2f8d5e87d4bc59c1
parent 292941 9e62762fcc4aa6db5a13b86018d22da3bfc70256
child 292943 a3f300b2f6a4c7c14716583d93ad89ba0dd5491f
push id75038
push usersikeda@mozilla.com
push dateWed, 13 Apr 2016 06:49:53 +0000
treeherdermozilla-inbound@14d19fb83d3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1264142
milestone48.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 1264142 - Add ImageLayerComposite::GetFullyRenderedRegion() r=mattwoodrow
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/composite/ImageLayerComposite.h
gfx/layers/composite/LayerManagerComposite.h
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -163,16 +163,33 @@ ImageLayerComposite::IsOpaque()
   }
 
   if (mScaleMode == ScaleMode::STRETCH) {
     return mImageHost->IsOpaque();
   }
   return false;
 }
 
+nsIntRegion
+ImageLayerComposite::GetFullyRenderedRegion()
+{
+  if (!mImageHost ||
+      !mImageHost->IsAttached()) {
+    return GetShadowVisibleRegion().ToUnknownRegion();
+  }
+
+  if (mScaleMode == ScaleMode::STRETCH) {
+    nsIntRegion shadowVisibleRegion;
+    shadowVisibleRegion.And(GetShadowVisibleRegion().ToUnknownRegion(), nsIntRegion(gfx::IntRect(0, 0, mScaleToSize.width, mScaleToSize.height)));
+    return shadowVisibleRegion;
+  }
+
+  return GetShadowVisibleRegion().ToUnknownRegion();
+}
+
 CompositableHost*
 ImageLayerComposite::GetCompositableHost()
 {
   if (mImageHost && mImageHost->IsAttached()) {
     return mImageHost.get();
   }
 
   return nullptr;
--- a/gfx/layers/composite/ImageLayerComposite.h
+++ b/gfx/layers/composite/ImageLayerComposite.h
@@ -56,16 +56,18 @@ public:
   virtual void GenEffectChain(EffectChain& aEffect) override;
 
   virtual LayerComposite* AsLayerComposite() override { return this; }
 
   virtual const char* Name() const override { return "ImageLayerComposite"; }
 
   virtual bool IsOpaque() override;
 
+  virtual nsIntRegion GetFullyRenderedRegion() override;
+
 protected:
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
 
 private:
   gfx::Filter GetEffectFilter();
 
 private:
   RefPtr<ImageHost> mImageHost;
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -522,17 +522,17 @@ public:
   // Returns false if the layer is attached to an older compositor.
   bool HasStaleCompositor() const;
 
   /**
    * Return the part of the visible region that has been fully rendered.
    * While progressive drawing is in progress this region will be
    * a subset of the shadow visible region.
    */
-  nsIntRegion GetFullyRenderedRegion();
+  virtual nsIntRegion GetFullyRenderedRegion();
 
 protected:
   gfx::Matrix4x4 mShadowTransform;
   LayerIntRegion mShadowVisibleRegion;
   Maybe<ParentLayerIntRect> mShadowClipRect;
   LayerManagerComposite* mCompositeManager;
   RefPtr<Compositor> mCompositor;
   float mShadowOpacity;