OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 10 matching lines...) Expand all Loading... | |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
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 Image_h | 27 #ifndef Image_h |
28 #define Image_h | 28 #define Image_h |
29 | 29 |
30 #include "platform/PlatformExport.h" | 30 #include "platform/PlatformExport.h" |
31 #include "platform/geometry/FloatRect.h" | |
31 #include "platform/geometry/IntRect.h" | 32 #include "platform/geometry/IntRect.h" |
32 #include "platform/graphics/Color.h" | 33 #include "platform/graphics/Color.h" |
33 #include "platform/graphics/GraphicsTypes.h" | 34 #include "platform/graphics/GraphicsTypes.h" |
34 #include "platform/graphics/ImageAnimationPolicy.h" | 35 #include "platform/graphics/ImageAnimationPolicy.h" |
35 #include "platform/graphics/ImageObserver.h" | 36 #include "platform/graphics/ImageObserver.h" |
36 #include "platform/graphics/ImageOrientation.h" | 37 #include "platform/graphics/ImageOrientation.h" |
37 #include "wtf/Assertions.h" | 38 #include "wtf/Assertions.h" |
38 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
39 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
40 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 | 143 |
143 virtual void drawPattern(GraphicsContext&, const FloatRect&, | 144 virtual void drawPattern(GraphicsContext&, const FloatRect&, |
144 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, | 145 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, |
145 const FloatRect&, const FloatSize& repeatSpacing = FloatSize()); | 146 const FloatRect&, const FloatSize& repeatSpacing = FloatSize()); |
146 | 147 |
147 enum ImageClampingMode { | 148 enum ImageClampingMode { |
148 ClampImageToSourceRect, | 149 ClampImageToSourceRect, |
149 DoNotClampImageToSourceRect | 150 DoNotClampImageToSourceRect |
150 }; | 151 }; |
151 | 152 |
152 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0; | 153 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, bool imageSmoothingEnabled, RespectImageOrientationEnum, Im ageClampingMode) = 0; |
f(malita)
2016/07/18 15:46:38
Instead of plumbing imageSmoothingEnabled in the I
fs
2016/07/18 15:56:55
I was about to make a note about the same thing =)
| |
154 static bool isDrawScalingDown(const FloatRect& srcRect, const FloatRect& dst Rect) | |
155 { | |
156 return dstRect.width() < srcRect.width() && dstRect.height() < srcRect.h eight(); | |
157 } | |
153 | 158 |
154 virtual bool applyShader(SkPaint&, const SkMatrix& localMatrix); | 159 virtual bool applyShader(SkPaint&, const SkMatrix& localMatrix); |
155 | 160 |
156 // Compute the tile which contains a given point (assuming a repeating tile grid). | 161 // Compute the tile which contains a given point (assuming a repeating tile grid). |
157 // The point and returned value are in destination grid space. | 162 // The point and returned value are in destination grid space. |
158 static FloatRect computeTileContaining(const FloatPoint&, const FloatSize& t ileSize, | 163 static FloatRect computeTileContaining(const FloatPoint&, const FloatSize& t ileSize, |
159 const FloatPoint& tilePhase, const FloatSize& tileSpacing); | 164 const FloatPoint& tilePhase, const FloatSize& tileSpacing); |
160 | 165 |
161 // Compute the image subset which gets mapped onto dest, when the whole imag e is drawn into | 166 // Compute the image subset which gets mapped onto dest, when the whole imag e is drawn into |
162 // tile. Assumes the tile contains dest. The tile rect is in destination g rid space while | 167 // tile. Assumes the tile contains dest. The tile rect is in destination g rid space while |
(...skipping 18 matching lines...) Expand all Loading... | |
181 UntracedMember<ImageObserver> m_imageObserver; | 186 UntracedMember<ImageObserver> m_imageObserver; |
182 bool m_imageObserverDisabled; | 187 bool m_imageObserverDisabled; |
183 }; | 188 }; |
184 | 189 |
185 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 190 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
186 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) | 191 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) |
187 | 192 |
188 } // namespace blink | 193 } // namespace blink |
189 | 194 |
190 #endif | 195 #endif |
OLD | NEW |