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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourcePattern.h

Issue 908243002: Move rendering/svg/RenderSVGResource* to layout/svg. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright 2014 The Chromium Authors. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
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
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22 #ifndef RenderSVGResourcePattern_h
23 #define RenderSVGResourcePattern_h
24
25 #include "core/rendering/svg/RenderSVGResourcePaintServer.h"
26 #include "core/svg/PatternAttributes.h"
27 #include "platform/heap/Handle.h"
28 #include "wtf/HashMap.h"
29 #include "wtf/OwnPtr.h"
30 #include "wtf/RefPtr.h"
31
32 class SkPicture;
33
34 namespace blink {
35
36 class AffineTransform;
37 class FloatRect;
38 class SVGPatternElement;
39 struct PatternData;
40
41 class RenderSVGResourcePattern final : public RenderSVGResourcePaintServer {
42 public:
43 explicit RenderSVGResourcePattern(SVGPatternElement*);
44
45 virtual const char* renderName() const override { return "RenderSVGResourceP attern"; }
46
47 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over ride;
48 virtual void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) override;
49
50 virtual SVGPaintServer preparePaintServer(const LayoutObject&) override;
51
52 static const RenderSVGResourceType s_resourceType = PatternResourceType;
53 virtual RenderSVGResourceType resourceType() const override { return s_resou rceType; }
54
55 private:
56 PassOwnPtr<PatternData> buildPatternData(const LayoutObject&);
57 PassRefPtr<const SkPicture> asPicture(const FloatRect& tile, const AffineTra nsform&) const;
58 PatternData* patternForRenderer(const LayoutObject&);
59
60 bool m_shouldCollectPatternAttributes : 1;
61 #if ENABLE(OILPAN)
62 Persistent<PatternAttributesWrapper> m_attributesWrapper;
63
64 PatternAttributes& mutableAttributes() { return m_attributesWrapper->attribu tes(); }
65 const PatternAttributes& attributes() const { return m_attributesWrapper->at tributes(); }
66 #else
67 PatternAttributes m_attributes;
68
69 PatternAttributes& mutableAttributes() { return m_attributes; }
70 const PatternAttributes& attributes() const { return m_attributes; }
71 #endif
72
73 // FIXME: we can almost do away with this per-object map, but not quite: the tile size can be
74 // relative to the client bounding box, and it gets captured in the cached P attern shader.
75 // Hence, we need one Pattern shader per client. The display list OTOH is th e same => we
76 // should be able to cache a single display list per RenderSVGResourcePatter n + one
77 // Pattern(shader) for each client -- this would avoid re-recording when mul tiple clients
78 // share the same pattern.
79 HashMap<const LayoutObject*, OwnPtr<PatternData>> m_patternMap;
80 };
81
82 }
83
84 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourcePaintServer.cpp ('k') | Source/core/rendering/svg/RenderSVGResourcePattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698