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 13 matching lines...) Expand all Loading... |
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/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
33 #include "platform/weborigin/KURL.h" | 33 #include "platform/weborigin/KURL.h" |
| 34 #include "third_party/skia/include/core/SkRefCnt.h" |
34 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 class Document; | 39 class Document; |
39 class Page; | 40 class Page; |
40 class LayoutReplaced; | 41 class LayoutReplaced; |
41 class SVGImageChromeClient; | 42 class SVGImageChromeClient; |
42 class SVGImageForContainer; | 43 class SVGImageForContainer; |
43 | 44 |
(...skipping 15 matching lines...) Expand all Loading... |
59 bool currentFrameHasSingleSecurityOrigin() const override; | 60 bool currentFrameHasSingleSecurityOrigin() const override; |
60 | 61 |
61 void startAnimation(CatchUpAnimation = CatchUp) override; | 62 void startAnimation(CatchUpAnimation = CatchUp) override; |
62 void resetAnimation() override; | 63 void resetAnimation() override; |
63 | 64 |
64 // Advances an animated image. This will trigger an animation update for CSS | 65 // Advances an animated image. This will trigger an animation update for CSS |
65 // and advance the SMIL timeline by one frame. | 66 // and advance the SMIL timeline by one frame. |
66 void advanceAnimationForTesting() override; | 67 void advanceAnimationForTesting() override; |
67 SVGImageChromeClient& chromeClientForTesting(); | 68 SVGImageChromeClient& chromeClientForTesting(); |
68 | 69 |
69 PassRefPtr<SkImage> imageForCurrentFrame() override; | 70 sk_sp<SkImage> imageForCurrentFrame() override; |
70 | 71 |
71 // Does the SVG image/document contain any animations? | 72 // Does the SVG image/document contain any animations? |
72 bool hasAnimations() const; | 73 bool hasAnimations() const; |
73 // Service CSS and SMIL animations. | 74 // Service CSS and SMIL animations. |
74 void serviceAnimations(double monotonicAnimationStartTime); | 75 void serviceAnimations(double monotonicAnimationStartTime); |
75 | 76 |
76 void updateUseCounters(Document&) const; | 77 void updateUseCounters(Document&) const; |
77 | 78 |
78 // The defaultObjectSize is assumed to be unzoomed, i.e. it should | 79 // The defaultObjectSize is assumed to be unzoomed, i.e. it should |
79 // not have the effective zoom level applied. The returned size is | 80 // not have the effective zoom level applied. The returned size is |
(...skipping 23 matching lines...) Expand all Loading... |
103 void destroyDecodedData() override { } | 104 void destroyDecodedData() override { } |
104 | 105 |
105 // FIXME: Implement this to be less conservative. | 106 // FIXME: Implement this to be less conservative. |
106 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
{ return false; } | 107 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
{ return false; } |
107 | 108 |
108 SVGImage(ImageObserver*); | 109 SVGImage(ImageObserver*); |
109 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR
ect& toRect, RespectImageOrientationEnum, ImageClampingMode) override; | 110 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR
ect& toRect, RespectImageOrientationEnum, ImageClampingMode) override; |
110 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con
st FloatRect&, const FloatRect&, const KURL&); | 111 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con
st FloatRect&, const FloatRect&, const KURL&); |
111 void drawPatternForContainer(GraphicsContext&, const FloatSize, float, const
FloatRect&, const FloatSize&, const FloatPoint&, | 112 void drawPatternForContainer(GraphicsContext&, const FloatSize, float, const
FloatRect&, const FloatSize&, const FloatPoint&, |
112 SkXfermode::Mode, const FloatRect&, const FloatSize& repeatSpacing, cons
t KURL&); | 113 SkXfermode::Mode, const FloatRect&, const FloatSize& repeatSpacing, cons
t KURL&); |
113 PassRefPtr<SkImage> imageForCurrentFrameForContainer(const KURL&, const Floa
tSize& containerSize); | 114 sk_sp<SkImage> imageForCurrentFrameForContainer(const KURL&, const FloatSize
& containerSize); |
114 void drawInternal(SkCanvas*, const SkPaint&, const FloatRect& fromRect, cons
t FloatRect& toRect, RespectImageOrientationEnum, | 115 void drawInternal(SkCanvas*, const SkPaint&, const FloatRect& fromRect, cons
t FloatRect& toRect, RespectImageOrientationEnum, |
115 ImageClampingMode, const KURL&); | 116 ImageClampingMode, const KURL&); |
116 | 117 |
117 void stopAnimation(); | 118 void stopAnimation(); |
118 void scheduleTimelineRewind(); | 119 void scheduleTimelineRewind(); |
119 void flushPendingTimelineRewind(); | 120 void flushPendingTimelineRewind(); |
120 | 121 |
121 Persistent<SVGImageChromeClient> m_chromeClient; | 122 Persistent<SVGImageChromeClient> m_chromeClient; |
122 Persistent<Page> m_page; | 123 Persistent<Page> m_page; |
123 | 124 |
(...skipping 23 matching lines...) Expand all Loading... |
147 { | 148 { |
148 m_image->setImageObserverDisabled(false); | 149 m_image->setImageObserverDisabled(false); |
149 } | 150 } |
150 private: | 151 private: |
151 Image* m_image; | 152 Image* m_image; |
152 }; | 153 }; |
153 | 154 |
154 } // namespace blink | 155 } // namespace blink |
155 | 156 |
156 #endif // SVGImage_h | 157 #endif // SVGImage_h |
OLD | NEW |