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

Side by Side Diff: Source/platform/graphics/paint/ClipDisplayItem.h

Issue 1203343002: WIP for display item list backed by ListContainer Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
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 ClipDisplayItem_h 5 #ifndef ClipDisplayItem_h
6 #define ClipDisplayItem_h 6 #define ClipDisplayItem_h
7 7
8 #include "SkRegion.h" 8 #include "SkRegion.h"
9 #include "platform/PlatformExport.h" 9 #include "platform/PlatformExport.h"
10 #include "platform/geometry/FloatRoundedRect.h" 10 #include "platform/geometry/FloatRoundedRect.h"
11 #include "platform/geometry/IntRect.h" 11 #include "platform/geometry/IntRect.h"
12 #include "platform/graphics/paint/DisplayItem.h" 12 #include "platform/graphics/paint/DisplayItem.h"
13 #include "wtf/PassOwnPtr.h" 13 #include "wtf/PassOwnPtr.h"
14 #include "wtf/Vector.h" 14 #include "wtf/Vector.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class PLATFORM_EXPORT ClipDisplayItem : public PairedBeginDisplayItem { 18 class PLATFORM_EXPORT ClipDisplayItem : public PairedBeginDisplayItem {
19 WTF_MAKE_FAST_ALLOCATED(ClipDisplayItem);
20 public: 19 public:
21 static PassOwnPtr<ClipDisplayItem> create(const DisplayItemClientWrapper& cl ient, Type type, const IntRect& clipRect, PassOwnPtr<Vector<FloatRoundedRect>> r oundedRectClips = nullptr) 20 void setNew(IntRect& clipRect, PassOwnPtr<Vector<FloatRoundedRect>> roundedR ectClips = nullptr)
22 { 21 {
23 return adoptPtr(new ClipDisplayItem(client, type, clipRect, roundedRectC lips)); 22 m_clipRect = clipRect;
24 } 23 m_roundedRectClips = roundedRectClips;
25 24 ASSERT(isClipType(type()));
26 ClipDisplayItem(const DisplayItemClientWrapper& client, Type type, const Int Rect& clipRect, PassOwnPtr<Vector<FloatRoundedRect>> roundedRectClips = nullptr)
27 : PairedBeginDisplayItem(client, type)
28 , m_clipRect(clipRect)
29 , m_roundedRectClips(roundedRectClips)
30 {
31 ASSERT(isClipType(type));
32 } 25 }
33 26
34 virtual void replay(GraphicsContext&) override; 27 virtual void replay(GraphicsContext&) override;
35 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; 28 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override;
36 29
37 private: 30 private:
38 #ifndef NDEBUG 31 #ifndef NDEBUG
39 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override ; 32 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override ;
40 #endif 33 #endif
41 IntRect m_clipRect; 34 IntRect m_clipRect;
42 OwnPtr<Vector<FloatRoundedRect>> m_roundedRectClips; 35 OwnPtr<Vector<FloatRoundedRect>> m_roundedRectClips;
43 }; 36 };
44 37
45 class PLATFORM_EXPORT EndClipDisplayItem : public PairedEndDisplayItem { 38 class PLATFORM_EXPORT EndClipDisplayItem : public PairedEndDisplayItem {
46 WTF_MAKE_FAST_ALLOCATED(EndClipDisplayItem);
47 public: 39 public:
48 static PassOwnPtr<EndClipDisplayItem> create(const DisplayItemClientWrapper& client, Type type)
49 {
50 return adoptPtr(new EndClipDisplayItem(client, type));
51 }
52
53 EndClipDisplayItem(const DisplayItemClientWrapper& client, Type type)
54 : PairedEndDisplayItem(client, type)
55 {
56 ASSERT(isEndClipType(type));
57 }
58
59 virtual void replay(GraphicsContext&) override; 40 virtual void replay(GraphicsContext&) override;
60 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; 41 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override;
61 42
62 private: 43 private:
63 #if ENABLE(ASSERT) 44 #if ENABLE(ASSERT)
64 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override final { return DisplayItem::isClipType(otherType); } 45 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override final { return DisplayItem::isClipType(otherType); }
65 #endif 46 #endif
66 }; 47 };
67 48
68 } // namespace blink 49 } // namespace blink
69 50
70 #endif // ClipDisplayItem_h 51 #endif // ClipDisplayItem_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/paint/CachedDisplayItem.h ('k') | Source/platform/graphics/paint/ClipPathDisplayItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698