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 14 matching lines...) Expand all Loading... |
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/IntRect.h" | 31 #include "platform/geometry/IntRect.h" |
32 #include "platform/graphics/Color.h" | 32 #include "platform/graphics/Color.h" |
33 #include "platform/graphics/GraphicsTypes.h" | 33 #include "platform/graphics/GraphicsTypes.h" |
34 #include "platform/graphics/ImageAnimationPolicy.h" | 34 #include "platform/graphics/ImageAnimationPolicy.h" |
| 35 #include "platform/graphics/ImageObserver.h" |
35 #include "platform/graphics/ImageOrientation.h" | 36 #include "platform/graphics/ImageOrientation.h" |
36 #include "third_party/skia/include/core/SkCanvas.h" | 37 #include "third_party/skia/include/core/SkCanvas.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" |
41 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
42 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
43 | 44 |
44 class SkBitmap; | 45 class SkBitmap; |
45 class SkImage; | 46 class SkImage; |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
49 class FloatPoint; | 50 class FloatPoint; |
50 class FloatRect; | 51 class FloatRect; |
51 class FloatSize; | 52 class FloatSize; |
52 class GraphicsContext; | 53 class GraphicsContext; |
53 class Length; | 54 class Length; |
54 class SharedBuffer; | 55 class SharedBuffer; |
55 class Image; | 56 class Image; |
56 | 57 |
57 // This class gets notified when an image creates or destroys decoded frames and
when it advances animation frames. | |
58 class ImageObserver; | |
59 | |
60 class PLATFORM_EXPORT Image : public RefCounted<Image> { | 58 class PLATFORM_EXPORT Image : public RefCounted<Image> { |
61 friend class GeneratedImage; | 59 friend class GeneratedImage; |
62 friend class CrossfadeGeneratedImage; | 60 friend class CrossfadeGeneratedImage; |
63 friend class GradientGeneratedImage; | 61 friend class GradientGeneratedImage; |
64 friend class GraphicsContext; | 62 friend class GraphicsContext; |
65 WTF_MAKE_NONCOPYABLE(Image); | 63 WTF_MAKE_NONCOPYABLE(Image); |
66 | 64 |
67 public: | 65 public: |
68 virtual ~Image(); | 66 virtual ~Image(); |
69 | 67 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 155 |
158 protected: | 156 protected: |
159 Image(ImageObserver* = 0); | 157 Image(ImageObserver* = 0); |
160 | 158 |
161 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, | 159 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, |
162 SkXfermode::Mode, const FloatSize& repeatSpacing); | 160 SkXfermode::Mode, const FloatSize& repeatSpacing); |
163 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe
rmode::Mode); | 161 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe
rmode::Mode); |
164 | 162 |
165 private: | 163 private: |
166 RefPtr<SharedBuffer> m_encodedImageData; | 164 RefPtr<SharedBuffer> m_encodedImageData; |
167 ImageObserver* m_imageObserver; | 165 // TODO(Oilpan): consider having Image on the Oilpan heap and |
| 166 // turn this into a Member<>. |
| 167 // |
| 168 // The observer (an ImageResource) is an untraced member, with the ImageReso
urce |
| 169 // being responsible of clearing itself out. |
| 170 RawPtrWillBeUntracedMember<ImageObserver> m_imageObserver; |
168 }; | 171 }; |
169 | 172 |
170 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 173 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
171 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) | 174 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) |
172 | 175 |
173 } // namespace blink | 176 } // namespace blink |
174 | 177 |
175 #endif | 178 #endif |
OLD | NEW |