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

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
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() { }
pdr. 2014/10/16 17:38:12 Why dtor?
chrishtr 2014/10/16 17:43:53 You need a virtual destructor if you have a virtua
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 };
46 ClipType clipType;
47 IntRect clipRect;
48 Vector<RoundedRect> roundedRectClips;
49
50 virtual void replay(GraphicsContext*);
51 };
52
53 struct EndClipDisplayItem : DisplayItem {
54 RenderLayer* layer;
55 virtual void replay(GraphicsContext*);
56 };
57
58 struct AtomicPaintChunk : DisplayItem {
23 AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRend erer, PaintPhase inPhase) 59 AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRend erer, PaintPhase inPhase)
24 : displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { }; 60 : displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { };
25 61
26 RefPtr<DisplayList> displayList; 62 RefPtr<DisplayList> displayList;
27 63
28 // This auxillary data can be moved off the chunk if needed. 64 // This auxillary data can be moved off the chunk if needed.
29 RenderObject* renderer; 65 RenderObject* renderer;
30 PaintPhase phase; 66 PaintPhase phase;
67
68 virtual void replay(GraphicsContext*);
31 }; 69 };
32 70
71 typedef Vector<OwnPtr<DisplayItem> > PaintList;
leviw_travelin_and_unemployed 2014/10/16 17:59:11 I believe we support the magic C++11 ">> in templa
72
33 class PaintCommandRecorder { 73 class PaintCommandRecorder {
34 public: 74 public:
35 explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, c onst FloatRect&); 75 explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, c onst FloatRect&);
36 ~PaintCommandRecorder(); 76 ~PaintCommandRecorder();
37 77
38 private: 78 private:
39 GraphicsContext* m_context; 79 GraphicsContext* m_context;
40 RenderObject* m_renderer; 80 RenderObject* m_renderer;
41 PaintPhase m_phase; 81 PaintPhase m_phase;
42 }; 82 };
43 83
84 class StartClipRecorder {
85 public:
86 explicit StartClipRecorder(RenderLayer*, GraphicsContext*, ClipDisplayItem:: ClipType, const ClipRect&);
87 void addRoundedRectClip(const RoundedRect&);
88
89 private:
90 OwnPtr<ClipDisplayItem> m_clipDisplayItem;
91 GraphicsContext* m_graphicsContext;
92 };
93
94 class EndClipRecorder {
95 public:
96 explicit EndClipRecorder(RenderLayer*, GraphicsContext*);
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

Powered by Google App Engine
This is Rietveld 408576698