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

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

Issue 653303003: Generalize paint chunks to clips, and implement clips in LayerPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 2 months 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 ViewDisplayList_h 5 #ifndef ViewDisplayList_h
6 #define ViewDisplayList_h 6 #define ViewDisplayList_h
7 7
8 #include "core/rendering/PaintPhase.h" 8 #include "core/rendering/PaintPhase.h"
9 #include "platform/geometry/RoundedRect.h"
9 #include "platform/graphics/DisplayList.h" 10 #include "platform/graphics/DisplayList.h"
10 #include "wtf/HashSet.h" 11 #include "wtf/HashSet.h"
11 #include "wtf/OwnPtr.h" 12 #include "wtf/OwnPtr.h"
12 #include "wtf/Vector.h" 13 #include "wtf/Vector.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class GraphicsContext; 17 class GraphicsContext;
17 class RenderObject; 18 class RenderObject;
19 class RenderLayer;
18 struct AtomicPaintChunk; 20 struct AtomicPaintChunk;
19 21
20 typedef Vector<OwnPtr<AtomicPaintChunk> > PaintCommandList;
21 22
22 struct AtomicPaintChunk { 23 struct DisplayItem {
24 virtual void replay(GraphicsContext*) = 0;
25
26 virtual ~DisplayItem() { }
27 };
28
29 struct ClipDisplayItem : DisplayItem {
30 RenderLayer* layer;
31 enum ClipType {
32 LayerOverflowControls,
33 LayerBackground,
34 LayerParent,
35 LayerFilter,
36 LayerForeground,
37 LayerFragmentFloat,
38 LayerFragmentForeground,
39 LayerFragmentChildOutline,
40 LayerFragmentOutline,
41 LayerFragmentMask,
42 LayerFragmentClippingMask,
43 LayerFragmentParent
44 };
45 ClipType clipType;
46 IntRect clipRect;
47 Vector<RoundedRect> roundedRectClips;
48
49 virtual void replay(GraphicsContext*);
50 };
51
52 struct EndClipDisplayItem : DisplayItem {
53 RenderLayer* layer;
54 virtual void replay(GraphicsContext*);
55 };
56
57 struct AtomicPaintChunk : DisplayItem {
23 AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRend erer, PaintPhase inPhase) 58 AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRend erer, PaintPhase inPhase)
24 : displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { }; 59 : displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { };
25 60
26 RefPtr<DisplayList> displayList; 61 RefPtr<DisplayList> displayList;
27 62
28 // This auxillary data can be moved off the chunk if needed. 63 // This auxillary data can be moved off the chunk if needed.
29 RenderObject* renderer; 64 RenderObject* renderer;
30 PaintPhase phase; 65 PaintPhase phase;
66
67 virtual void replay(GraphicsContext*);
31 }; 68 };
32 69
70 typedef Vector<OwnPtr<DisplayItem> > PaintList;
71
33 class PaintCommandRecorder { 72 class PaintCommandRecorder {
34 public: 73 public:
35 explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, c onst FloatRect&); 74 explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, c onst FloatRect&);
36 ~PaintCommandRecorder(); 75 ~PaintCommandRecorder();
37 76
38 private: 77 private:
39 GraphicsContext* m_context; 78 GraphicsContext* m_context;
40 RenderObject* m_renderer; 79 RenderObject* m_renderer;
41 PaintPhase m_phase; 80 PaintPhase m_phase;
42 }; 81 };
43 82
83 class PaintClipRecorder {
84 public:
85 explicit PaintClipRecorder(RenderLayer*, ClipDisplayItem::ClipType);
86 void setClipRect(IntRect);
87 void addRoundedRectClip(const RoundedRect&);
88 void startClip();
89 void endClip();
90
91 private:
92 OwnPtr<ClipDisplayItem> clipDisplayItem;
93 #ifdef ASSERT_ENABLED
94 bool m_started, m_ended;
95 #endif
96 };
97
44 class ViewDisplayList { 98 class ViewDisplayList {
45 public: 99 public:
46 ViewDisplayList() { }; 100 ViewDisplayList() { };
47 101
48 const PaintCommandList& paintCommandList(); 102 const PaintList& paintList();
49 void add(WTF::PassOwnPtr<AtomicPaintChunk>); 103 void add(WTF::PassOwnPtr<DisplayItem>);
50 void invalidate(const RenderObject*); 104 void invalidate(const RenderObject*);
51 105
52 private: 106 private:
53 bool isRepaint(PaintCommandList::iterator, const AtomicPaintChunk&); 107 bool isRepaint(PaintList::iterator, const DisplayItem&);
54 // Update m_paintList with any invalidations or new paints. 108 // Update m_paintList with any invalidations or new paints.
55 void updatePaintCommandList(); 109 void updatePaintList();
56 110
57 PaintCommandList m_paintList; 111 PaintList m_paintList;
58 HashSet<const RenderObject*> m_invalidated; 112 HashSet<const RenderObject*> m_invalidated;
59 PaintCommandList m_newPaints; 113 PaintList m_newPaints;
60 }; 114 };
61 115
62 } // namespace blink 116 } // namespace blink
63 117
64 #endif // ViewDisplayList_h 118 #endif // ViewDisplayList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698