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

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

Issue 1192363005: Move all clip display item parameters to the constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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); 19 WTF_MAKE_FAST_ALLOCATED(ClipDisplayItem);
20 public: 20 public:
21 static PassOwnPtr<ClipDisplayItem> create(const DisplayItemClientWrapper& cl ient, Type type, const IntRect& clipRect) 21 static PassOwnPtr<ClipDisplayItem> create(const DisplayItemClientWrapper& cl ient, Type type, const IntRect& clipRect, PassOwnPtr<Vector<FloatRoundedRect>> r oundedRectClips = nullptr)
22 { 22 {
23 return adoptPtr(new ClipDisplayItem(client, type, clipRect)); 23 return adoptPtr(new ClipDisplayItem(client, type, clipRect, roundedRectC lips));
24 } 24 }
25 25
26 ClipDisplayItem(const DisplayItemClientWrapper& client, Type type, const Int Rect& clipRect) 26 ClipDisplayItem(const DisplayItemClientWrapper& client, Type type, const Int Rect& clipRect, PassOwnPtr<Vector<FloatRoundedRect>> roundedRectClips = nullptr)
27 : PairedBeginDisplayItem(client, type) 27 : PairedBeginDisplayItem(client, type)
28 , m_clipRect(clipRect) 28 , m_clipRect(clipRect)
29 , m_roundedRectClips(roundedRectClips)
29 { 30 {
30 ASSERT(isClipType(type)); 31 ASSERT(isClipType(type));
31 } 32 }
32 33
33 virtual void replay(GraphicsContext&) override; 34 virtual void replay(GraphicsContext&) override;
34 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; 35 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override;
35 36
36 Vector<FloatRoundedRect>& roundedRectClips() { return m_roundedRectClips; }
37
38 private: 37 private:
39 #ifndef NDEBUG 38 #ifndef NDEBUG
40 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override ; 39 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override ;
41 #endif 40 #endif
42 IntRect m_clipRect; 41 IntRect m_clipRect;
43 Vector<FloatRoundedRect> m_roundedRectClips; 42 OwnPtr<Vector<FloatRoundedRect>> m_roundedRectClips;
44 }; 43 };
45 44
46 class PLATFORM_EXPORT EndClipDisplayItem : public PairedEndDisplayItem { 45 class PLATFORM_EXPORT EndClipDisplayItem : public PairedEndDisplayItem {
47 WTF_MAKE_FAST_ALLOCATED(EndClipDisplayItem); 46 WTF_MAKE_FAST_ALLOCATED(EndClipDisplayItem);
48 public: 47 public:
49 static PassOwnPtr<EndClipDisplayItem> create(const DisplayItemClientWrapper& client, Type type) 48 static PassOwnPtr<EndClipDisplayItem> create(const DisplayItemClientWrapper& client, Type type)
50 { 49 {
51 return adoptPtr(new EndClipDisplayItem(client, type)); 50 return adoptPtr(new EndClipDisplayItem(client, type));
52 } 51 }
53 52
54 EndClipDisplayItem(const DisplayItemClientWrapper& client, Type type) 53 EndClipDisplayItem(const DisplayItemClientWrapper& client, Type type)
55 : PairedEndDisplayItem(client, type) 54 : PairedEndDisplayItem(client, type)
56 { 55 {
57 ASSERT(isEndClipType(type)); 56 ASSERT(isEndClipType(type));
58 } 57 }
59 58
60 virtual void replay(GraphicsContext&) override; 59 virtual void replay(GraphicsContext&) override;
61 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; 60 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override;
62 61
63 private: 62 private:
64 #if ENABLE(ASSERT) 63 #if ENABLE(ASSERT)
65 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override final { return DisplayItem::isClipType(otherType); } 64 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override final { return DisplayItem::isClipType(otherType); }
66 #endif 65 #endif
67 }; 66 };
68 67
69 } // namespace blink 68 } // namespace blink
70 69
71 #endif // ClipDisplayItem_h 70 #endif // ClipDisplayItem_h
OLDNEW
« no previous file with comments | « Source/core/paint/RoundedInnerRectClipper.cpp ('k') | Source/platform/graphics/paint/ClipDisplayItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698