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

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

Issue 799563002: Use DrawingRecorder::canUseCachedDrawing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years 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 f4388257d6c5f8bb97f712a37fc636ecb5e4f560..eba533765c9f31c94db88a30610855af789ac77a 100644
--- a/Source/core/paint/ImagePainter.cpp
+++ b/Source/core/paint/ImagePainter.cpp
@@ -64,7 +64,10 @@ void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo)
// https://crbug.com/251206
GraphicsContextStateSaver savedContext(*paintInfo.context);
IntRect focusRect = m_renderImage.absoluteContentBox();
- RenderDrawingRecorder recorder(paintInfo.context, &m_renderImage, paintInfo.phase, focusRect);
+ RenderDrawingRecorder recorder(paintInfo.context, m_renderImage, paintInfo.phase, focusRect);
+ if (recorder.canUseCachedDrawing())
+ return;
+
paintInfo.context->clip(focusRect);
paintInfo.context->drawFocusRing(path, outlineWidth,
areaElementStyle->outlineOffset(),
@@ -85,7 +88,10 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint&
if (cWidth > 2 && cHeight > 2) {
// Draw an outline rect where the image should be.
IntRect paintRect = pixelSnappedIntRect(LayoutRect(paintOffset.x() + m_renderImage.borderLeft() + m_renderImage.paddingLeft(), paintOffset.y() + m_renderImage.borderTop() + m_renderImage.paddingTop(), cWidth, cHeight));
- RenderDrawingRecorder recorder(context, &m_renderImage, paintInfo.phase, paintRect);
+ RenderDrawingRecorder recorder(context, m_renderImage, paintInfo.phase, paintRect);
+ if (recorder.canUseCachedDrawing())
+ return;
+
context->setStrokeStyle(SolidStroke);
context->setStrokeColor(Color::lightGray);
context->setFillColor(Color::transparent);
@@ -96,7 +102,10 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint&
contentRect.moveBy(paintOffset);
LayoutRect paintRect = m_renderImage.replacedContentRect();
paintRect.moveBy(paintOffset);
- RenderDrawingRecorder recorder(context, &m_renderImage, paintInfo.phase, contentRect);
+ RenderDrawingRecorder recorder(context, m_renderImage, paintInfo.phase, contentRect);
+ if (recorder.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