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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 virtual bool currentFrameIsComplete() { return false; } | 82 virtual bool currentFrameIsComplete() { return false; } |
83 virtual bool currentFrameIsLazyDecoded() { return false; } | 83 virtual bool currentFrameIsLazyDecoded() { return false; } |
84 virtual bool isTextureBacked(); | 84 virtual bool isTextureBacked(); |
85 | 85 |
86 // Derived classes should override this if they can assure that the current | 86 // Derived classes should override this if they can assure that the current |
87 // image frame contains only resources from its own security origin. | 87 // image frame contains only resources from its own security origin. |
88 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } | 88 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } |
89 | 89 |
90 static Image* nullImage(); | 90 static Image* nullImage(); |
91 bool isNull() const { return size().isEmpty(); } | 91 bool isNull() const { return defaultConcreteObjectSize().isEmpty(); } |
92 | 92 |
93 virtual bool usesContainerSize() const { return false; } | 93 virtual bool usesContainerSize() const { return false; } |
94 virtual bool hasRelativeSize() const { return false; } | 94 virtual bool hasRelativeSize() const { return false; } |
95 | 95 |
96 // Computes (extracts) the intrinsic dimensions and ratio from the Image. Th
e intrinsic ratio | 96 // Computes (extracts) the intrinsic dimensions and ratio from the Image. Th
e intrinsic ratio |
97 // will be the 'viewport' of the image. (Same as the dimensions for a raster
image. For SVG | 97 // will be the 'viewport' of the image. (Same as the dimensions for a raster
image. For SVG |
98 // images it can be the dimensions defined by the 'viewBox'.) | 98 // images it can be the dimensions defined by the 'viewBox'.) |
99 virtual void computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize&
intrinsicRatio); | 99 virtual void computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize&
intrinsicRatio); |
100 | 100 |
101 virtual IntSize size() const = 0; | 101 virtual IntSize concreteObjectSize(const FloatSize& defaultObjectSize) const
= 0; |
102 IntRect rect() const { return IntRect(IntPoint(), size()); } | 102 IntSize defaultConcreteObjectSize() const { return concreteObjectSize(FloatS
ize(300, 150)); } |
103 int width() const { return size().width(); } | 103 IntRect defaultConcreteObjectSizeRect() const { return IntRect(IntPoint(), d
efaultConcreteObjectSize()); } |
104 int height() const { return size().height(); } | 104 int defaultConcreteObjectSizeWidth() const { return defaultConcreteObjectSiz
e().width(); } |
| 105 int defaultConcreteObjectSizeHeight() const { return defaultConcreteObjectSi
ze().height(); } |
105 virtual bool getHotSpot(IntPoint&) const { return false; } | 106 virtual bool getHotSpot(IntPoint&) const { return false; } |
106 | 107 |
107 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); | 108 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); |
108 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } | 109 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } |
109 | 110 |
110 virtual String filenameExtension() const { return String(); } // null string
if unknown | 111 virtual String filenameExtension() const { return String(); } // null string
if unknown |
111 | 112 |
112 virtual void destroyDecodedData(bool destroyAll) = 0; | 113 virtual void destroyDecodedData(bool destroyAll) = 0; |
113 | 114 |
114 SharedBuffer* data() { return m_encodedImageData.get(); } | 115 SharedBuffer* data() { return m_encodedImageData.get(); } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // being responsible of clearing itself out. | 170 // being responsible of clearing itself out. |
170 RawPtrWillBeUntracedMember<ImageObserver> m_imageObserver; | 171 RawPtrWillBeUntracedMember<ImageObserver> m_imageObserver; |
171 }; | 172 }; |
172 | 173 |
173 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 174 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
174 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) | 175 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) |
175 | 176 |
176 } // namespace blink | 177 } // namespace blink |
177 | 178 |
178 #endif | 179 #endif |
OLD | NEW |