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

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: Fix 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
« no previous file with comments | « Source/core/paint/LayerPainter.cpp ('k') | Source/core/paint/ViewDisplayList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
17 class ClipRect;
16 class GraphicsContext; 18 class GraphicsContext;
17 class RenderObject; 19 class RenderObject;
20 class RenderLayer;
18 struct AtomicPaintChunk; 21 struct AtomicPaintChunk;
19 22
20 typedef Vector<OwnPtr<AtomicPaintChunk> > PaintCommandList;
21 23
22 struct AtomicPaintChunk { 24 struct DisplayItem {
25 virtual void replay(GraphicsContext*) = 0;
26
27 virtual ~DisplayItem() { }
28 };
29
30 struct ClipDisplayItem : DisplayItem {
31 RenderLayer* layer;
32 enum ClipType {
33 LayerOverflowControls,
34 LayerBackground,
35 LayerParent,
36 LayerFilter,
37 LayerForeground,
38 LayerFragmentFloat,
39 LayerFragmentForeground,
40 LayerFragmentChildOutline,
41 LayerFragmentOutline,
42 LayerFragmentMask,
43 LayerFragmentClippingMask,
44 LayerFragmentParent,
45 LayerFragmentSelection,
46 LayerFragmentChildBlockBackgrounds
47 };
48 ClipType clipType;
49 IntRect clipRect;
50 Vector<RoundedRect> roundedRectClips;
51
52 virtual void replay(GraphicsContext*);
53 };
54
55 struct EndClipDisplayItem : DisplayItem {
56 RenderLayer* layer;
57 virtual void replay(GraphicsContext*);
58 };
59
60 struct AtomicPaintChunk : DisplayItem {
23 AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRend erer, PaintPhase inPhase) 61 AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRend erer, PaintPhase inPhase)
24 : displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { }; 62 : displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { };
25 63
26 RefPtr<DisplayList> displayList; 64 RefPtr<DisplayList> displayList;
27 65
28 // This auxillary data can be moved off the chunk if needed. 66 // This auxillary data can be moved off the chunk if needed.
29 RenderObject* renderer; 67 RenderObject* renderer;
30 PaintPhase phase; 68 PaintPhase phase;
69
70 virtual void replay(GraphicsContext*);
31 }; 71 };
32 72
73 typedef Vector<OwnPtr<DisplayItem> > PaintList;
74
33 class PaintCommandRecorder { 75 class PaintCommandRecorder {
34 public: 76 public:
35 explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, c onst FloatRect&); 77 explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, c onst FloatRect&);
36 ~PaintCommandRecorder(); 78 ~PaintCommandRecorder();
37 79
38 private: 80 private:
39 GraphicsContext* m_context; 81 GraphicsContext* m_context;
40 RenderObject* m_renderer; 82 RenderObject* m_renderer;
41 PaintPhase m_phase; 83 PaintPhase m_phase;
42 }; 84 };
43 85
86 class ClipRecorder {
87 public:
88 explicit ClipRecorder(RenderLayer*, GraphicsContext*, ClipDisplayItem::ClipT ype, const ClipRect&);
89 void addRoundedRectClip(const RoundedRect&);
90
91 ~ClipRecorder();
92
93 private:
94 OwnPtr<ClipDisplayItem> m_clipDisplayItem;
95 GraphicsContext* m_graphicsContext;
96 RenderLayer* m_renderLayer;
97 };
98
44 class ViewDisplayList { 99 class ViewDisplayList {
45 public: 100 public:
46 ViewDisplayList() { }; 101 ViewDisplayList() { };
47 102
48 const PaintCommandList& paintCommandList(); 103 const PaintList& paintList();
49 void add(WTF::PassOwnPtr<AtomicPaintChunk>); 104 void add(WTF::PassOwnPtr<DisplayItem>);
50 void invalidate(const RenderObject*); 105 void invalidate(const RenderObject*);
51 106
52 private: 107 private:
53 bool isRepaint(PaintCommandList::iterator, const AtomicPaintChunk&); 108 bool isRepaint(PaintList::iterator, const DisplayItem&);
54 // Update m_paintList with any invalidations or new paints. 109 // Update m_paintList with any invalidations or new paints.
55 void updatePaintCommandList(); 110 void updatePaintList();
56 111
57 PaintCommandList m_paintList; 112 PaintList m_paintList;
58 HashSet<const RenderObject*> m_invalidated; 113 HashSet<const RenderObject*> m_invalidated;
59 PaintCommandList m_newPaints; 114 PaintList m_newPaints;
60 }; 115 };
61 116
62 } // namespace blink 117 } // namespace blink
63 118
64 #endif // ViewDisplayList_h 119 #endif // ViewDisplayList_h
OLDNEW
« no previous file with comments | « Source/core/paint/LayerPainter.cpp ('k') | Source/core/paint/ViewDisplayList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698