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

Side by Side Diff: Source/core/paint/HTMLCanvasPainter.cpp

Issue 930833003: Move and rename RenderReplaced and RenderHTMLCanvas to Layout{Replaced,HTMLCanvas}. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No need to declare renderName() at all. Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « Source/core/paint/HTMLCanvasPainter.h ('k') | Source/core/paint/ImagePainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/HTMLCanvasPainter.h" 6 #include "core/paint/HTMLCanvasPainter.h"
7 7
8 #include "core/html/HTMLCanvasElement.h" 8 #include "core/html/HTMLCanvasElement.h"
9 #include "core/layout/LayoutHTMLCanvas.h"
9 #include "core/layout/PaintInfo.h" 10 #include "core/layout/PaintInfo.h"
10 #include "core/paint/RenderDrawingRecorder.h" 11 #include "core/paint/RenderDrawingRecorder.h"
11 #include "core/rendering/RenderHTMLCanvas.h"
12 #include "platform/geometry/LayoutPoint.h" 12 #include "platform/geometry/LayoutPoint.h"
13 #include "platform/graphics/paint/ClipRecorder.h" 13 #include "platform/graphics/paint/ClipRecorder.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPo int& paintOffset) 17 void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPo int& paintOffset)
18 { 18 {
19 GraphicsContext* context = paintInfo.context; 19 GraphicsContext* context = paintInfo.context;
20 20
21 LayoutRect contentRect = m_renderHTMLCanvas.contentBoxRect(); 21 LayoutRect contentRect = m_layoutHTMLCanvas.contentBoxRect();
22 contentRect.moveBy(paintOffset); 22 contentRect.moveBy(paintOffset);
23 LayoutRect paintRect = m_renderHTMLCanvas.replacedContentRect(); 23 LayoutRect paintRect = m_layoutHTMLCanvas.replacedContentRect();
24 paintRect.moveBy(paintOffset); 24 paintRect.moveBy(paintOffset);
25 25
26 bool clip = !contentRect.contains(paintRect); 26 bool clip = !contentRect.contains(paintRect);
27 if (clip) { 27 if (clip) {
28 context->save(); 28 context->save();
29 context->clip(contentRect); 29 context->clip(contentRect);
30 } 30 }
31 31
32 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set. 32 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set.
33 // See bug for more details: crbug.com/353716. 33 // See bug for more details: crbug.com/353716.
34 InterpolationQuality interpolationQuality = m_renderHTMLCanvas.style()->imag eRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaul tInterpolationQuality; 34 InterpolationQuality interpolationQuality = m_layoutHTMLCanvas.style()->imag eRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaul tInterpolationQuality;
35 if (m_renderHTMLCanvas.style()->imageRendering() == ImageRenderingPixelated) 35 if (m_layoutHTMLCanvas.style()->imageRendering() == ImageRenderingPixelated)
36 interpolationQuality = InterpolationNone; 36 interpolationQuality = InterpolationNone;
37 37
38 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality(); 38 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality();
39 context->setImageInterpolationQuality(interpolationQuality); 39 context->setImageInterpolationQuality(interpolationQuality);
40 toHTMLCanvasElement(m_renderHTMLCanvas.node())->paint(context, paintRect); 40 toHTMLCanvasElement(m_layoutHTMLCanvas.node())->paint(context, paintRect);
41 context->setImageInterpolationQuality(previousInterpolationQuality); 41 context->setImageInterpolationQuality(previousInterpolationQuality);
42 42
43 if (clip) 43 if (clip)
44 context->restore(); 44 context->restore();
45 } 45 }
46 46
47 } // namespace blink 47 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/HTMLCanvasPainter.h ('k') | Source/core/paint/ImagePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698