| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 virtual float frameDurationAtIndex(size_t) const { return 0; } | 200 virtual float frameDurationAtIndex(size_t) const { return 0; } |
| 201 | 201 |
| 202 // Number of bytes in the decoded frame. Returns 0 if the decoder doesn't | 202 // Number of bytes in the decoded frame. Returns 0 if the decoder doesn't |
| 203 // have this frame cached (either because it hasn't been decoded, or because | 203 // have this frame cached (either because it hasn't been decoded, or because |
| 204 // it has been cleared). | 204 // it has been cleared). |
| 205 virtual size_t frameBytesAtIndex(size_t) const; | 205 virtual size_t frameBytesAtIndex(size_t) const; |
| 206 | 206 |
| 207 ImageOrientation orientation() const { return m_orientation; } | 207 ImageOrientation orientation() const { return m_orientation; } |
| 208 | 208 |
| 209 bool ignoresColorSpace() const { return m_ignoreColorSpace; } | 209 bool ignoresColorSpace() const { return m_ignoreColorSpace; } |
| 210 static void setTargetColorProfile(const WebVector<char>&); | 210 |
| 211 // Set the target color profile into which all images with embedded color |
| 212 // profiles should be converted. Note that only the first call to this |
| 213 // function in this process has any effect. |
| 214 static void setGlobalTargetColorProfile(const WebVector<char>&); |
| 215 static sk_sp<SkColorSpace> globalTargetColorSpace(); |
| 211 | 216 |
| 212 // This returns the color space of this image. If the image had no embedded | 217 // This returns the color space of this image. If the image had no embedded |
| 213 // color profile, this will return sRGB. Returns nullptr if color correct | 218 // color profile, this will return sRGB. Returns nullptr if color correct |
| 214 // rendering is not enabled. | 219 // rendering is not enabled. |
| 215 sk_sp<SkColorSpace> colorSpace() const; | 220 sk_sp<SkColorSpace> colorSpace() const; |
| 216 | 221 |
| 217 // This returns whether or not the image included a not-ignored embedded | 222 // This returns whether or not the image included a not-ignored embedded |
| 218 // color space. This is independent of whether or not that space's transform | 223 // color space. This is independent of whether or not that space's transform |
| 219 // has been baked into the pixel values. | 224 // has been baked into the pixel values. |
| 220 bool hasEmbeddedColorSpace() const { return m_embeddedColorSpace.get(); } | 225 bool hasEmbeddedColorSpace() const { return m_embeddedColorSpace.get(); } |
| 221 | 226 |
| 222 // Set the embedded color space directly or via ICC profile. | 227 // Set the embedded color space directly or via ICC profile. |
| 223 void setColorProfileAndComputeTransform(const char* iccData, | 228 void setEmbeddedColorProfile(const char* iccData, unsigned iccLength); |
| 224 unsigned iccLength); | 229 void setEmbeddedColorSpace(sk_sp<SkColorSpace> srcSpace); |
| 225 void setColorSpaceAndComputeTransform(sk_sp<SkColorSpace> srcSpace); | |
| 226 | 230 |
| 227 // Transformation from encoded color space to target color space. | 231 // Transformation from embedded color space to target color space. |
| 228 SkColorSpaceXform* colorTransform() { | 232 SkColorSpaceXform* colorTransform(); |
| 229 return m_sourceToOutputDeviceColorTransform.get(); | |
| 230 } | |
| 231 | 233 |
| 232 // Sets the "decode failure" flag. For caller convenience (since so | 234 // Sets the "decode failure" flag. For caller convenience (since so |
| 233 // many callers want to return false after calling this), returns false | 235 // many callers want to return false after calling this), returns false |
| 234 // to enable easy tailcalling. Subclasses may override this to also | 236 // to enable easy tailcalling. Subclasses may override this to also |
| 235 // clean up any local data. | 237 // clean up any local data. |
| 236 virtual bool setFailed() { | 238 virtual bool setFailed() { |
| 237 m_failed = true; | 239 m_failed = true; |
| 238 return false; | 240 return false; |
| 239 } | 241 } |
| 240 | 242 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // Called by initFrameBuffer to determine if it can take the bitmap of the | 373 // Called by initFrameBuffer to determine if it can take the bitmap of the |
| 372 // previous frame. This condition is different for GIF and WEBP. | 374 // previous frame. This condition is different for GIF and WEBP. |
| 373 virtual bool canReusePreviousFrameBuffer(size_t) const { return false; } | 375 virtual bool canReusePreviousFrameBuffer(size_t) const { return false; } |
| 374 | 376 |
| 375 IntSize m_size; | 377 IntSize m_size; |
| 376 bool m_sizeAvailable = false; | 378 bool m_sizeAvailable = false; |
| 377 bool m_isAllDataReceived = false; | 379 bool m_isAllDataReceived = false; |
| 378 bool m_failed = false; | 380 bool m_failed = false; |
| 379 bool m_hasHistogrammedColorSpace = false; | 381 bool m_hasHistogrammedColorSpace = false; |
| 380 | 382 |
| 383 sk_sp<SkColorSpace> m_targetColorSpace = nullptr; |
| 381 sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr; | 384 sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr; |
| 382 std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform; | 385 bool m_sourceToTargetColorTransformNeedsUpdate = false; |
| 386 std::unique_ptr<SkColorSpaceXform> m_sourceToTargetColorTransform; |
| 383 }; | 387 }; |
| 384 | 388 |
| 385 } // namespace blink | 389 } // namespace blink |
| 386 | 390 |
| 387 #endif | 391 #endif |
| OLD | NEW |