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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 friend class GraphicsContext; | 63 friend class GraphicsContext; |
64 | 64 |
65 public: | 65 public: |
66 virtual ~Image(); | 66 virtual ~Image(); |
67 | 67 |
68 static PassRefPtr<Image> loadPlatformResource(const char* name); | 68 static PassRefPtr<Image> loadPlatformResource(const char* name); |
69 static bool supportsType(const String&); | 69 static bool supportsType(const String&); |
70 | 70 |
71 virtual bool isSVGImage() const { return false; } | 71 virtual bool isSVGImage() const { return false; } |
72 virtual bool isBitmapImage() const { return false; } | 72 virtual bool isBitmapImage() const { return false; } |
73 virtual bool currentFrameKnownToBeOpaque() = 0; | 73 |
| 74 // To increase accuracy of currentFrameKnownToBeOpaque() it may, |
| 75 // for applicable image types, be told to pre-cache metadata for |
| 76 // the current frame. Since this may initiate a deferred image |
| 77 // decoding, PreCacheMetadata requires a InspectorPaintImageEvent |
| 78 // during call. |
| 79 enum MetadataMode { UseCurrentMetadata, PreCacheMetadata }; |
| 80 virtual bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata)
= 0; |
| 81 |
74 virtual bool currentFrameIsComplete() { return false; } | 82 virtual bool currentFrameIsComplete() { return false; } |
75 virtual bool currentFrameIsLazyDecoded() { return false; } | 83 virtual bool currentFrameIsLazyDecoded() { return false; } |
76 virtual bool isTextureBacked(); | 84 virtual bool isTextureBacked(); |
77 | 85 |
78 // 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 |
79 // image frame contains only resources from its own security origin. | 87 // image frame contains only resources from its own security origin. |
80 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } | 88 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } |
81 | 89 |
82 static Image* nullImage(); | 90 static Image* nullImage(); |
83 bool isNull() const { return size().isEmpty(); } | 91 bool isNull() const { return size().isEmpty(); } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 RefPtr<SharedBuffer> m_encodedImageData; | 166 RefPtr<SharedBuffer> m_encodedImageData; |
159 ImageObserver* m_imageObserver; | 167 ImageObserver* m_imageObserver; |
160 }; | 168 }; |
161 | 169 |
162 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 170 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
163 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) | 171 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) |
164 | 172 |
165 } // namespace blink | 173 } // namespace blink |
166 | 174 |
167 #endif | 175 #endif |
OLD | NEW |