Bug 1543577 - Remove useless parameter aImageSize from nsLayoutUtils::DrawBackgroundImage r=emilio
authorviolet <violet.bugreport@gmail.com>
Thu, 11 Apr 2019 11:52:03 +0000
changeset 468992 2694a48f2df4e335792478de35e48886fcd9953d
parent 468991 60a543a89dfa78df3b8dfcb8c3838f7df9412b36
child 468993 af09d82cf835964099694b874d70c3ecb30f629c
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1543577, 1524901
milestone68.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 1543577 - Remove useless parameter aImageSize from nsLayoutUtils::DrawBackgroundImage r=emilio aImageSize parameter is only used for SVG background image to pass the intrinsic size. After bug 1524901, it becomes useless. Let's remove it. Differential Revision: https://phabricator.services.mozilla.com/D27051
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/painting/nsImageRenderer.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6897,20 +6897,20 @@ nsPoint nsLayoutUtils::GetBackgroundFirs
                  NSToIntFloor(float(aFill.y - aDest.y) / aRepeatSize.height) *
                      aRepeatSize.height) +
          aDest;
 }
 
 /* static */
 ImgDrawResult nsLayoutUtils::DrawBackgroundImage(
     gfxContext& aContext, nsIFrame* aForFrame, nsPresContext* aPresContext,
-    imgIContainer* aImage, const CSSIntSize& aImageSize,
-    SamplingFilter aSamplingFilter, const nsRect& aDest, const nsRect& aFill,
-    const nsSize& aRepeatSize, const nsPoint& aAnchor, const nsRect& aDirty,
-    uint32_t aImageFlags, ExtendMode aExtendMode, float aOpacity) {
+    imgIContainer* aImage, SamplingFilter aSamplingFilter, const nsRect& aDest,
+    const nsRect& aFill, const nsSize& aRepeatSize, const nsPoint& aAnchor,
+    const nsRect& aDirty, uint32_t aImageFlags, ExtendMode aExtendMode,
+    float aOpacity) {
   AUTO_PROFILER_LABEL("nsLayoutUtils::DrawBackgroundImage",
                       GRAPHICS_Rasterization);
 
   CSSIntSize destCSSSize{nsPresContext::AppUnitsToIntCSSPixels(aDest.width),
                          nsPresContext::AppUnitsToIntCSSPixels(aDest.height)};
 
   Maybe<SVGImageContext> svgContext(Some(SVGImageContext(Some(destCSSSize))));
   SVGImageContext::MaybeStoreContextPaint(svgContext, aForFrame, aImage);
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1774,20 +1774,16 @@ class nsLayoutUtils {
    *
    * @param aContext
    *   The context to draw to, already set up with an appropriate scale and
    *   transform for drawing in app units.
    * @param aForFrame
    *   The nsIFrame that we're drawing this image for.
    * @param aImage
    *   The image.
-   * @param aImageSize
-   *  The unscaled size of the image being drawn. (This might be the image's
-   *  size if no scaling occurs, or it might be the image's size if the image is
-   *  a vector image being rendered at that size.)
    * @param aDest
    *  The position and scaled area where one copy of the image should be drawn.
    *  This area represents the image itself in its correct position as defined
    *  with the background-position css property.
    * @param aFill
    *  The area to be filled with copies of the image.
    * @param aRepeatSize
    *  The distance between the positions of two subsequent repeats of the image.
@@ -1798,20 +1794,20 @@ class nsLayoutUtils {
    *   Pixels outside this area may be skipped.
    * @param aImageFlags
    *   Image flags of the imgIContainer::FLAG_* variety.
    * @param aExtendMode
    *   How to extend the image over the dest rect.
    */
   static ImgDrawResult DrawBackgroundImage(
       gfxContext& aContext, nsIFrame* aForFrame, nsPresContext* aPresContext,
-      imgIContainer* aImage, const CSSIntSize& aImageSize,
-      SamplingFilter aSamplingFilter, const nsRect& aDest, const nsRect& aFill,
-      const nsSize& aRepeatSize, const nsPoint& aAnchor, const nsRect& aDirty,
-      uint32_t aImageFlags, ExtendMode aExtendMode, float aOpacity);
+      imgIContainer* aImage, SamplingFilter aSamplingFilter,
+      const nsRect& aDest, const nsRect& aFill, const nsSize& aRepeatSize,
+      const nsPoint& aAnchor, const nsRect& aDirty, uint32_t aImageFlags,
+      ExtendMode aExtendMode, float aOpacity);
 
   /**
    * Draw an image.
    * See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering
    *   @param aRenderingContext Where to draw the image, set up with an
    *                            appropriate scale and transform for drawing in
    *                            app units.
    *   @param aComputedStyle    The ComputedStyle of the nsIFrame (or
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -462,21 +462,19 @@ ImgDrawResult nsImageRenderer::Draw(nsPr
       gfxDevCrash(LogReason::InvalidContext)
           << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
       return ImgDrawResult::TEMPORARY_ERROR;
     }
   }
 
   switch (mType) {
     case eStyleImageType_Image: {
-      CSSIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
-                           nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
       result = nsLayoutUtils::DrawBackgroundImage(
-          *ctx, mForFrame, aPresContext, mImageContainer, imageSize,
-          samplingFilter, aDest, aFill, aRepeatSize, aAnchor, aDirtyRect,
+          *ctx, mForFrame, aPresContext, mImageContainer, samplingFilter, aDest,
+          aFill, aRepeatSize, aAnchor, aDirtyRect,
           ConvertImageRendererToDrawFlags(mFlags), mExtendMode, aOpacity);
       break;
     }
     case eStyleImageType_Gradient: {
       nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create(
           aPresContext, mForFrame->Style(), mGradientData, mSize);
 
       renderer.Paint(*ctx, aDest, aFill, aRepeatSize, aSrc, aDirtyRect,
@@ -921,22 +919,21 @@ ImgDrawResult nsImageRenderer::DrawBorde
       }
 
       return result;
     }
 
     nsSize repeatSize;
     nsRect fillRect(aFill);
     nsRect tile = ComputeTile(fillRect, aHFill, aVFill, aUnitSize, repeatSize);
-    CSSIntSize imageSize(srcRect.width, srcRect.height);
 
     ImgDrawResult result = nsLayoutUtils::DrawBackgroundImage(
-        aRenderingContext, mForFrame, aPresContext, subImage, imageSize,
-        samplingFilter, tile, fillRect, repeatSize, tile.TopLeft(), aDirtyRect,
-        drawFlags, ExtendMode::CLAMP, 1.0);
+        aRenderingContext, mForFrame, aPresContext, subImage, samplingFilter,
+        tile, fillRect, repeatSize, tile.TopLeft(), aDirtyRect, drawFlags,
+        ExtendMode::CLAMP, 1.0);
 
     if (!mImage->IsComplete()) {
       result &= ImgDrawResult::SUCCESS_NOT_COMPLETE;
     }
 
     return result;
   }