Index: Source/core/paint/HTMLCanvasPainter.cpp |
diff --git a/Source/core/paint/HTMLCanvasPainter.cpp b/Source/core/paint/HTMLCanvasPainter.cpp |
index d9d08a7fb0559ca7fc0d2af8aa4fc623f3bec9f6..bd03f58865693fe8c7b3c9dd54a8a553c8743fc6 100644 |
--- a/Source/core/paint/HTMLCanvasPainter.cpp |
+++ b/Source/core/paint/HTMLCanvasPainter.cpp |
@@ -6,6 +6,8 @@ |
#include "core/paint/HTMLCanvasPainter.h" |
#include "core/html/HTMLCanvasElement.h" |
+#include "core/paint/BoxClipper.h" |
+#include "core/paint/DrawingRecorder.h" |
#include "core/rendering/PaintInfo.h" |
#include "core/rendering/RenderHTMLCanvas.h" |
#include "platform/geometry/LayoutPoint.h" |
@@ -21,12 +23,7 @@ void HTMLCanvasPainter::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& p |
LayoutRect paintRect = m_renderHTMLCanvas.replacedContentRect(); |
paintRect.moveBy(paintOffset); |
- bool clip = !contentRect.contains(paintRect); |
- if (clip) { |
- // Not allowed to overflow the content box. |
- paintInfo.context->save(); |
- paintInfo.context->clip(pixelSnappedIntRect(contentRect)); |
- } |
+ OwnPtr<BoxClipper> boxClipper = adoptPtr(new BoxClipper(m_renderHTMLCanvas, paintInfo, paintOffset, SkipContentsClipIfPossible)); |
// FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set. |
// See bug for more details: crbug.com/353716. |
@@ -39,13 +36,11 @@ void HTMLCanvasPainter::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& p |
interpolationQuality = InterpolationNone; |
} |
+ DrawingRecorder recorder(context, &m_renderHTMLCanvas, paintInfo.phase, pixelSnappedIntRect(paintRect)); |
InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality(); |
context->setImageInterpolationQuality(interpolationQuality); |
canvas->paint(context, paintRect); |
context->setImageInterpolationQuality(previousInterpolationQuality); |
- |
- if (clip) |
- context->restore(); |
} |
} // namespace blink |