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

Unified Diff: Source/core/rendering/RenderHTMLCanvas.cpp

Issue 590393004: Move paint code from RenderHTMLCanvas to HTMLCanvasPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « Source/core/paint/HTMLCanvasPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698