Bug 1290782 Part 2 - Remove redundant destCtx and IsEmpty check of snappedDestSize since it should always have a value. r?cjku draft
authorLouis Chang <lochang@mozilla.com>
Wed, 20 Sep 2017 10:05:49 +0800
changeset 667426 a1610a1265a10f0667028d14bd055666cf009205
parent 667425 0da4d8c8c52389e2758d719e03c9b298ee556f5d
child 667427 db58caa495972cc1420a252590d9c8ee942350df
push id80695
push userlochang@mozilla.com
push dateWed, 20 Sep 2017 02:48:08 +0000
reviewerscjku
bugs1290782
milestone57.0a1
Bug 1290782 Part 2 - Remove redundant destCtx and IsEmpty check of snappedDestSize since it should always have a value. r?cjku MozReview-Commit-ID: 25IlXeqURVa
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6542,17 +6542,17 @@ ComputeSnappedImageDrawingParameters(gfx
   }
 
   // We need to be sure that this is at least one pixel in width and height,
   // or we'll end up drawing nothing even if we have a nonempty fill.
   snappedDestSize.width = std::max(snappedDestSize.width, 1.0);
   snappedDestSize.height = std::max(snappedDestSize.height, 1.0);
 
   // Bail if we're not going to end up drawing anything.
-  if (fill.IsEmpty() || snappedDestSize.IsEmpty()) {
+  if (fill.IsEmpty()) {
     return SnappedImageDrawingParameters();
   }
 
   nsIntSize intImageSize =
     aImage->OptimalImageSizeForDest(snappedDestSize,
                                     imgIContainer::FRAME_CURRENT,
                                     aSamplingFilter, aImageFlags);
 
@@ -6730,27 +6730,25 @@ DrawImageInternal(gfxContext&           
 
   if (!params.shouldDraw) {
     return result;
   }
 
   {
     gfxContextMatrixAutoSaveRestore contextMatrixRestorer(&aContext);
 
-    RefPtr<gfxContext> destCtx = &aContext;
-
-    destCtx->SetMatrix(params.imageSpaceToDeviceSpace);
+    aContext.SetMatrix(params.imageSpaceToDeviceSpace);
 
     Maybe<SVGImageContext> fallbackContext;
     if (!aSVGContext) {
       // Use the default viewport.
       fallbackContext.emplace(Some(params.svgViewportSize));
     }
 
-    result = aImage->Draw(destCtx, params.size, params.region,
+    result = aImage->Draw(&aContext, params.size, params.region,
                           imgIContainer::FRAME_CURRENT, aSamplingFilter,
                           aSVGContext ? aSVGContext : fallbackContext,
                           aImageFlags, aOpacity);
 
   }
 
   return result;
 }