| 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 LayerPainter_h | 5 #ifndef LayerPainter_h |
| 6 #define LayerPainter_h | 6 #define LayerPainter_h |
| 7 | 7 |
| 8 #include "core/layout/LayerFragment.h" | 8 #include "core/layout/LayerFragment.h" |
| 9 #include "core/layout/LayerPaintingInfo.h" | 9 #include "core/layout/LayerPaintingInfo.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class ClipRect; | 13 class ClipRect; |
| 14 class LayoutPoint; | 14 class LayoutPoint; |
| 15 class Layer; | 15 class Layer; |
| 16 | 16 |
| 17 class LayerPainter { | 17 class LayerPainter { |
| 18 public: | 18 public: |
| 19 LayerPainter(Layer& renderLayer) : m_renderLayer(renderLayer) { } | 19 LayerPainter(Layer& renderLayer) : m_renderLayer(renderLayer) { } |
| 20 | 20 |
| 21 // The paint() method paints the layers that intersect the damage rect from
back to front. | 21 // The paint() method paints the layers that intersect the damage rect from
back to front. |
| 22 // paint() assumes that the caller will clip to the bounds of damageRect if
necessary. | 22 // paint() assumes that the caller will clip to the bounds of damageRect if
necessary. |
| 23 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = P
aintBehaviorNormal, RenderObject* paintingRoot = 0, PaintLayerFlags = 0); | 23 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = P
aintBehaviorNormal, LayoutObject* paintingRoot = 0, PaintLayerFlags = 0); |
| 24 // paintLayer() assumes that the caller will clip to the bounds of the paint
ing dirty if necessary. | 24 // paintLayer() assumes that the caller will clip to the bounds of the paint
ing dirty if necessary. |
| 25 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; | 25 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; |
| 26 // paintLayerContents() assumes that the caller will clip to the bounds of t
he painting dirty rect if necessary. | 26 // paintLayerContents() assumes that the caller will clip to the bounds of t
he painting dirty rect if necessary. |
| 27 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay
erFlags); | 27 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay
erFlags); |
| 28 | 28 |
| 29 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect,
PaintBehavior, RenderObject* paintingRoot = 0); | 29 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect,
PaintBehavior, LayoutObject* paintingRoot = 0); |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 enum ClipState { HasNotClipped, HasClipped }; | 32 enum ClipState { HasNotClipped, HasClipped }; |
| 33 | 33 |
| 34 void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingIn
fo&, PaintLayerFlags); | 34 void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingIn
fo&, PaintLayerFlags); |
| 35 void paintLayerWithTransform(GraphicsContext*, const LayerPaintingInfo&, Pai
ntLayerFlags); | 35 void paintLayerWithTransform(GraphicsContext*, const LayerPaintingInfo&, Pai
ntLayerFlags); |
| 36 void paintFragmentByApplyingTransform(GraphicsContext*, const LayerPaintingI
nfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslation); | 36 void paintFragmentByApplyingTransform(GraphicsContext*, const LayerPaintingI
nfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslation); |
| 37 | 37 |
| 38 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa
intingInfo&, PaintLayerFlags); | 38 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa
intingInfo&, PaintLayerFlags); |
| 39 void paintPaginatedChildLayer(Layer* childLayer, GraphicsContext*, const Lay
erPaintingInfo&, PaintLayerFlags); | 39 void paintPaginatedChildLayer(Layer* childLayer, GraphicsContext*, const Lay
erPaintingInfo&, PaintLayerFlags); |
| 40 void paintChildLayerIntoColumns(Layer* childLayer, GraphicsContext*, const L
ayerPaintingInfo&, PaintLayerFlags, const Vector<Layer*>& columnLayers, size_t c
olumnIndex); | 40 void paintChildLayerIntoColumns(Layer* childLayer, GraphicsContext*, const L
ayerPaintingInfo&, PaintLayerFlags, const Vector<Layer*>& columnLayers, size_t c
olumnIndex); |
| 41 bool atLeastOneFragmentIntersectsDamageRect(LayerFragments&, const LayerPain
tingInfo&, PaintLayerFlags, const LayoutPoint& offsetFromRoot); | 41 bool atLeastOneFragmentIntersectsDamageRect(LayerFragments&, const LayerPain
tingInfo&, PaintLayerFlags, const LayoutPoint& offsetFromRoot); |
| 42 void paintFragmentWithPhase(PaintPhase, const LayerFragment&, GraphicsContex
t*, const ClipRect&, const LayerPaintingInfo&, PaintBehavior, RenderObject* pain
tingRootForRenderer, PaintLayerFlags, ClipState); | 42 void paintFragmentWithPhase(PaintPhase, const LayerFragment&, GraphicsContex
t*, const ClipRect&, const LayerPaintingInfo&, PaintBehavior, LayoutObject* pain
tingRootForRenderer, PaintLayerFlags, ClipState); |
| 43 void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, | 43 void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, |
| 44 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo&,
PaintBehavior, RenderObject* paintingRootForRenderer, PaintLayerFlags); | 44 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo&,
PaintBehavior, LayoutObject* paintingRootForRenderer, PaintLayerFlags); |
| 45 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, | 45 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, |
| 46 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo&,
PaintBehavior, RenderObject* paintingRootForRenderer, | 46 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo&,
PaintBehavior, LayoutObject* paintingRootForRenderer, |
| 47 bool selectionOnly, PaintLayerFlags); | 47 bool selectionOnly, PaintLayerFlags); |
| 48 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&,
GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* painti
ngRootForRenderer, PaintLayerFlags, ClipState); | 48 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&,
GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, LayoutObject* painti
ngRootForRenderer, PaintLayerFlags, ClipState); |
| 49 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const
LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer, Paint
LayerFlags); | 49 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const
LayerPaintingInfo&, PaintBehavior, LayoutObject* paintingRootForRenderer, Paint
LayerFlags); |
| 50 void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContex
t*, const LayerPaintingInfo&, PaintLayerFlags); | 50 void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContex
t*, const LayerPaintingInfo&, PaintLayerFlags); |
| 51 void paintMaskForFragments(const LayerFragments&, GraphicsContext*, const La
yerPaintingInfo&, RenderObject* paintingRootForRenderer, PaintLayerFlags); | 51 void paintMaskForFragments(const LayerFragments&, GraphicsContext*, const La
yerPaintingInfo&, LayoutObject* paintingRootForRenderer, PaintLayerFlags); |
| 52 void paintChildClippingMaskForFragments(const LayerFragments&, GraphicsConte
xt*, const LayerPaintingInfo&, RenderObject* paintingRootForRenderer, PaintLayer
Flags); | 52 void paintChildClippingMaskForFragments(const LayerFragments&, GraphicsConte
xt*, const LayerPaintingInfo&, LayoutObject* paintingRootForRenderer, PaintLayer
Flags); |
| 53 | 53 |
| 54 static bool needsToClip(const LayerPaintingInfo& localPaintingInfo, const Cl
ipRect&); | 54 static bool needsToClip(const LayerPaintingInfo& localPaintingInfo, const Cl
ipRect&); |
| 55 | 55 |
| 56 // Returns whether this layer should be painted during sofware painting (i.e
., not via calls from CompositedLayerMapping to draw into composited | 56 // Returns whether this layer should be painted during sofware painting (i.e
., not via calls from CompositedLayerMapping to draw into composited |
| 57 // layers). | 57 // layers). |
| 58 bool shouldPaintLayerInSoftwareMode(const LayerPaintingInfo&, PaintLayerFlag
s paintFlags); | 58 bool shouldPaintLayerInSoftwareMode(const LayerPaintingInfo&, PaintLayerFlag
s paintFlags); |
| 59 | 59 |
| 60 Layer& m_renderLayer; | 60 Layer& m_renderLayer; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace blink | 63 } // namespace blink |
| 64 | 64 |
| 65 #endif // LayerPainter_h | 65 #endif // LayerPainter_h |
| OLD | NEW |