Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: Source/core/paint/ClipRecorder.h

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix compile Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ClipRecorder_h 5 #ifndef ClipRecorder_h
6 #define ClipRecorder_h 6 #define ClipRecorder_h
7 7
8 #include "core/paint/ViewDisplayList.h" 8 #include "core/paint/ViewDisplayList.h"
9 #include "core/rendering/LayerPaintingInfo.h"
10 #include "core/rendering/PaintPhase.h"
11 #include "core/rendering/RenderLayerModelObject.h" 9 #include "core/rendering/RenderLayerModelObject.h"
10 #include "platform/geometry/LayoutRect.h"
12 #include "platform/geometry/RoundedRect.h" 11 #include "platform/geometry/RoundedRect.h"
13 #include "wtf/Vector.h"
14 12
15 namespace blink { 13 namespace blink {
16 14
17 class ClipRect; 15 class RenderLayerModelObject;
18 class GraphicsContext; 16 struct PaintInfo;
19 17
20 class ClipDisplayItem : public DisplayItem { 18 class ClipDisplayItem : public DisplayItem {
21 public: 19 public:
22 ClipDisplayItem(const RenderLayerModelObject* renderer, Type type, IntRect c lipRect) 20 ClipDisplayItem(const RenderLayerModelObject* renderer, Type type, IntRect c lipRect)
23 : DisplayItem(renderer, type), m_clipRect(clipRect) { } 21 : DisplayItem(renderer, type), m_clipRect(clipRect) { }
24 22
25 Vector<RoundedRect>& roundedRectClips() { return m_roundedRectClips; } 23 Vector<RoundedRect>& roundedRectClips() { return m_roundedRectClips; }
26 virtual void replay(GraphicsContext*) override; 24 virtual void replay(GraphicsContext*) override;
27 25
28 IntRect m_clipRect; 26 IntRect m_clipRect;
29 Vector<RoundedRect> m_roundedRectClips; 27 Vector<RoundedRect> m_roundedRectClips;
30 #ifndef NDEBUG 28 #ifndef NDEBUG
31 virtual WTF::String asDebugString() const override; 29 virtual WTF::String asDebugString() const override;
32 #endif 30 #endif
33 }; 31 };
34 32
35 class EndClipDisplayItem : public DisplayItem { 33 class EndClipDisplayItem : public DisplayItem {
36 public: 34 public:
37 EndClipDisplayItem(const RenderLayerModelObject* renderer) : DisplayItem(ren derer, EndClip) { } 35 EndClipDisplayItem(const RenderLayerModelObject* renderer) : DisplayItem(ren derer, EndClip) { }
38 36
39 virtual void replay(GraphicsContext*) override; 37 virtual void replay(GraphicsContext*) override;
40 }; 38 };
41 39
42 class ClipRecorder { 40 class ClipRecorder {
43 public: 41 public:
44 42 ClipRecorder(RenderLayerModelObject&, const PaintInfo&, const LayoutRect& cl ipRect);
45 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelf ForBorderRadius };
46
47 // Set rounded clip rectangles defined by border radii all the way from the LayerPaintingInfo
48 // "root" layer down to the specified layer (or the parent of said layer, in case
49 // BorderRadiusClippingRule says to skip self). fragmentOffset is used for m ulticol, to specify
50 // the translation required to get from flow thread coordinates to visual co ordinates for a
51 // certain column.
52 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If w e want to skip self,
53 // why not just supply the parent layer as the first parameter instead?
54 // FIXME: The ClipRect passed is in visual coordinates (not flow thread coor dinates), but at the
55 // same time we pass a fragmentOffset, so that we can translate from flow th read coordinates to
56 // visual coordinates. This may look rather confusing/redundant, but it is n eeded for rounded
57 // border clipping. Would be nice to clean up this.
58 explicit ClipRecorder(const RenderLayerModelObject*, GraphicsContext*, Displ ayItem::Type, const ClipRect&, const LayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags, BorderRadiusClippingRule = Includ eSelfForBorderRadius);
59
60 ~ClipRecorder(); 43 ~ClipRecorder();
61 44
45 static DisplayItem::Type paintPhaseToClipType(PaintPhase);
62 private: 46 private:
63 47 LayoutRect m_clipRect;
64 void collectRoundedRectClips(RenderLayer&, const LayerPaintingInfo& localPai ntingInfo, GraphicsContext*, const LayoutPoint& fragmentOffset, PaintLayerFlags, 48 const PaintInfo& m_paintInfo;
65 BorderRadiusClippingRule, Vector<RoundedRect>& roundedRectClips); 49 RenderLayerModelObject& m_canvas;
66
67 GraphicsContext* m_graphicsContext;
68 const RenderLayerModelObject* m_renderer;
69 }; 50 };
70 51
71 } // namespace blink 52 } // namespace blink
72 53
73 #endif // ViewDisplayList_h 54 #endif // ClipRecorder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698