Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Unified Diff: Source/core/rendering/RenderImage.cpp

Issue 520803004: Remove redundant stack variables from RenderImage. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderImage.cpp
diff --git a/Source/core/rendering/RenderImage.cpp b/Source/core/rendering/RenderImage.cpp
index c46e8f0897192af236d61e1663e6f467b39afc4e..2c6c54e3a86c5ead345fb3f8ca8b07b532b31f5d 100644
--- a/Source/core/rendering/RenderImage.cpp
+++ b/Source/core/rendering/RenderImage.cpp
@@ -279,10 +279,6 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
{
LayoutUnit cWidth = contentWidth();
LayoutUnit cHeight = contentHeight();
- LayoutUnit leftBorder = borderLeft();
- LayoutUnit topBorder = borderTop();
- LayoutUnit leftPad = paddingLeft();
- LayoutUnit topPad = paddingTop();
GraphicsContext* context = paintInfo.context;
@@ -293,6 +289,11 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
if (cWidth > 2 && cHeight > 2) {
const int borderWidth = 1;
+ LayoutUnit leftBorder = borderLeft();
+ LayoutUnit topBorder = borderTop();
+ LayoutUnit leftPad = paddingLeft();
+ LayoutUnit topPad = paddingTop();
+
// Draw an outline rect where the image should be.
context->setStrokeStyle(SolidStroke);
context->setStrokeColor(Color::lightGray);
@@ -355,10 +356,6 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
}
}
} else if (m_imageResource->hasImage() && cWidth > 0 && cHeight > 0) {
- RefPtr<Image> img = m_imageResource->image(cWidth, cHeight);
- if (!img || img->isNull())
- return;
-
LayoutRect contentRect = contentBoxRect();
contentRect.moveBy(paintOffset);
LayoutRect paintRect = replacedContentRect();
@@ -450,7 +447,7 @@ void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect
HTMLImageElement* imageElt = isHTMLImageElement(node()) ? toHTMLImageElement(node()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
- Image* image = m_imageResource->image().get();
+ Image* image = img.get();
InterpolationQuality interpolationQuality = chooseInterpolationQuality(context, image, image, alignedRect.size());
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "data", InspectorPaintImageEvent::data(*this));
@@ -458,7 +455,7 @@ void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect
InspectorInstrumentation::willPaintImage(this);
InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality();
context->setImageInterpolationQuality(interpolationQuality);
- context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), alignedRect, compositeOperator, shouldRespectImageOrientation());
+ context->drawImage(image, alignedRect, compositeOperator, shouldRespectImageOrientation());
context->setImageInterpolationQuality(previousInterpolationQuality);
InspectorInstrumentation::didPaintImage(this);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698