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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 | 59 |
60 public: | 60 public: |
61 virtual ~Image(); | 61 virtual ~Image(); |
62 | 62 |
63 static PassRefPtr<Image> create(ImageObserver* = 0); | 63 static PassRefPtr<Image> create(ImageObserver* = 0); |
64 static PassRefPtr<Image> loadPlatformResource(const char* name); | 64 static PassRefPtr<Image> loadPlatformResource(const char* name); |
65 static bool supportsType(const String&); | 65 static bool supportsType(const String&); |
66 | 66 |
67 virtual bool isSVGImage() const { return false; } | 67 virtual bool isSVGImage() const { return false; } |
68 virtual bool isBitmapImage() const { return false; } | 68 virtual bool isBitmapImage() const { return false; } |
69 virtual bool currentFrameKnownToBeOpaque() = 0; | 69 virtual bool currentFrameKnownToBeOpaque() { return false; } |
Justin Novosad
2013/07/22 15:35:41
No, let's keep this pure virtual. Implement it in
| |
70 | 70 |
71 // Derived classes should override this if they can assure that | 71 // Derived classes should override this if they can assure that |
72 // the image contains only resources from its own security origin. | 72 // the image contains only resources from its own security origin. |
73 virtual bool hasSingleSecurityOrigin() const { return false; } | 73 virtual bool hasSingleSecurityOrigin() const { return false; } |
74 | 74 |
75 static Image* nullImage(); | 75 static Image* nullImage(); |
76 bool isNull() const { return size().isEmpty(); } | 76 bool isNull() const { return size().isEmpty(); } |
77 | 77 |
78 virtual void setContainerSize(const IntSize&) { } | 78 virtual void setContainerSize(const IntSize&) { } |
79 virtual bool usesContainerSize() const { return false; } | 79 virtual bool usesContainerSize() const { return false; } |
80 virtual bool hasRelativeWidth() const { return false; } | 80 virtual bool hasRelativeWidth() const { return false; } |
81 virtual bool hasRelativeHeight() const { return false; } | 81 virtual bool hasRelativeHeight() const { return false; } |
82 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio); | 82 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio); |
83 | 83 |
84 virtual IntSize size() const = 0; | 84 virtual IntSize size() const = 0; |
85 IntRect rect() const { return IntRect(IntPoint(), size()); } | 85 IntRect rect() const { return IntRect(IntPoint(), size()); } |
86 int width() const { return size().width(); } | 86 int width() const { return size().width(); } |
87 int height() const { return size().height(); } | 87 int height() const { return size().height(); } |
88 virtual bool getHotSpot(IntPoint&) const { return false; } | 88 virtual bool getHotSpot(IntPoint&) const { return false; } |
89 | 89 |
90 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); | 90 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); |
91 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } | 91 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } |
92 | 92 |
93 virtual String filenameExtension() const { return String(); } // null string if unknown | 93 virtual String filenameExtension() const { return String(); } // null string if unknown |
94 | 94 |
95 virtual void destroyDecodedData() = 0; | 95 virtual void destroyDecodedData() { } |
Justin Novosad
2013/07/22 15:35:41
same here
| |
96 virtual unsigned decodedSize() const = 0; | 96 virtual unsigned decodedSize() const { return 0; } |
Justin Novosad
2013/07/22 15:35:41
and here.
| |
97 | 97 |
98 SharedBuffer* data() { return m_encodedImageData.get(); } | 98 SharedBuffer* data() { return m_encodedImageData.get(); } |
99 | 99 |
100 // Animation begins whenever someone draws the image, so startAnimation() is not normally called. | 100 // Animation begins whenever someone draws the image, so startAnimation() is not normally called. |
101 // It will automatically pause once all observers no longer want to render t he image anywhere. | 101 // It will automatically pause once all observers no longer want to render t he image anywhere. |
102 virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) { } | 102 virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) { } |
103 virtual void stopAnimation() {} | 103 virtual void stopAnimation() {} |
104 virtual void resetAnimation() {} | 104 virtual void resetAnimation() {} |
105 | 105 |
106 // Typically the CachedImage that owns us. | 106 // Typically the CachedImage that owns us. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 virtual Color solidColor() const { return Color(); } | 141 virtual Color solidColor() const { return Color(); } |
142 | 142 |
143 private: | 143 private: |
144 RefPtr<SharedBuffer> m_encodedImageData; | 144 RefPtr<SharedBuffer> m_encodedImageData; |
145 ImageObserver* m_imageObserver; | 145 ImageObserver* m_imageObserver; |
146 }; | 146 }; |
147 | 147 |
148 } | 148 } |
149 | 149 |
150 #endif | 150 #endif |
OLD | NEW |