OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
4 * Copyright 2014 The Chromium Authors. All rights reserved. | 4 * Copyright 2014 The Chromium Authors. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #ifndef RenderSVGResourcePattern_h | 22 #ifndef RenderSVGResourcePattern_h |
23 #define RenderSVGResourcePattern_h | 23 #define RenderSVGResourcePattern_h |
24 | 24 |
25 #include "core/rendering/svg/RenderSVGResourcePaintServer.h" | 25 #include "core/rendering/svg/RenderSVGResourcePaintServer.h" |
26 #include "core/svg/PatternAttributes.h" | 26 #include "core/svg/PatternAttributes.h" |
27 | 27 |
28 #include "platform/heap/Handle.h" | |
28 #include "wtf/HashMap.h" | 29 #include "wtf/HashMap.h" |
29 #include "wtf/OwnPtr.h" | 30 #include "wtf/OwnPtr.h" |
30 #include "wtf/RefPtr.h" | 31 #include "wtf/RefPtr.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 class AffineTransform; | 35 class AffineTransform; |
35 class DisplayList; | 36 class DisplayList; |
36 class FloatRect; | 37 class FloatRect; |
37 class SVGPatternElement; | 38 class SVGPatternElement; |
38 struct PatternData; | 39 struct PatternData; |
39 | 40 |
40 class RenderSVGResourcePattern final : public RenderSVGResourcePaintServer { | 41 class RenderSVGResourcePattern final : public RenderSVGResourcePaintServer { |
41 public: | 42 public: |
42 explicit RenderSVGResourcePattern(SVGPatternElement*); | 43 explicit RenderSVGResourcePattern(SVGPatternElement*); |
43 | 44 |
44 virtual const char* renderName() const override { return "RenderSVGResourceP attern"; } | 45 virtual const char* renderName() const override { return "RenderSVGResourceP attern"; } |
45 | 46 |
46 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over ride; | 47 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over ride; |
47 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) override; | 48 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) override; |
48 | 49 |
49 virtual SVGPaintServer preparePaintServer(const RenderObject&) override; | 50 virtual SVGPaintServer preparePaintServer(const RenderObject&) override; |
50 | 51 |
51 virtual RenderSVGResourceType resourceType() const override { return s_resou rceType; } | 52 virtual RenderSVGResourceType resourceType() const override { return s_resou rceType; } |
52 static const RenderSVGResourceType s_resourceType; | 53 static const RenderSVGResourceType s_resourceType; |
53 | 54 |
55 virtual void trace(Visitor*) override; | |
56 | |
54 private: | 57 private: |
55 PassOwnPtr<PatternData> buildPatternData(const RenderObject&); | 58 PassOwnPtr<PatternData> buildPatternData(const RenderObject&); |
56 PassRefPtr<DisplayList> asDisplayList(const FloatRect& tileBounds, const Aff ineTransform&) const; | 59 PassRefPtr<DisplayList> asDisplayList(const FloatRect& tileBounds, const Aff ineTransform&) const; |
57 PatternData* patternForRenderer(const RenderObject&); | 60 PatternData* patternForRenderer(const RenderObject&); |
58 | 61 |
59 bool m_shouldCollectPatternAttributes : 1; | 62 bool m_shouldCollectPatternAttributes : 1; |
60 PatternAttributes m_attributes; | 63 PatternAttributes m_attributes; |
61 | 64 |
62 // FIXME: we can almost do away with this per-object map, but not quite: the tile size can be | 65 // FIXME: we can almost do away with this per-object map, but not quite: the tile size can be |
63 // relative to the client bounding box, and it gets captured in the cached P attern shader. | 66 // relative to the client bounding box, and it gets captured in the cached P attern shader. |
64 // Hence, we need one Pattern shader per client. The display list OTOH is th e same => we | 67 // Hence, we need one Pattern shader per client. The display list OTOH is th e same => we |
65 // should be able to cache a single display list per RenderSVGResourcePatter n + one | 68 // should be able to cache a single display list per RenderSVGResourcePatter n + one |
66 // Pattern(shader) for each client -- this would avoid re-recording when mul tiple clients | 69 // Pattern(shader) for each client -- this would avoid re-recording when mul tiple clients |
67 // share the same pattern. | 70 // share the same pattern. |
68 HashMap<const RenderObject*, OwnPtr<PatternData> > m_patternMap; | 71 HashMap<const RenderObject*, OwnPtr<PatternData> > m_patternMap; |
haraken
2014/11/11 05:22:46
Not related to this CL, this could be HeapHashMap<
| |
69 }; | 72 }; |
70 | 73 |
71 } | 74 } |
72 | 75 |
73 #endif | 76 #endif |
OLD | NEW |