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

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

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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 | « Source/core/paint/HTMLCanvasPainter.cpp ('k') | Source/core/paint/InlineFlowBoxPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ImagePainter.cpp
diff --git a/Source/core/paint/ImagePainter.cpp b/Source/core/paint/ImagePainter.cpp
index 47af0238c4a18cf6fc96a1230bffff6e54eb4cb3..f8686b94b77140e159bad336c4a18dd34e1b9504 100644
--- a/Source/core/paint/ImagePainter.cpp
+++ b/Source/core/paint/ImagePainter.cpp
@@ -58,11 +58,11 @@ void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo)
if (!outlineWidth)
return;
- IntRect focusRect = m_layoutImage.absoluteContentBox();
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutImage, paintInfo.phase))
+ return;
+ IntRect focusRect = m_layoutImage.absoluteContentBox();
LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layoutImage, paintInfo.phase, focusRect);
- if (drawingRecorder.canUseCachedDrawing())
- return;
// FIXME: Clip path instead of context when Skia pathops is ready.
// https://crbug.com/251206
@@ -85,28 +85,26 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint&
if (!m_layoutImage.imageResource()->hasImage()) {
if (paintInfo.phase == PaintPhaseSelection)
return;
-
if (cWidth > 2 && cHeight > 2) {
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutImage, paintInfo.phase))
+ 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);
- if (drawingRecorder.canUseCachedDrawing())
- return;
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))
+ 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);
- if (drawingRecorder.canUseCachedDrawing())
- return;
bool clip = !contentRect.contains(paintRect);
if (clip) {
context->save();
« no previous file with comments | « Source/core/paint/HTMLCanvasPainter.cpp ('k') | Source/core/paint/InlineFlowBoxPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698