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

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

Issue 1160223004: Avoid false-positives of under-invalidation checking (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix build break (release w/ assert) Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/BoxPainter.cpp ('k') | Source/platform/graphics/paint/DisplayItemList.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/LayoutHTMLCanvas.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
11 #include "core/paint/PaintInfo.h" 11 #include "core/paint/PaintInfo.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_layoutHTMLCanvas.contentBoxRect(); 21 LayoutRect contentRect = m_layoutHTMLCanvas.contentBoxRect();
22 contentRect.moveBy(paintOffset); 22 contentRect.moveBy(paintOffset);
23 LayoutRect paintRect = m_layoutHTMLCanvas.replacedContentRect(); 23 LayoutRect paintRect = m_layoutHTMLCanvas.replacedContentRect();
24 paintRect.moveBy(paintOffset); 24 paintRect.moveBy(paintOffset);
25 25
26 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutHTMLCanvas, pa intInfo.phase, contentRect); 26 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutHTMLCanvas, pa intInfo.phase, contentRect);
27 if (drawingRecorder.canUseCachedDrawing()) 27 if (drawingRecorder.canUseCachedDrawing())
28 return; 28 return;
29 29
30 #if ENABLE(ASSERT)
31 // The drawing may be in display list mode or image mode, producing differen t pictures for the same result.
32 drawingRecorder.setUnderInvalidationCheckingMode(DrawingDisplayItem::CheckBi tmap);
33 #endif
34
30 bool clip = !contentRect.contains(paintRect); 35 bool clip = !contentRect.contains(paintRect);
31 if (clip) { 36 if (clip) {
32 context->save(); 37 context->save();
33 context->clip(contentRect); 38 context->clip(contentRect);
34 } 39 }
35 40
36 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set. 41 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set.
37 // See bug for more details: crbug.com/353716. 42 // See bug for more details: crbug.com/353716.
38 InterpolationQuality interpolationQuality = m_layoutHTMLCanvas.style()->imag eRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaul tInterpolationQuality; 43 InterpolationQuality interpolationQuality = m_layoutHTMLCanvas.style()->imag eRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaul tInterpolationQuality;
39 if (m_layoutHTMLCanvas.style()->imageRendering() == ImageRenderingPixelated) 44 if (m_layoutHTMLCanvas.style()->imageRendering() == ImageRenderingPixelated)
40 interpolationQuality = InterpolationNone; 45 interpolationQuality = InterpolationNone;
41 46
42 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality(); 47 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality();
43 context->setImageInterpolationQuality(interpolationQuality); 48 context->setImageInterpolationQuality(interpolationQuality);
44 toHTMLCanvasElement(m_layoutHTMLCanvas.node())->paint(context, paintRect); 49 toHTMLCanvasElement(m_layoutHTMLCanvas.node())->paint(context, paintRect);
45 context->setImageInterpolationQuality(previousInterpolationQuality); 50 context->setImageInterpolationQuality(previousInterpolationQuality);
46 51
47 if (clip) 52 if (clip)
48 context->restore(); 53 context->restore();
49 } 54 }
50 55
51 } // namespace blink 56 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/BoxPainter.cpp ('k') | Source/platform/graphics/paint/DisplayItemList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698