| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 { | 94 { |
| 95 return adoptRef(new NativeImageSkia(m_image, m_resizedImage, m_cachedIma
geInfo, m_resizeRequests)); | 95 return adoptRef(new NativeImageSkia(m_image, m_resizedImage, m_cachedIma
geInfo, m_resizeRequests)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 ~NativeImageSkia(); | 98 ~NativeImageSkia(); |
| 99 | 99 |
| 100 // Returns the number of bytes of image data. This includes the cached | 100 // Returns the number of bytes of image data. This includes the cached |
| 101 // resized version if there is one. | 101 // resized version if there is one. |
| 102 int decodedSize() const; | 102 int decodedSize() const; |
| 103 | 103 |
| 104 // Sets the immutable flag on the bitmap, indicating that the image data | |
| 105 // will not be modified any further. This is called by the image decoder | |
| 106 // when all data is complete, used by us to know whether we can cache | |
| 107 // resized images, and used by Skia for various optimizations. | |
| 108 void setDataComplete() { m_image.setImmutable(); } | |
| 109 | |
| 110 // Returns true if the entire image has been decoded. | 104 // Returns true if the entire image has been decoded. |
| 111 bool isDataComplete() const { return m_image.isImmutable(); } | 105 bool isDataComplete() const { return m_image.isImmutable(); } |
| 112 | 106 |
| 113 // Get reference to the internal SkBitmap representing this image. | 107 // Get reference to the internal SkBitmap representing this image. |
| 114 const SkBitmap& bitmap() const { return m_image; } | 108 const SkBitmap& bitmap() const { return m_image; } |
| 115 SkBitmap& bitmap() { return m_image; } | |
| 116 | 109 |
| 117 // We can keep a resized version of the bitmap cached on this object. | 110 // We can keep a resized version of the bitmap cached on this object. |
| 118 // This function will return true if there is a cached version of the given | 111 // This function will return true if there is a cached version of the given |
| 119 // scale and subset. | 112 // scale and subset. |
| 120 bool hasResizedBitmap(const SkISize& scaledImageSize, const SkIRect& scaledI
mageSubset) const; | 113 bool hasResizedBitmap(const SkISize& scaledImageSize, const SkIRect& scaledI
mageSubset) const; |
| 121 | 114 |
| 122 // This will return an existing resized image subset, or generate a new one | 115 // This will return an existing resized image subset, or generate a new one |
| 123 // of the specified size and subset and possibly cache it. | 116 // of the specified size and subset and possibly cache it. |
| 124 // | 117 // |
| 125 // scaledImageSize | 118 // scaledImageSize |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // those requests individually are small and would not otherwise be cached. | 192 // those requests individually are small and would not otherwise be cached. |
| 200 // | 193 // |
| 201 // We also track scaling information and destination subset for the scaled | 194 // We also track scaling information and destination subset for the scaled |
| 202 // image. See comments for ImageResourceInfo. | 195 // image. See comments for ImageResourceInfo. |
| 203 mutable ImageResourceInfo m_cachedImageInfo; | 196 mutable ImageResourceInfo m_cachedImageInfo; |
| 204 mutable int m_resizeRequests; | 197 mutable int m_resizeRequests; |
| 205 }; | 198 }; |
| 206 | 199 |
| 207 } | 200 } |
| 208 #endif // NativeImageSkia_h | 201 #endif // NativeImageSkia_h |
| OLD | NEW |