OLD | NEW |
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 "core/paint/HTMLCanvasPainter.h" | 5 #include "core/paint/HTMLCanvasPainter.h" |
6 | 6 |
7 #include "core/html/HTMLCanvasElement.h" | 7 #include "core/html/HTMLCanvasElement.h" |
8 #include "core/html/canvas/CanvasRenderingContext.h" | 8 #include "core/html/canvas/CanvasRenderingContext.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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 LayoutRect contentRect = m_layoutHTMLCanvas.contentBoxRect(); | 22 LayoutRect contentRect = m_layoutHTMLCanvas.contentBoxRect(); |
23 contentRect.moveBy(paintOffset); | 23 contentRect.moveBy(paintOffset); |
24 LayoutRect paintRect = m_layoutHTMLCanvas.replacedContentRect(); | 24 LayoutRect paintRect = m_layoutHTMLCanvas.replacedContentRect(); |
25 paintRect.moveBy(paintOffset); | 25 paintRect.moveBy(paintOffset); |
26 | 26 |
27 HTMLCanvasElement* canvas = toHTMLCanvasElement(m_layoutHTMLCanvas.node()); | 27 HTMLCanvasElement* canvas = toHTMLCanvasElement(m_layoutHTMLCanvas.node()); |
28 | 28 |
29 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 29 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
30 canvas->renderingContext() && | 30 canvas->renderingContext() && |
31 canvas->renderingContext()->isAccelerated()) { | 31 canvas->renderingContext()->isComposited()) { |
32 if (WebLayer* layer = canvas->renderingContext()->platformLayer()) { | 32 if (WebLayer* layer = canvas->renderingContext()->platformLayer()) { |
33 IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect); | 33 IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect); |
34 recordForeignLayer(context, m_layoutHTMLCanvas, | 34 recordForeignLayer(context, m_layoutHTMLCanvas, |
35 DisplayItem::kForeignLayerCanvas, layer, | 35 DisplayItem::kForeignLayerCanvas, layer, |
36 pixelSnappedRect.location(), pixelSnappedRect.size()); | 36 pixelSnappedRect.location(), pixelSnappedRect.size()); |
37 return; | 37 return; |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 41 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
(...skipping 24 matching lines...) Expand all Loading... |
66 context.imageInterpolationQuality(); | 66 context.imageInterpolationQuality(); |
67 context.setImageInterpolationQuality(interpolationQuality); | 67 context.setImageInterpolationQuality(interpolationQuality); |
68 canvas->paint(context, paintRect); | 68 canvas->paint(context, paintRect); |
69 context.setImageInterpolationQuality(previousInterpolationQuality); | 69 context.setImageInterpolationQuality(previousInterpolationQuality); |
70 | 70 |
71 if (clip) | 71 if (clip) |
72 context.restore(); | 72 context.restore(); |
73 } | 73 } |
74 | 74 |
75 } // namespace blink | 75 } // namespace blink |
OLD | NEW |