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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "platform/PlatformExport.h" | 30 #include "platform/PlatformExport.h" |
31 #include "platform/SharedBuffer.h" | 31 #include "platform/SharedBuffer.h" |
32 #include "platform/geometry/IntRect.h" | 32 #include "platform/geometry/IntRect.h" |
33 #include "platform/graphics/Color.h" | 33 #include "platform/graphics/Color.h" |
34 #include "platform/graphics/ColorBehavior.h" | 34 #include "platform/graphics/ColorBehavior.h" |
35 #include "platform/graphics/GraphicsTypes.h" | 35 #include "platform/graphics/GraphicsTypes.h" |
36 #include "platform/graphics/ImageAnimationPolicy.h" | 36 #include "platform/graphics/ImageAnimationPolicy.h" |
37 #include "platform/graphics/ImageObserver.h" | 37 #include "platform/graphics/ImageObserver.h" |
38 #include "platform/graphics/ImageOrientation.h" | 38 #include "platform/graphics/ImageOrientation.h" |
| 39 #include "platform/graphics/paint/PaintCanvas.h" |
| 40 #include "platform/graphics/paint/PaintFlags.h" |
39 #include "third_party/skia/include/core/SkRefCnt.h" | 41 #include "third_party/skia/include/core/SkRefCnt.h" |
40 #include "wtf/Assertions.h" | 42 #include "wtf/Assertions.h" |
41 #include "wtf/Noncopyable.h" | 43 #include "wtf/Noncopyable.h" |
42 #include "wtf/PassRefPtr.h" | 44 #include "wtf/PassRefPtr.h" |
43 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
44 #include "wtf/ThreadSafeRefCounted.h" | 46 #include "wtf/ThreadSafeRefCounted.h" |
45 #include "wtf/text/WTFString.h" | 47 #include "wtf/text/WTFString.h" |
46 | 48 |
47 class SkCanvas; | |
48 class SkImage; | 49 class SkImage; |
49 class SkMatrix; | 50 class SkMatrix; |
50 class SkPaint; | |
51 | 51 |
52 namespace blink { | 52 namespace blink { |
53 | 53 |
54 class FloatPoint; | 54 class FloatPoint; |
55 class FloatRect; | 55 class FloatRect; |
56 class FloatSize; | 56 class FloatSize; |
57 class GraphicsContext; | 57 class GraphicsContext; |
58 class Image; | 58 class Image; |
59 | 59 |
60 class PLATFORM_EXPORT Image : public ThreadSafeRefCounted<Image> { | 60 class PLATFORM_EXPORT Image : public ThreadSafeRefCounted<Image> { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; | 153 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; |
154 | 154 |
155 virtual sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; | 155 virtual sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; |
156 virtual PassRefPtr<Image> imageForDefaultFrame(); | 156 virtual PassRefPtr<Image> imageForDefaultFrame(); |
157 | 157 |
158 enum ImageClampingMode { | 158 enum ImageClampingMode { |
159 ClampImageToSourceRect, | 159 ClampImageToSourceRect, |
160 DoNotClampImageToSourceRect | 160 DoNotClampImageToSourceRect |
161 }; | 161 }; |
162 | 162 |
163 virtual void draw(SkCanvas*, | 163 virtual void draw(PaintCanvas*, |
164 const SkPaint&, | 164 const PaintFlags&, |
165 const FloatRect& dstRect, | 165 const FloatRect& dstRect, |
166 const FloatRect& srcRect, | 166 const FloatRect& srcRect, |
167 RespectImageOrientationEnum, | 167 RespectImageOrientationEnum, |
168 ImageClampingMode, | 168 ImageClampingMode, |
169 const ColorBehavior&) = 0; | 169 const ColorBehavior&) = 0; |
170 | 170 |
171 virtual bool applyShader(SkPaint&, | 171 virtual bool applyShader(PaintFlags&, |
172 const SkMatrix& localMatrix, | 172 const SkMatrix& localMatrix, |
173 const ColorBehavior&); | 173 const ColorBehavior&); |
174 | 174 |
175 // Compute the tile which contains a given point (assuming a repeating tile | 175 // Compute the tile which contains a given point (assuming a repeating tile |
176 // grid). The point and returned value are in destination grid space. | 176 // grid). The point and returned value are in destination grid space. |
177 static FloatRect computeTileContaining(const FloatPoint&, | 177 static FloatRect computeTileContaining(const FloatPoint&, |
178 const FloatSize& tileSize, | 178 const FloatSize& tileSize, |
179 const FloatPoint& tilePhase, | 179 const FloatPoint& tilePhase, |
180 const FloatSize& tileSpacing); | 180 const FloatSize& tileSpacing); |
181 | 181 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 bool m_imageObserverDisabled; | 223 bool m_imageObserverDisabled; |
224 }; | 224 }; |
225 | 225 |
226 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 226 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
227 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), \ | 227 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), \ |
228 image.is##typeName()) | 228 image.is##typeName()) |
229 | 229 |
230 } // namespace blink | 230 } // namespace blink |
231 | 231 |
232 #endif | 232 #endif |
OLD | NEW |