Index: Source/core/rendering/RenderHTMLCanvas.cpp |
diff --git a/Source/core/rendering/RenderHTMLCanvas.cpp b/Source/core/rendering/RenderHTMLCanvas.cpp |
index 8b1d87d96c7cefa0bb587b46ca292c5dd81a8f2f..b454d8972f01ef92252652f8eb5559aea5e66792 100644 |
--- a/Source/core/rendering/RenderHTMLCanvas.cpp |
+++ b/Source/core/rendering/RenderHTMLCanvas.cpp |
@@ -31,6 +31,7 @@ |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
#include "core/page/Page.h" |
+#include "core/paint/HTMLCanvasPainter.h" |
#include "core/rendering/PaintInfo.h" |
#include "core/rendering/RenderView.h" |
@@ -51,38 +52,7 @@ LayerType RenderHTMLCanvas::layerTypeRequired() const |
void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
- GraphicsContext* context = paintInfo.context; |
- |
- LayoutRect contentRect = contentBoxRect(); |
- contentRect.moveBy(paintOffset); |
- LayoutRect paintRect = 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)); |
- } |
- |
- // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set. |
- // See bug for more details: crbug.com/353716. |
- InterpolationQuality interpolationQuality = style()->imageRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuality; |
- |
- HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); |
- LayoutSize layoutSize = contentRect.size(); |
- if (style()->imageRendering() == ImageRenderingPixelated |
- && (layoutSize.width() > canvas->width() || layoutSize.height() > canvas->height() || layoutSize == canvas->size())) { |
- interpolationQuality = InterpolationNone; |
- } |
- |
- InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality(); |
- context->setImageInterpolationQuality(interpolationQuality); |
- canvas->paint(context, paintRect); |
- context->setImageInterpolationQuality(previousInterpolationQuality); |
- |
- if (clip) |
- context->restore(); |
+ HTMLCanvasPainter(*this).paintReplaced(paintInfo, paintOffset); |
} |
void RenderHTMLCanvas::canvasSizeChanged() |