| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 qcms_profile* gOutputDeviceProfile = nullptr; | 302 qcms_profile* gOutputDeviceProfile = nullptr; |
| 303 | 303 |
| 304 } // namespace | 304 } // namespace |
| 305 | 305 |
| 306 // static | 306 // static |
| 307 void ImageDecoder::setColorProfileAndTransform(const char* iccData, unsigned icc
Length, bool hasAlpha, bool useSRGB) | 307 void ImageDecoder::setColorProfileAndTransform(const char* iccData, unsigned icc
Length, bool hasAlpha, bool useSRGB) |
| 308 { | 308 { |
| 309 m_sourceToOutputDeviceColorTransform.reset(); | 309 m_sourceToOutputDeviceColorTransform.reset(); |
| 310 | 310 |
| 311 // Create the input profile | 311 // Create the input profile |
| 312 OwnPtr<qcms_profile> inputProfile; | 312 QCMSProfileUniquePtr inputProfile; |
| 313 if (useSRGB) { | 313 if (useSRGB) { |
| 314 inputProfile = adoptPtr(qcms_profile_sRGB()); | 314 inputProfile.reset(qcms_profile_sRGB()); |
| 315 } else { | 315 } else { |
| 316 // Only accept RGB color profiles from input class devices. | 316 // Only accept RGB color profiles from input class devices. |
| 317 if (iccLength < kIccColorProfileHeaderLength) | 317 if (iccLength < kIccColorProfileHeaderLength) |
| 318 return; | 318 return; |
| 319 if (!rgbColorProfile(iccData, iccLength)) | 319 if (!rgbColorProfile(iccData, iccLength)) |
| 320 return; | 320 return; |
| 321 if (!inputDeviceColorProfile(iccData, iccLength)) | 321 if (!inputDeviceColorProfile(iccData, iccLength)) |
| 322 return; | 322 return; |
| 323 inputProfile = adoptPtr(qcms_profile_from_memory(iccData, iccLength)); | 323 inputProfile.reset(qcms_profile_from_memory(iccData, iccLength)); |
| 324 } | 324 } |
| 325 if (!inputProfile) | 325 if (!inputProfile) |
| 326 return; | 326 return; |
| 327 | 327 |
| 328 // We currently only support color profiles for RGB profiled images. | 328 // We currently only support color profiles for RGB profiled images. |
| 329 ASSERT(rgbData == qcms_profile_get_color_space(inputProfile.get())); | 329 ASSERT(rgbData == qcms_profile_get_color_space(inputProfile.get())); |
| 330 | 330 |
| 331 // Take a lock around initializing and accessing the global device color pro
file. | 331 // Take a lock around initializing and accessing the global device color pro
file. |
| 332 SpinLock::Guard guard(gOutputDeviceProfileLock); | 332 SpinLock::Guard guard(gOutputDeviceProfileLock); |
| 333 | 333 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 350 | 350 |
| 351 qcms_profile_precache_output_transform(gOutputDeviceProfile); | 351 qcms_profile_precache_output_transform(gOutputDeviceProfile); |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (qcms_profile_match(inputProfile.get(), gOutputDeviceProfile)) | 354 if (qcms_profile_match(inputProfile.get(), gOutputDeviceProfile)) |
| 355 return; | 355 return; |
| 356 | 356 |
| 357 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; | 357 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; |
| 358 | 358 |
| 359 // FIXME: Don't force perceptual intent if the image profile contains an int
ent. | 359 // FIXME: Don't force perceptual intent if the image profile contains an int
ent. |
| 360 m_sourceToOutputDeviceColorTransform = adoptPtr(qcms_transform_create(inputP
rofile.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PE
RCEPTUAL)); | 360 m_sourceToOutputDeviceColorTransform.reset(qcms_transform_create(inputProfil
e.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PERCEPT
UAL)); |
| 361 } | 361 } |
| 362 | 362 |
| 363 #endif // USE(QCMSLIB) | 363 #endif // USE(QCMSLIB) |
| 364 | 364 |
| 365 } // namespace blink | 365 } // namespace blink |
| OLD | NEW |