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

Unified Diff: Source/core/paint/ImagePainter.cpp

Issue 1315993004: Implement a paint offset cache for slimming paint v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
Index: Source/core/paint/ImagePainter.cpp
diff --git a/Source/core/paint/ImagePainter.cpp b/Source/core/paint/ImagePainter.cpp
index 41843b2a01b6d1aa3c52cb2a4b8930dbc489fa48..ee2a57392b3bb25fd8addb4d2101e201e7fc147a 100644
--- a/Source/core/paint/ImagePainter.cpp
+++ b/Source/core/paint/ImagePainter.cpp
@@ -28,10 +28,10 @@ void ImagePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
m_layoutImage.LayoutReplaced::paint(paintInfo, paintOffset);
if (paintInfo.phase == PaintPhaseOutline)
- paintAreaElementFocusRing(paintInfo);
+ paintAreaElementFocusRing(paintInfo, paintOffset);
}
-void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo)
+void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
Document& document = m_layoutImage.document();
@@ -58,11 +58,11 @@ void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo)
if (!outlineWidth)
return;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutImage, paintInfo.phase))
+ 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);
+ 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
@@ -86,25 +86,25 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint&
if (paintInfo.phase == PaintPhaseSelection)
return;
if (cWidth > 2 && cHeight > 2) {
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutImage, paintInfo.phase))
+ 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);
+ 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) {
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutImage, paintInfo.phase))
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutImage, paintInfo.phase, paintOffset))
return;
LayoutRect contentRect = m_layoutImage.contentBoxRect();
contentRect.moveBy(paintOffset);
LayoutRect paintRect = m_layoutImage.replacedContentRect();
paintRect.moveBy(paintOffset);
- LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutImage, paintInfo.phase, contentRect);
+ LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutImage, paintInfo.phase, contentRect, paintOffset);
bool clip = !contentRect.contains(paintRect);
if (clip) {
context->save();

Powered by Google App Engine
This is Rietveld 408576698