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 24 matching lines...) Expand all Loading... |
35 #include "platform/image-decoders/ImageFrame.h" | 35 #include "platform/image-decoders/ImageFrame.h" |
36 #include "platform/image-decoders/SegmentReader.h" | 36 #include "platform/image-decoders/SegmentReader.h" |
37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
38 #include "wtf/Assertions.h" | 38 #include "wtf/Assertions.h" |
39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
40 #include "wtf/Threading.h" | 40 #include "wtf/Threading.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
43 #include <memory> | 43 #include <memory> |
44 | 44 |
45 #if USE(SKCOLORXFORM) | 45 #if USE(QCMSLIB) |
46 #include "SkColorSpaceXform.h" | 46 #include "qcms.h" |
47 #endif | 47 #endif |
48 | 48 |
49 namespace blink { | 49 namespace blink { |
50 | 50 |
51 #if USE(SKCOLORXFORM) | 51 #if USE(QCMSLIB) |
52 #if SK_B32_SHIFT | 52 struct QCMSTransformDeleter { |
53 inline SkColorSpaceXform::ColorFormat xformColorFormat() { | 53 void operator()(qcms_transform* transform) { |
54 return SkColorSpaceXform::kRGBA_8888_ColorFormat; | 54 if (transform) |
55 } | 55 qcms_transform_release(transform); |
56 #else | 56 } |
57 inline SkColorSpaceXform::ColorFormat xformColorFormat() { | 57 }; |
58 return SkColorSpaceXform::kBGRA_8888_ColorFormat; | 58 |
59 } | 59 using QCMSTransformUniquePtr = |
60 #endif | 60 std::unique_ptr<qcms_transform, QCMSTransformDeleter>; |
61 #endif // USE(SKCOLORXFORM) | 61 #endif // USE(QCMSLIB) |
62 | 62 |
63 // ImagePlanes can be used to decode color components into provided buffers | 63 // ImagePlanes can be used to decode color components into provided buffers |
64 // instead of using an ImageFrame. | 64 // instead of using an ImageFrame. |
65 class PLATFORM_EXPORT ImagePlanes final { | 65 class PLATFORM_EXPORT ImagePlanes final { |
66 USING_FAST_MALLOC(ImagePlanes); | 66 USING_FAST_MALLOC(ImagePlanes); |
67 WTF_MAKE_NONCOPYABLE(ImagePlanes); | 67 WTF_MAKE_NONCOPYABLE(ImagePlanes); |
68 | 68 |
69 public: | 69 public: |
70 ImagePlanes(); | 70 ImagePlanes(); |
71 ImagePlanes(void* planes[3], const size_t rowBytes[3]); | 71 ImagePlanes(void* planes[3], const size_t rowBytes[3]); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 bool ignoresGammaAndColorProfile() const { | 218 bool ignoresGammaAndColorProfile() const { |
219 return m_ignoreGammaAndColorProfile; | 219 return m_ignoreGammaAndColorProfile; |
220 } | 220 } |
221 static void setTargetColorProfile(const WebVector<char>&); | 221 static void setTargetColorProfile(const WebVector<char>&); |
222 | 222 |
223 // Note that hasColorProfile refers to the existence of a not-ignored | 223 // Note that hasColorProfile refers to the existence of a not-ignored |
224 // embedded color profile, and is independent of whether or not that | 224 // embedded color profile, and is independent of whether or not that |
225 // profile's transform has been baked into the pixel values. | 225 // profile's transform has been baked into the pixel values. |
226 bool hasColorProfile() const { return m_hasColorProfile; } | 226 bool hasColorProfile() const { return m_hasColorProfile; } |
227 void setColorSpaceAndComputeTransform(const char* iccData, | 227 void setColorProfileAndComputeTransform(const char* iccData, |
228 unsigned iccLength, | 228 unsigned iccLength, |
229 bool useSRGB); | 229 bool hasAlpha, |
| 230 bool useSRGB); |
230 | 231 |
231 #if USE(SKCOLORXFORM) | 232 #if USE(QCMSLIB) |
232 // Transformation from encoded color space to target color space. | 233 // In contrast with hasColorProfile, this refers to the transform that has |
233 SkColorSpaceXform* colorTransform() { | 234 // been baked into the pixels. |
| 235 qcms_transform* colorTransform() { |
234 return m_sourceToOutputDeviceColorTransform.get(); | 236 return m_sourceToOutputDeviceColorTransform.get(); |
235 } | 237 } |
236 #endif | 238 #endif |
237 | 239 |
238 // Sets the "decode failure" flag. For caller convenience (since so | 240 // Sets the "decode failure" flag. For caller convenience (since so |
239 // many callers want to return false after calling this), returns false | 241 // many callers want to return false after calling this), returns false |
240 // to enable easy tailcalling. Subclasses may override this to also | 242 // to enable easy tailcalling. Subclasses may override this to also |
241 // clean up any local data. | 243 // clean up any local data. |
242 virtual bool setFailed() { | 244 virtual bool setFailed() { |
243 m_failed = true; | 245 m_failed = true; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 354 } |
353 | 355 |
354 IntSize m_size; | 356 IntSize m_size; |
355 bool m_sizeAvailable = false; | 357 bool m_sizeAvailable = false; |
356 bool m_isAllDataReceived = false; | 358 bool m_isAllDataReceived = false; |
357 bool m_failed = false; | 359 bool m_failed = false; |
358 | 360 |
359 bool m_hasColorProfile = false; | 361 bool m_hasColorProfile = false; |
360 ImageFrame::ICCProfile m_colorProfile; | 362 ImageFrame::ICCProfile m_colorProfile; |
361 | 363 |
362 #if USE(SKCOLORXFORM) | 364 #if USE(QCMSLIB) |
363 std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform; | 365 QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform; |
364 #endif | 366 #endif |
365 }; | 367 }; |
366 | 368 |
367 } // namespace blink | 369 } // namespace blink |
368 | 370 |
369 #endif | 371 #endif |
OLD | NEW |