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 { FullyInPaintRectOrDoesNotMatter, NotFullyInPaintRect }; |
| 26 |
25 DeprecatedPaintLayerPainter(DeprecatedPaintLayer& paintLayer) : m_paintLayer
(paintLayer) { } | 27 DeprecatedPaintLayerPainter(DeprecatedPaintLayer& paintLayer) : m_paintLayer
(paintLayer) { } |
26 | 28 |
27 // The paint() method paints the layers that intersect the damage rect from
back to front. | 29 // 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. | 30 // 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); | 31 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. | 32 // 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); | 33 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. | 34 // 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); | 35 PaintResult paintLayerContents(GraphicsContext*, const DeprecatedPaintLayerP
aintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments); |
34 | 36 |
35 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect,
const GlobalPaintFlags, LayoutObject* paintingRoot = 0); | 37 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect,
const GlobalPaintFlags, LayoutObject* paintingRoot = 0); |
36 | 38 |
37 private: | 39 private: |
38 enum ClipState { HasNotClipped, HasClipped }; | 40 enum ClipState { HasNotClipped, HasClipped }; |
39 | 41 |
40 void paintLayerContentsAndReflection(GraphicsContext*, const DeprecatedPaint
LayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments); | 42 PaintResult paintLayerInternal(GraphicsContext*, const DeprecatedPaintLayerP
aintingInfo&, PaintLayerFlags); |
41 void paintLayerWithTransform(GraphicsContext*, const DeprecatedPaintLayerPai
ntingInfo&, PaintLayerFlags); | 43 PaintResult paintLayerContentsAndReflection(GraphicsContext*, const Deprecat
edPaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragme
nts); |
42 void paintFragmentByApplyingTransform(GraphicsContext*, const DeprecatedPain
tLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslation); | 44 PaintResult paintLayerWithTransform(GraphicsContext*, const DeprecatedPaintL
ayerPaintingInfo&, PaintLayerFlags); |
| 45 PaintResult paintFragmentByApplyingTransform(GraphicsContext*, const Depreca
tedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslat
ion); |
43 | 46 |
44 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const Depreca
tedPaintLayerPaintingInfo&, PaintLayerFlags); | 47 PaintResult paintChildren(unsigned childrenToVisit, GraphicsContext*, const
DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags); |
45 bool atLeastOneFragmentIntersectsDamageRect(DeprecatedPaintLayerFragments&,
const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& off
setFromRoot); | 48 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); | 49 void paintFragmentWithPhase(PaintPhase, const DeprecatedPaintLayerFragment&,
GraphicsContext*, const ClipRect&, const DeprecatedPaintLayerPaintingInfo&, Lay
outObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState); |
47 void paintBackgroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, | 50 void paintBackgroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, |
48 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags); | 51 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags); |
49 void paintForegroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, | 52 void paintForegroundForFragments(const DeprecatedPaintLayerFragments&, Graph
icsContext*, |
50 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, | 53 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayer
PaintingInfo&, LayoutObject* paintingRootForLayoutObject, |
51 bool selectionOnly, PaintLayerFlags); | 54 bool selectionOnly, PaintLayerFlags); |
52 void paintForegroundForFragmentsWithPhase(PaintPhase, const DeprecatedPaintL
ayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, Layou
tObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState); | 55 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); | 56 void paintOutlineForFragments(const DeprecatedPaintLayerFragments&, Graphics
Context*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootFor
LayoutObject, PaintLayerFlags); |
54 void paintOverflowControlsForFragments(const DeprecatedPaintLayerFragments&,
GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags); | 57 void paintOverflowControlsForFragments(const DeprecatedPaintLayerFragments&,
GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags); |
55 void paintMaskForFragments(const DeprecatedPaintLayerFragments&, GraphicsCon
text*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLay
outObject, PaintLayerFlags); | 58 void paintMaskForFragments(const DeprecatedPaintLayerFragments&, GraphicsCon
text*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLay
outObject, PaintLayerFlags); |
56 void paintChildClippingMaskForFragments(const DeprecatedPaintLayerFragments&
, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paint
ingRootForLayoutObject, PaintLayerFlags); | 59 void paintChildClippingMaskForFragments(const DeprecatedPaintLayerFragments&
, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paint
ingRootForLayoutObject, PaintLayerFlags); |
57 | 60 |
58 static bool needsToClip(const DeprecatedPaintLayerPaintingInfo& localPaintin
gInfo, const ClipRect&); | 61 static bool needsToClip(const DeprecatedPaintLayerPaintingInfo& localPaintin
gInfo, const ClipRect&); |
59 | 62 |
60 // Returns whether this layer should be painted during sofware painting (i.e
., not via calls from CompositedDeprecatedPaintLayerMapping to draw into composi
ted | 63 // Returns whether this layer should be painted during sofware painting (i.e
., not via calls from CompositedDeprecatedPaintLayerMapping to draw into composi
ted |
61 // layers). | 64 // layers). |
62 bool shouldPaintLayerInSoftwareMode(const GlobalPaintFlags, PaintLayerFlags
paintFlags); | 65 bool shouldPaintLayerInSoftwareMode(const GlobalPaintFlags, PaintLayerFlags
paintFlags); |
63 | 66 |
64 DeprecatedPaintLayer& m_paintLayer; | 67 DeprecatedPaintLayer& m_paintLayer; |
65 }; | 68 }; |
66 | 69 |
67 } // namespace blink | 70 } // namespace blink |
68 | 71 |
69 #endif // DeprecatedPaintLayerPainter_h | 72 #endif // DeprecatedPaintLayerPainter_h |
OLD | NEW |