OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef SVGImage_h | 27 #ifndef SVGImage_h |
28 #define SVGImage_h | 28 #define SVGImage_h |
29 | 29 |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "platform/graphics/Image.h" | 31 #include "platform/graphics/Image.h" |
| 32 #include "platform/graphics/paint/PaintRecord.h" |
32 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
33 #include "platform/weborigin/KURL.h" | 34 #include "platform/weborigin/KURL.h" |
34 #include "third_party/skia/include/core/SkRefCnt.h" | 35 #include "third_party/skia/include/core/SkRefCnt.h" |
35 #include "wtf/Allocator.h" | 36 #include "wtf/Allocator.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class Document; | 40 class Document; |
40 class Page; | 41 class Page; |
41 class PaintController; | 42 class PaintController; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 121 } |
121 | 122 |
122 void draw(PaintCanvas*, | 123 void draw(PaintCanvas*, |
123 const PaintFlags&, | 124 const PaintFlags&, |
124 const FloatRect& fromRect, | 125 const FloatRect& fromRect, |
125 const FloatRect& toRect, | 126 const FloatRect& toRect, |
126 RespectImageOrientationEnum, | 127 RespectImageOrientationEnum, |
127 ImageClampingMode) override; | 128 ImageClampingMode) override; |
128 void drawForContainer(PaintCanvas*, | 129 void drawForContainer(PaintCanvas*, |
129 const PaintFlags&, | 130 const PaintFlags&, |
130 const FloatSize, | 131 const FloatSize&, |
131 float, | 132 float, |
132 const FloatRect&, | 133 const FloatRect&, |
133 const FloatRect&, | 134 const FloatRect&, |
134 const KURL&); | 135 const KURL&); |
135 void drawPatternForContainer(GraphicsContext&, | 136 void drawPatternForContainer(GraphicsContext&, |
136 const FloatSize, | 137 const FloatSize, |
137 float, | 138 float, |
138 const FloatRect&, | 139 const FloatRect&, |
139 const FloatSize&, | 140 const FloatSize&, |
140 const FloatPoint&, | 141 const FloatPoint&, |
141 SkBlendMode, | 142 SkBlendMode, |
142 const FloatRect&, | 143 const FloatRect&, |
143 const FloatSize& repeatSpacing, | 144 const FloatSize& repeatSpacing, |
144 const KURL&); | 145 const KURL&); |
145 sk_sp<SkImage> imageForCurrentFrameForContainer(const KURL&, | 146 sk_sp<SkImage> imageForCurrentFrameForContainer(const KURL&, |
146 const IntSize& containerSize); | 147 const IntSize& containerSize); |
| 148 sk_sp<PaintRecord> paintRecordForCurrentFrame(const FloatRect& srcRect, |
| 149 const FloatRect& dstRect, |
| 150 const KURL&); |
| 151 |
147 void drawInternal(PaintCanvas*, | 152 void drawInternal(PaintCanvas*, |
148 const PaintFlags&, | 153 const PaintFlags&, |
149 const FloatRect& fromRect, | 154 const FloatRect& fromRect, |
150 const FloatRect& toRect, | 155 const FloatRect& toRect, |
151 RespectImageOrientationEnum, | 156 RespectImageOrientationEnum, |
152 ImageClampingMode, | 157 ImageClampingMode, |
153 const KURL&); | 158 const KURL&); |
154 | 159 |
| 160 template <typename Func> |
| 161 void forContainer(const FloatSize&, Func&&); |
| 162 |
| 163 bool applyShader(PaintFlags&, const SkMatrix& localMatrix) override; |
| 164 bool applyShaderForContainer(const FloatSize&, |
| 165 float zoom, |
| 166 const KURL&, |
| 167 PaintFlags&, |
| 168 const SkMatrix& localMatrix); |
| 169 bool applyShaderInternal(PaintFlags&, |
| 170 const SkMatrix& localMatrix, |
| 171 const KURL&); |
| 172 |
155 void stopAnimation(); | 173 void stopAnimation(); |
156 void scheduleTimelineRewind(); | 174 void scheduleTimelineRewind(); |
157 void flushPendingTimelineRewind(); | 175 void flushPendingTimelineRewind(); |
158 | 176 |
159 Persistent<SVGImageChromeClient> m_chromeClient; | 177 Persistent<SVGImageChromeClient> m_chromeClient; |
160 Persistent<Page> m_page; | 178 Persistent<Page> m_page; |
161 std::unique_ptr<PaintController> m_paintController; | 179 std::unique_ptr<PaintController> m_paintController; |
162 | 180 |
163 // When an SVG image has no intrinsic size, the size depends on the default | 181 // When an SVG image has no intrinsic size, the size depends on the default |
164 // object size, which in turn depends on the container. One SVGImage may | 182 // object size, which in turn depends on the container. One SVGImage may |
(...skipping 17 matching lines...) Expand all Loading... |
182 | 200 |
183 ~ImageObserverDisabler() { m_image->setImageObserverDisabled(false); } | 201 ~ImageObserverDisabler() { m_image->setImageObserverDisabled(false); } |
184 | 202 |
185 private: | 203 private: |
186 Image* m_image; | 204 Image* m_image; |
187 }; | 205 }; |
188 | 206 |
189 } // namespace blink | 207 } // namespace blink |
190 | 208 |
191 #endif // SVGImage_h | 209 #endif // SVGImage_h |
OLD | NEW |