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 | 28 |
28 class SkPicture; | 29 class SkPicture; |
29 | 30 |
30 namespace blink { | 31 namespace blink { |
31 | 32 |
32 class AffineTransform; | 33 class AffineTransform; |
33 class GraphicsContext; | 34 class GraphicsContext; |
34 | 35 |
35 class LayoutSVGResourceMasker final : public LayoutSVGResourceContainer { | 36 class LayoutSVGResourceMasker final : public LayoutSVGResourceContainer { |
36 public: | 37 public: |
37 explicit LayoutSVGResourceMasker(SVGMaskElement*); | 38 explicit LayoutSVGResourceMasker(SVGMaskElement*); |
38 ~LayoutSVGResourceMasker() override; | 39 ~LayoutSVGResourceMasker() override; |
39 | 40 |
40 const char* name() const override { return "LayoutSVGResourceMasker"; } | 41 const char* name() const override { return "LayoutSVGResourceMasker"; } |
41 | 42 |
42 void removeAllClientsFromCache(bool markForInvalidation = true) override; | 43 void removeAllClientsFromCache(bool markForInvalidation = true) override; |
43 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o
verride; | 44 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o
verride; |
44 | 45 |
45 FloatRect resourceBoundingBox(const LayoutObject*); | 46 FloatRect resourceBoundingBox(const LayoutObject*); |
46 | 47 |
47 SVGUnitTypes::SVGUnitType maskUnits() const { return toSVGMaskElement(elemen
t())->maskUnits()->currentValue()->enumValue(); } | 48 SVGUnitTypes::SVGUnitType maskUnits() const { return toSVGMaskElement(elemen
t())->maskUnits()->currentValue()->enumValue(); } |
48 SVGUnitTypes::SVGUnitType maskContentUnits() const { return toSVGMaskElement
(element())->maskContentUnits()->currentValue()->enumValue(); } | 49 SVGUnitTypes::SVGUnitType maskContentUnits() const { return toSVGMaskElement
(element())->maskContentUnits()->currentValue()->enumValue(); } |
49 | 50 |
50 static const LayoutSVGResourceType s_resourceType = MaskerResourceType; | 51 static const LayoutSVGResourceType s_resourceType = MaskerResourceType; |
51 LayoutSVGResourceType resourceType() const override { return s_resourceType;
} | 52 LayoutSVGResourceType resourceType() const override { return s_resourceType;
} |
52 | 53 |
53 PassRefPtr<const SkPicture> createContentPicture(AffineTransform&, const Flo
atRect&, GraphicsContext&); | 54 sk_sp<const SkPicture> createContentPicture(AffineTransform&, const FloatRec
t&, GraphicsContext&); |
54 | 55 |
55 private: | 56 private: |
56 void calculateMaskContentPaintInvalidationRect(); | 57 void calculateMaskContentPaintInvalidationRect(); |
57 | 58 |
58 RefPtr<const SkPicture> m_maskContentPicture; | 59 sk_sp<const SkPicture> m_maskContentPicture; |
59 FloatRect m_maskContentBoundaries; | 60 FloatRect m_maskContentBoundaries; |
60 }; | 61 }; |
61 | 62 |
62 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceMasker, MaskerResourceTyp
e); | 63 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceMasker, MaskerResourceTyp
e); |
63 | 64 |
64 } // namespace blink | 65 } // namespace blink |
65 | 66 |
66 #endif | 67 #endif |
OLD | NEW |