Index: third_party/WebKit/Source/core/paint/ImagePainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/ImagePainter.cpp b/third_party/WebKit/Source/core/paint/ImagePainter.cpp |
index 29def2dce8a195ed6614a8921e7d8f3e10f8db26..e6ac56454e545db99bd4bd29b870ba9795771c64 100644 |
--- a/third_party/WebKit/Source/core/paint/ImagePainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/ImagePainter.cpp |
@@ -61,21 +61,21 @@ void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo, const L |
if (!outlineWidth) |
return; |
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutImage, paintInfo.phase, paintOffset)) |
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutImage, paintInfo.phase, paintOffset)) |
return; |
IntRect focusRect = m_layoutImage.absoluteContentBox(); |
- LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layoutImage, paintInfo.phase, focusRect, paintOffset); |
+ LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutImage, paintInfo.phase, focusRect, paintOffset); |
// FIXME: Clip path instead of context when Skia pathops is ready. |
// https://crbug.com/251206 |
- paintInfo.context->save(); |
- paintInfo.context->clip(focusRect); |
- paintInfo.context->drawFocusRing(path, outlineWidth, |
+ paintInfo.context.save(); |
+ paintInfo.context.clip(focusRect); |
+ paintInfo.context.drawFocusRing(path, outlineWidth, |
areaElementStyle.outlineOffset(), |
m_layoutImage.resolveColor(areaElementStyle, CSSPropertyOutlineColor)); |
- paintInfo.context->restore(); |
+ paintInfo.context.restore(); |
} |
void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
@@ -83,21 +83,21 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& |
LayoutUnit cWidth = m_layoutImage.contentWidth(); |
LayoutUnit cHeight = m_layoutImage.contentHeight(); |
- GraphicsContext* context = paintInfo.context; |
+ GraphicsContext& context = paintInfo.context; |
if (!m_layoutImage.imageResource()->hasImage()) { |
if (paintInfo.phase == PaintPhaseSelection) |
return; |
if (cWidth > 2 && cHeight > 2) { |
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutImage, paintInfo.phase, paintOffset)) |
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutImage, paintInfo.phase, paintOffset)) |
return; |
// Draw an outline rect where the image should be. |
IntRect paintRect = pixelSnappedIntRect(LayoutRect(paintOffset.x() + m_layoutImage.borderLeft() + m_layoutImage.paddingLeft(), paintOffset.y() + m_layoutImage.borderTop() + m_layoutImage.paddingTop(), cWidth, cHeight)); |
- LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutImage, paintInfo.phase, paintRect, paintOffset); |
- context->setStrokeStyle(SolidStroke); |
- context->setStrokeColor(Color::lightGray); |
- context->setFillColor(Color::transparent); |
- context->drawRect(paintRect); |
+ LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutImage, paintInfo.phase, paintRect, paintOffset); |
+ context.setStrokeStyle(SolidStroke); |
+ context.setStrokeColor(Color::lightGray); |
+ context.setFillColor(Color::transparent); |
+ context.drawRect(paintRect); |
} |
} else if (cWidth > 0 && cHeight > 0) { |
LayoutRect contentRect = m_layoutImage.contentBoxRect(); |
@@ -108,18 +108,18 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& |
Optional<ClipRecorder> clipRecorder; |
if (!contentRect.contains(paintRect)) { |
// TODO(fmalita): can we get rid of this clip and adjust the image src/dst rect instead? |
- clipRecorder.emplace(*context, m_layoutImage, paintInfo.displayItemTypeForClipping(), contentRect); |
+ clipRecorder.emplace(context, m_layoutImage, paintInfo.displayItemTypeForClipping(), contentRect); |
} |
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutImage, paintInfo.phase, paintOffset)) |
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutImage, paintInfo.phase, paintOffset)) |
return; |
- LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutImage, paintInfo.phase, contentRect, paintOffset); |
+ LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutImage, paintInfo.phase, contentRect, paintOffset); |
paintIntoRect(context, paintRect); |
} |
} |
-void ImagePainter::paintIntoRect(GraphicsContext* context, const LayoutRect& rect) |
+void ImagePainter::paintIntoRect(GraphicsContext& context, const LayoutRect& rect) |
{ |
if (!m_layoutImage.imageResource()->hasImage() || m_layoutImage.imageResource()->errorOccurred()) |
return; // FIXME: should we just ASSERT these conditions? (audit all callers). |
@@ -133,14 +133,14 @@ void ImagePainter::paintIntoRect(GraphicsContext* context, const LayoutRect& rec |
return; |
// FIXME: why is interpolation quality selection not included in the Instrumentation reported cost of drawing an image? |
- InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQuality(m_layoutImage, context, image.get(), image.get(), LayoutSize(alignedRect.size())); |
+ InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQuality(m_layoutImage, image.get(), image.get(), LayoutSize(alignedRect.size())); |
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "data", InspectorPaintImageEvent::data(m_layoutImage)); |
- InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality(); |
- context->setImageInterpolationQuality(interpolationQuality); |
- context->drawImage(image.get(), alignedRect, SkXfermode::kSrcOver_Mode, LayoutObject::shouldRespectImageOrientation(&m_layoutImage)); |
- context->setImageInterpolationQuality(previousInterpolationQuality); |
+ InterpolationQuality previousInterpolationQuality = context.imageInterpolationQuality(); |
+ context.setImageInterpolationQuality(interpolationQuality); |
+ context.drawImage(image.get(), alignedRect, SkXfermode::kSrcOver_Mode, LayoutObject::shouldRespectImageOrientation(&m_layoutImage)); |
+ context.setImageInterpolationQuality(previousInterpolationQuality); |
} |
} // namespace blink |