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(QCMSLIB) | 45 #if USE(SKCOLORXFORM) |
46 #include "qcms.h" | 46 #include "SkColorSpaceXform.h" |
47 #endif | 47 #endif |
48 | 48 |
49 namespace blink { | 49 namespace blink { |
50 | 50 |
51 #if USE(QCMSLIB) | 51 #if USE(SKCOLORXFORM) |
52 struct QCMSTransformDeleter { | 52 #if SK_B32_SHIFT |
53 void operator()(qcms_transform* transform) { | 53 inline SkColorSpaceXform::ColorFormat xformColorFormat() { |
54 if (transform) | 54 return SkColorSpaceXform::kRGBA_8888_ColorFormat; |
55 qcms_transform_release(transform); | 55 } |
56 } | 56 #else |
57 }; | 57 inline SkColorSpaceXform::ColorFormat xformColorFormat() { |
58 | 58 return SkColorSpaceXform::kBGRA_8888_ColorFormat; |
59 using QCMSTransformUniquePtr = | 59 } |
60 std::unique_ptr<qcms_transform, QCMSTransformDeleter>; | 60 #endif |
61 #endif // USE(QCMSLIB) | 61 #endif // USE(SKCOLORXFORM) |
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 setColorProfileAndComputeTransform(const char* iccData, | 227 void setColorSpaceAndComputeTransform(const char* iccData, |
228 unsigned iccLength, | 228 unsigned iccLength, |
229 bool hasAlpha, | 229 bool useSRGB); |
230 bool useSRGB); | |
231 | 230 |
232 #if USE(QCMSLIB) | 231 #if USE(SKCOLORXFORM) |
233 // In contrast with hasColorProfile, this refers to the transform that has | 232 // Transformation from encoded color space to target color space. |
234 // been baked into the pixels. | 233 SkColorSpaceXform* colorTransform() { |
235 qcms_transform* colorTransform() { | |
236 return m_sourceToOutputDeviceColorTransform.get(); | 234 return m_sourceToOutputDeviceColorTransform.get(); |
237 } | 235 } |
238 #endif | 236 #endif |
239 | 237 |
240 // Sets the "decode failure" flag. For caller convenience (since so | 238 // Sets the "decode failure" flag. For caller convenience (since so |
241 // many callers want to return false after calling this), returns false | 239 // many callers want to return false after calling this), returns false |
242 // to enable easy tailcalling. Subclasses may override this to also | 240 // to enable easy tailcalling. Subclasses may override this to also |
243 // clean up any local data. | 241 // clean up any local data. |
244 virtual bool setFailed() { | 242 virtual bool setFailed() { |
245 m_failed = true; | 243 m_failed = true; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 352 } |
355 | 353 |
356 IntSize m_size; | 354 IntSize m_size; |
357 bool m_sizeAvailable = false; | 355 bool m_sizeAvailable = false; |
358 bool m_isAllDataReceived = false; | 356 bool m_isAllDataReceived = false; |
359 bool m_failed = false; | 357 bool m_failed = false; |
360 | 358 |
361 bool m_hasColorProfile = false; | 359 bool m_hasColorProfile = false; |
362 ImageFrame::ICCProfile m_colorProfile; | 360 ImageFrame::ICCProfile m_colorProfile; |
363 | 361 |
364 #if USE(QCMSLIB) | 362 #if USE(SKCOLORXFORM) |
365 QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform; | 363 std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform; |
366 #endif | 364 #endif |
367 }; | 365 }; |
368 | 366 |
369 } // namespace blink | 367 } // namespace blink |
370 | 368 |
371 #endif | 369 #endif |
OLD | NEW |