OLD | NEW |
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 LayoutSVGResourceMasker_h | 20 #ifndef LayoutSVGResourceMasker_h |
21 #define LayoutSVGResourceMasker_h | 21 #define LayoutSVGResourceMasker_h |
22 | 22 |
23 #include "core/layout/svg/LayoutSVGResourceContainer.h" | 23 #include "core/layout/svg/LayoutSVGResourceContainer.h" |
24 #include "core/svg/SVGMaskElement.h" | 24 #include "core/svg/SVGMaskElement.h" |
25 #include "core/svg/SVGUnitTypes.h" | 25 #include "core/svg/SVGUnitTypes.h" |
26 #include "platform/geometry/FloatRect.h" | 26 #include "platform/geometry/FloatRect.h" |
27 #include "third_party/skia/include/core/SkRefCnt.h" | 27 #include "third_party/skia/include/core/SkRefCnt.h" |
28 | 28 |
29 class SkPicture; | |
30 | |
31 namespace blink { | 29 namespace blink { |
32 | 30 |
33 class AffineTransform; | 31 class AffineTransform; |
34 class GraphicsContext; | 32 class GraphicsContext; |
35 | 33 |
36 class LayoutSVGResourceMasker final : public LayoutSVGResourceContainer { | 34 class LayoutSVGResourceMasker final : public LayoutSVGResourceContainer { |
37 public: | 35 public: |
38 explicit LayoutSVGResourceMasker(SVGMaskElement*); | 36 explicit LayoutSVGResourceMasker(SVGMaskElement*); |
39 ~LayoutSVGResourceMasker() override; | 37 ~LayoutSVGResourceMasker() override; |
40 | 38 |
(...skipping 14 matching lines...) Expand all Loading... |
55 SVGUnitTypes::SVGUnitType maskContentUnits() const { | 53 SVGUnitTypes::SVGUnitType maskContentUnits() const { |
56 return toSVGMaskElement(element()) | 54 return toSVGMaskElement(element()) |
57 ->maskContentUnits() | 55 ->maskContentUnits() |
58 ->currentValue() | 56 ->currentValue() |
59 ->enumValue(); | 57 ->enumValue(); |
60 } | 58 } |
61 | 59 |
62 static const LayoutSVGResourceType s_resourceType = MaskerResourceType; | 60 static const LayoutSVGResourceType s_resourceType = MaskerResourceType; |
63 LayoutSVGResourceType resourceType() const override { return s_resourceType; } | 61 LayoutSVGResourceType resourceType() const override { return s_resourceType; } |
64 | 62 |
65 sk_sp<const SkPicture> createContentPicture(AffineTransform&, | 63 sk_sp<const PaintRecord> createContentPicture(AffineTransform&, |
66 const FloatRect&, | 64 const FloatRect&, |
67 GraphicsContext&); | 65 GraphicsContext&); |
68 | 66 |
69 private: | 67 private: |
70 void calculateMaskContentVisualRect(); | 68 void calculateMaskContentVisualRect(); |
71 | 69 |
72 sk_sp<const SkPicture> m_maskContentPicture; | 70 sk_sp<const PaintRecord> m_maskContentPicture; |
73 FloatRect m_maskContentBoundaries; | 71 FloatRect m_maskContentBoundaries; |
74 }; | 72 }; |
75 | 73 |
76 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceMasker, | 74 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceMasker, |
77 MaskerResourceType); | 75 MaskerResourceType); |
78 | 76 |
79 } // namespace blink | 77 } // namespace blink |
80 | 78 |
81 #endif | 79 #endif |
OLD | NEW |