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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/ReplicaPainter.h" | 6 #include "core/paint/ReplicaPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutReplica.h" | 8 #include "core/layout/LayoutReplica.h" |
9 #include "core/paint/DeprecatedPaintLayer.h" | 9 #include "core/paint/DeprecatedPaintLayer.h" |
10 #include "core/paint/DeprecatedPaintLayerPainter.h" | 10 #include "core/paint/DeprecatedPaintLayerPainter.h" |
11 #include "core/paint/GraphicsContextAnnotator.h" | |
12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 11 #include "core/paint/LayoutObjectDrawingRecorder.h" |
13 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
17 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 16 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
18 { | 17 { |
19 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_layoutReplica); | |
20 | |
21 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Mask) | 18 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Mask) |
22 return; | 19 return; |
23 | 20 |
24 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplica.location(); | 21 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplica.location(); |
25 | 22 |
26 if (paintInfo.phase == PaintPhaseForeground) { | 23 if (paintInfo.phase == PaintPhaseForeground) { |
27 // Turn around and paint the parent layer. Use temporary clipRects, so t
hat the layer doesn't end up caching clip rects | 24 // Turn around and paint the parent layer. Use temporary clipRects, so t
hat the layer doesn't end up caching clip rects |
28 // computing using the wrong rootLayer | 25 // computing using the wrong rootLayer |
29 DeprecatedPaintLayer* rootPaintingLayer = m_layoutReplica.layer()->trans
form() ? m_layoutReplica.layer()->parent() : m_layoutReplica.layer()->enclosingT
ransformedAncestor(); | 26 DeprecatedPaintLayer* rootPaintingLayer = m_layoutReplica.layer()->trans
form() ? m_layoutReplica.layer()->parent() : m_layoutReplica.layer()->enclosingT
ransformedAncestor(); |
30 DeprecatedPaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutR
ect(paintInfo.rect), PaintBehaviorNormal, LayoutSize(), 0); | 27 DeprecatedPaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutR
ect(paintInfo.rect), PaintBehaviorNormal, LayoutSize(), 0); |
31 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr
ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; | 28 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr
ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; |
32 DeprecatedPaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLay
er(paintInfo.context, paintingInfo, flags); | 29 DeprecatedPaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLay
er(paintInfo.context, paintingInfo, flags); |
33 } else if (paintInfo.phase == PaintPhaseMask) { | 30 } else if (paintInfo.phase == PaintPhaseMask) { |
34 LayoutRect paintRect(adjustedPaintOffset, m_layoutReplica.size()); | 31 LayoutRect paintRect(adjustedPaintOffset, m_layoutReplica.size()); |
35 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout
Replica, paintInfo.phase, paintRect); | 32 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout
Replica, paintInfo.phase, paintRect); |
36 if (!drawingRecorder.canUseCachedDrawing()) | 33 if (!drawingRecorder.canUseCachedDrawing()) |
37 m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset); | 34 m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset); |
38 } | 35 } |
39 } | 36 } |
40 | 37 |
41 } // namespace blink | 38 } // namespace blink |
OLD | NEW |