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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceClipper.h

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef LayoutSVGResourceClipper_h 20 #ifndef LayoutSVGResourceClipper_h
21 #define LayoutSVGResourceClipper_h 21 #define LayoutSVGResourceClipper_h
22 22
23 #include "core/layout/svg/LayoutSVGResourceContainer.h" 23 #include "core/layout/svg/LayoutSVGResourceContainer.h"
24 #include "core/svg/SVGClipPathElement.h" 24 #include "core/svg/SVGClipPathElement.h"
25 #include "third_party/skia/include/core/SkRefCnt.h" 25 #include "third_party/skia/include/core/SkRefCnt.h"
26 26
27 class SkPicture;
28
29 namespace blink { 27 namespace blink {
30 28
31 class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer { 29 class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer {
32 public: 30 public:
33 explicit LayoutSVGResourceClipper(SVGClipPathElement*); 31 explicit LayoutSVGResourceClipper(SVGClipPathElement*);
34 ~LayoutSVGResourceClipper() override; 32 ~LayoutSVGResourceClipper() override;
35 33
36 const char* name() const override { return "LayoutSVGResourceClipper"; } 34 const char* name() const override { return "LayoutSVGResourceClipper"; }
37 35
38 void removeAllClientsFromCache(bool markForInvalidation = true) override; 36 void removeAllClientsFromCache(bool markForInvalidation = true) override;
39 void removeClientFromCache(LayoutObject*, 37 void removeClientFromCache(LayoutObject*,
40 bool markForInvalidation = true) override; 38 bool markForInvalidation = true) override;
41 39
42 FloatRect resourceBoundingBox(const FloatRect& referenceBox); 40 FloatRect resourceBoundingBox(const FloatRect& referenceBox);
43 41
44 static const LayoutSVGResourceType s_resourceType = ClipperResourceType; 42 static const LayoutSVGResourceType s_resourceType = ClipperResourceType;
45 LayoutSVGResourceType resourceType() const override { return s_resourceType; } 43 LayoutSVGResourceType resourceType() const override { return s_resourceType; }
46 44
47 bool hitTestClipContent(const FloatRect&, const FloatPoint&); 45 bool hitTestClipContent(const FloatRect&, const FloatPoint&);
48 46
49 SVGUnitTypes::SVGUnitType clipPathUnits() const { 47 SVGUnitTypes::SVGUnitType clipPathUnits() const {
50 return toSVGClipPathElement(element()) 48 return toSVGClipPathElement(element())
51 ->clipPathUnits() 49 ->clipPathUnits()
52 ->currentValue() 50 ->currentValue()
53 ->enumValue(); 51 ->enumValue();
54 } 52 }
55 53
56 bool asPath(const AffineTransform&, const FloatRect& referenceBox, Path&); 54 bool asPath(const AffineTransform&, const FloatRect& referenceBox, Path&);
57 sk_sp<const SkPicture> createContentPicture(); 55 sk_sp<const PaintRecord> createContentPicture();
58 56
59 bool hasCycle() { return m_inClipExpansion; } 57 bool hasCycle() { return m_inClipExpansion; }
60 void beginClipExpansion() { 58 void beginClipExpansion() {
61 ASSERT(!m_inClipExpansion); 59 ASSERT(!m_inClipExpansion);
62 m_inClipExpansion = true; 60 m_inClipExpansion = true;
63 } 61 }
64 void endClipExpansion() { 62 void endClipExpansion() {
65 ASSERT(m_inClipExpansion); 63 ASSERT(m_inClipExpansion);
66 m_inClipExpansion = false; 64 m_inClipExpansion = false;
67 } 65 }
68 66
69 private: 67 private:
70 void calculateLocalClipBounds(); 68 void calculateLocalClipBounds();
71 69
72 // Return true if the clip path was calculated or a cached value is available. 70 // Return true if the clip path was calculated or a cached value is available.
73 bool calculateClipContentPathIfNeeded(); 71 bool calculateClipContentPathIfNeeded();
74 72
75 // Cache of the clip path when using path clipping. 73 // Cache of the clip path when using path clipping.
76 Path m_clipContentPath; 74 Path m_clipContentPath;
77 75
78 // Cache of the clip path picture when falling back to masking for clipping. 76 // Cache of the clip path picture when falling back to masking for clipping.
79 sk_sp<const SkPicture> m_clipContentPicture; 77 sk_sp<const PaintRecord> m_clipContentPicture;
80 78
81 FloatRect m_localClipBounds; 79 FloatRect m_localClipBounds;
82 80
83 // Reference cycle detection. 81 // Reference cycle detection.
84 bool m_inClipExpansion; 82 bool m_inClipExpansion;
85 }; 83 };
86 84
87 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceClipper, 85 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceClipper,
88 ClipperResourceType); 86 ClipperResourceType);
89 87
90 } // namespace blink 88 } // namespace blink
91 89
92 #endif 90 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698