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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/ViewDisplayList.h
diff --git a/Source/core/paint/ViewDisplayList.h b/Source/core/paint/ViewDisplayList.h
index 9f6fb5720ba618cb29e97da7705f7cb8f79b0ec0..7eb742876203a8858e586497b3cd8fe44491c9bc 100644
--- a/Source/core/paint/ViewDisplayList.h
+++ b/Source/core/paint/ViewDisplayList.h
@@ -6,6 +6,7 @@
#define ViewDisplayList_h
#include "core/rendering/PaintPhase.h"
+#include "platform/geometry/RoundedRect.h"
#include "platform/graphics/DisplayList.h"
#include "wtf/HashSet.h"
#include "wtf/OwnPtr.h"
@@ -13,13 +14,48 @@
namespace blink {
+class ClipRect;
class GraphicsContext;
class RenderObject;
+class RenderLayer;
struct AtomicPaintChunk;
-typedef Vector<OwnPtr<AtomicPaintChunk> > PaintCommandList;
-struct AtomicPaintChunk {
+struct DisplayItem {
+ virtual void replay(GraphicsContext*) = 0;
+
+ 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
+};
+
+struct ClipDisplayItem : DisplayItem {
+ RenderLayer* layer;
+ enum ClipType {
+ LayerOverflowControls,
+ LayerBackground,
+ LayerParent,
+ LayerFilter,
+ LayerForeground,
+ LayerFragmentFloat,
+ LayerFragmentForeground,
+ LayerFragmentChildOutline,
+ LayerFragmentOutline,
+ LayerFragmentMask,
+ LayerFragmentClippingMask,
+ LayerFragmentParent
+ };
+ ClipType clipType;
+ IntRect clipRect;
+ Vector<RoundedRect> roundedRectClips;
+
+ virtual void replay(GraphicsContext*);
+};
+
+struct EndClipDisplayItem : DisplayItem {
+ RenderLayer* layer;
+ virtual void replay(GraphicsContext*);
+};
+
+struct AtomicPaintChunk : DisplayItem {
AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRenderer, PaintPhase inPhase)
: displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { };
@@ -28,8 +64,12 @@ struct AtomicPaintChunk {
// This auxillary data can be moved off the chunk if needed.
RenderObject* renderer;
PaintPhase phase;
+
+ virtual void replay(GraphicsContext*);
};
+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
+
class PaintCommandRecorder {
public:
explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, const FloatRect&);
@@ -41,22 +81,37 @@ private:
PaintPhase m_phase;
};
+class StartClipRecorder {
+public:
+ explicit StartClipRecorder(RenderLayer*, GraphicsContext*, ClipDisplayItem::ClipType, const ClipRect&);
+ void addRoundedRectClip(const RoundedRect&);
+
+private:
+ OwnPtr<ClipDisplayItem> m_clipDisplayItem;
+ GraphicsContext* m_graphicsContext;
+};
+
+class EndClipRecorder {
+public:
+ explicit EndClipRecorder(RenderLayer*, GraphicsContext*);
+};
+
class ViewDisplayList {
public:
ViewDisplayList() { };
- const PaintCommandList& paintCommandList();
- void add(WTF::PassOwnPtr<AtomicPaintChunk>);
+ const PaintList& paintList();
+ void add(WTF::PassOwnPtr<DisplayItem>);
void invalidate(const RenderObject*);
private:
- bool isRepaint(PaintCommandList::iterator, const AtomicPaintChunk&);
+ bool isRepaint(PaintList::iterator, const DisplayItem&);
// Update m_paintList with any invalidations or new paints.
- void updatePaintCommandList();
+ void updatePaintList();
- PaintCommandList m_paintList;
+ PaintList m_paintList;
HashSet<const RenderObject*> m_invalidated;
- PaintCommandList m_newPaints;
+ PaintList m_newPaints;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698