| 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" | 
| 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/ForeignLayerDisplayItem.h" | 13 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" | 
| 14 | 14 | 
| 15 namespace blink { | 15 namespace blink { | 
| 16 | 16 | 
| 17 void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, | 17 void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, | 
| 18                                       const LayoutPoint& paintOffset) { | 18                                       const LayoutPoint& paintOffset) { | 
| 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   HTMLCanvasElement* canvas = toHTMLCanvasElement(m_layoutHTMLCanvas.node()); | 26   HTMLCanvasElement* canvas = toHTMLCanvasElement(m_layoutHTMLCanvas.node()); | 
| 27 | 27 | 
| 28   if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 28   if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 
| 29       canvas->renderingContext() && | 29       canvas->renderingContext() && | 
| 30       canvas->renderingContext()->isAccelerated()) { | 30       canvas->renderingContext()->isComposited()) { | 
| 31     if (WebLayer* layer = canvas->renderingContext()->platformLayer()) { | 31     if (WebLayer* layer = canvas->renderingContext()->platformLayer()) { | 
| 32       IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect); | 32       IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect); | 
| 33       recordForeignLayer(context, m_layoutHTMLCanvas, | 33       recordForeignLayer(context, m_layoutHTMLCanvas, | 
| 34                          DisplayItem::kForeignLayerCanvas, layer, | 34                          DisplayItem::kForeignLayerCanvas, layer, | 
| 35                          pixelSnappedRect.location(), pixelSnappedRect.size()); | 35                          pixelSnappedRect.location(), pixelSnappedRect.size()); | 
| 36       return; | 36       return; | 
| 37     } | 37     } | 
| 38   } | 38   } | 
| 39 | 39 | 
| 40   if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 40   if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 65       context.imageInterpolationQuality(); | 65       context.imageInterpolationQuality(); | 
| 66   context.setImageInterpolationQuality(interpolationQuality); | 66   context.setImageInterpolationQuality(interpolationQuality); | 
| 67   canvas->paint(context, paintRect); | 67   canvas->paint(context, paintRect); | 
| 68   context.setImageInterpolationQuality(previousInterpolationQuality); | 68   context.setImageInterpolationQuality(previousInterpolationQuality); | 
| 69 | 69 | 
| 70   if (clip) | 70   if (clip) | 
| 71     context.restore(); | 71     context.restore(); | 
| 72 } | 72 } | 
| 73 | 73 | 
| 74 }  // namespace blink | 74 }  // namespace blink | 
| OLD | NEW | 
|---|