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 #ifndef DeprecatedPaintLayerPainter_h | 5 #ifndef DeprecatedPaintLayerPainter_h |
6 #define DeprecatedPaintLayerPainter_h | 6 #define DeprecatedPaintLayerPainter_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/paint/DeprecatedPaintLayerFragment.h" | 9 #include "core/paint/DeprecatedPaintLayerFragment.h" |
10 #include "core/paint/DeprecatedPaintLayerPaintingInfo.h" | 10 #include "core/paint/DeprecatedPaintLayerPaintingInfo.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class ClipRect; | 15 class ClipRect; |
16 class DeprecatedPaintLayer; | 16 class DeprecatedPaintLayer; |
17 class GraphicsContext; | 17 class GraphicsContext; |
18 class LayoutPoint; | 18 class LayoutPoint; |
19 | 19 |
20 class CORE_EXPORT DeprecatedPaintLayerPainter { | 20 class CORE_EXPORT DeprecatedPaintLayerPainter { |
21 STACK_ALLOCATED(); | 21 STACK_ALLOCATED(); |
22 public: | 22 public: |
23 enum FragmentPolicy { AllowMultipleFragments, ForceSingleFragment }; | 23 enum FragmentPolicy { AllowMultipleFragments, ForceSingleFragment }; |
24 | 24 |
| 25 enum PaintResult { |
| 26 // The layer is fully painted. This includes cases that nothing needs pa
inting |
| 27 // regardless of the paint rect. |
| 28 FullyPainted, |
| 29 // Some part of the layer is out of the paint rect and may be not fully
painted. |
| 30 // The results cannot be cached because they may change when paint rect
changes. |
| 31 MaybeNotFullyPainted |
| 32 }; |
| 33 |
25 DeprecatedPaintLayerPainter(DeprecatedPaintLayer& paintLayer) : m_paintLayer
(paintLayer) { } | 34 DeprecatedPaintLayerPainter(DeprecatedPaintLayer& paintLayer) : m_paintLayer
(paintLayer) { } |
26 | 35 |
27 // The paint() method paints the layers that intersect the damage rect from
back to front. | 36 // The paint() method paints the layers that intersect the damage rect from
back to front. |
28 // paint() assumes that the caller will clip to the bounds of damageRect if
necessary. | 37 // paint() assumes that the caller will clip to the bounds of damageRect if
necessary. |
29 void paint(GraphicsContext*, const LayoutRect& damageRect, const GlobalPaint
Flags = GlobalPaintNormalPhase, LayoutObject* paintingRoot = 0, PaintLayerFlags
= 0); | 38 void paint(GraphicsContext*, const LayoutRect& damageRect, const GlobalPaint
Flags = GlobalPaintNormalPhase, LayoutObject* paintingRoot = 0, PaintLayerFlags
= 0); |
30 // paintLayer() assumes that the caller will clip to the bounds of the paint
ing dirty if necessary. | 39 // paintLayer() assumes that the caller will clip to the bounds of the paint
ing dirty if necessary. |
31 void paintLayer(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, P
aintLayerFlags); | 40 PaintResult paintLayer(GraphicsContext*, const DeprecatedPaintLayerPaintingI
nfo&, PaintLayerFlags); |
32 // paintLayerContents() assumes that the caller will clip to the bounds of t
he painting dirty rect if necessary. | 41 // paintLayerContents() assumes that the caller will clip to the bounds of t
he painting dirty rect if necessary. |
33 void paintLayerContents(GraphicsContext*, const DeprecatedPaintLayerPainting
Info&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments); | 42 PaintResult paintLayerContents(GraphicsContext*, const DeprecatedPaintLayerP
aintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments); |
34 | 43 |
35 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect,
const GlobalPaintFlags, LayoutObject* paintingRoot = 0); | 44 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect,
const GlobalPaintFlags, LayoutObject* paintingRoot = 0); |
36 | 45 |
37 private: | 46 private: |
38 enum ClipState { HasNotClipped, HasClipped }; | 47 enum ClipState { HasNotClipped, HasClipped }; |
39 | 48 |
40 void paintLayerContentsAndReflection(GraphicsContext*, const DeprecatedPaint
LayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments); | 49 PaintResult paintLayerInternal(GraphicsContext*, const DeprecatedPaintLayerP
aintingInfo&, PaintLayerFlags); |
41 void paintLayerWithTransform(GraphicsContext*, const DeprecatedPaintLayerPai
ntingInfo&, PaintLayerFlags); | 50 PaintResult paintLayerContentsAndReflection(GraphicsContext*, const Deprecat
edPaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragme
nts); |
42 void paintFragmentByApplyingTransform(GraphicsContext*, const DeprecatedPain
tLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslation); | 51 PaintResult paintLayerWithTransform(GraphicsContext*, const DeprecatedPaintL
ayerPaintingInfo&, PaintLayerFlags); |
| 52 PaintResult paintFragmentByApplyingTransform(GraphicsContext*, const Depreca
tedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslat
ion); |
43 | 53 |
44 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const Depreca
tedPaintLayerPaintingInfo&, PaintLayerFlags); | 54 PaintResult paintChildren(unsigned childrenToVisit, GraphicsContext*, const
DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags); |
45 bool atLeastOneFragmentIntersectsDamageRect(DeprecatedPaintLayerFragments&,
const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& off
setFromRoot); | 55 bool atLeastOneFragmentIntersectsDamageRect(DeprecatedPaintLayerFragments&,
const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& off
setFromRoot); |
46 void paintFragmentWithPhase(PaintPhase, const DeprecatedPaintLayerFragment&,
GraphicsContext*, const ClipRect&, const DeprecatedPaintLayerPaintingInfo&, Lay
outObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState); | 56 void paintFragmentWithPhase(PaintPhase, const DeprecatedPaintLayerFragment&,
GraphicsContext*, const ClipRect&, const DeprecatedPaintLayerPaintingInfo&, Lay
outObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState); |
47 void paintBackgroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, | 57 void paintBackgroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, |
48 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags); | 58 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags); |
49 void paintForegroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, | 59 void paintForegroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, |
50 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, | 60 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, |
51 bool selectionOnly, PaintLayerFlags); | 61 bool selectionOnly, PaintLayerFlags); |
52 void paintForegroundForFragmentsWithPhase(PaintPhase, const DeprecatedPaintL
ayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, Layou
tObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState); | 62 void paintForegroundForFragmentsWithPhase(PaintPhase, const DeprecatedPaintL
ayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, Layou
tObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState); |
53 void paintOutlineForFragments(const DeprecatedPaintLayerFragments&, Graphics
Context*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootFor
LayoutObject, PaintLayerFlags); | 63 void paintOutlineForFragments(const DeprecatedPaintLayerFragments&, Graphics
Context*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootFor
LayoutObject, PaintLayerFlags); |
54 void paintOverflowControlsForFragments(const DeprecatedPaintLayerFragments&,
GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags); | 64 void paintOverflowControlsForFragments(const DeprecatedPaintLayerFragments&,
GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags); |
55 void paintMaskForFragments(const DeprecatedPaintLayerFragments&, GraphicsCon
text*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLay
outObject, PaintLayerFlags); | 65 void paintMaskForFragments(const DeprecatedPaintLayerFragments&, GraphicsCon
text*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLay
outObject, PaintLayerFlags); |
56 void paintChildClippingMaskForFragments(const DeprecatedPaintLayerFragments&
, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paint
ingRootForLayoutObject, PaintLayerFlags); | 66 void paintChildClippingMaskForFragments(const DeprecatedPaintLayerFragments&
, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paint
ingRootForLayoutObject, PaintLayerFlags); |
57 | 67 |
58 static bool needsToClip(const DeprecatedPaintLayerPaintingInfo& localPaintin
gInfo, const ClipRect&); | 68 static bool needsToClip(const DeprecatedPaintLayerPaintingInfo& localPaintin
gInfo, const ClipRect&); |
59 | 69 |
60 // Returns whether this layer should be painted during sofware painting (i.e
., not via calls from CompositedDeprecatedPaintLayerMapping to draw into composi
ted | 70 // Returns whether this layer should be painted during sofware painting (i.e
., not via calls from CompositedDeprecatedPaintLayerMapping to draw into composi
ted |
61 // layers). | 71 // layers). |
62 bool shouldPaintLayerInSoftwareMode(const GlobalPaintFlags, PaintLayerFlags
paintFlags); | 72 bool shouldPaintLayerInSoftwareMode(const GlobalPaintFlags, PaintLayerFlags
paintFlags); |
63 | 73 |
64 DeprecatedPaintLayer& m_paintLayer; | 74 DeprecatedPaintLayer& m_paintLayer; |
65 }; | 75 }; |
66 | 76 |
67 } // namespace blink | 77 } // namespace blink |
68 | 78 |
69 #endif // DeprecatedPaintLayerPainter_h | 79 #endif // DeprecatedPaintLayerPainter_h |
OLD | NEW |