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
--- 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;
}