Changeset 120396 in webkit
- Timestamp:
- Jun 14, 2012 9:21:38 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r120392 r120396 1 2012-06-14 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r120393. 4 http://trac.webkit.org/changeset/120393 5 https://bugs.webkit.org/show_bug.cgi?id=89163 6 7 breaks cr-mac build (Requested by morrita on #webkit). 8 9 * platform/chromium/TestExpectations: 10 1 11 2012-06-14 Sheriff Bot <webkit.review.bot@gmail.com> 2 12 -
trunk/LayoutTests/platform/chromium/TestExpectations
r120393 r120396 1175 1175 BUGCR62433 WIN : fast/images/gif-loop-count.html = IMAGE 1176 1176 1177 // Implement color profile support. 1178 BUGCR143 : fast/images/jpeg-with-color-profile.html = MISSING 1179 BUGCR143 : fast/images/png-with-color-profile.html = MISSING 1180 1177 1181 // ----------------------------------------------------------------- 1178 1182 // SVG TESTS … … 3534 3538 BUGWK68744 : fast/block/float/float-not-removed-from-next-sibling4.html = IMAGE 3535 3539 3536 // Needs to be rebaselined.3537 BUGWK87761 MAC LINUX WIN : compositing/color-matching/image-color-matching.html = IMAGE3538 BUGWK87761 MAC : compositing/masks/direct-image-mask.html = IMAGE3539 BUGWK87761 MAC : compositing/reflections/simple-composited-reflections.html = IMAGE3540 BUGWK87761 MAC : compositing/visibility/visibility-image-layers.html = IMAGE3541 BUGWK87761 MAC LINUX WIN : css3/filters/crash-filter-change.html = IMAGE3542 BUGWK87761 MAC LINUX WIN : css3/filters/crash-hw-sw-switch.html = IMAGE3543 BUGWK87761 LINUX : css3/filters/custom/custom-filter-shader-cache.html = IMAGE3544 BUGWK87761 MAC : css3/filters/custom/effect-color-check.html = IMAGE3545 BUGWK87761 LINUX : css3/filters/custom/effect-custom-combined-missing.html = IMAGE3546 BUGWK87761 LINUX : css3/filters/custom/effect-custom.html = IMAGE3547 BUGWK87761 MAC LINUX : css3/filters/custom/missing-custom-filter-shader.html = IMAGE3548 BUGWK87761 MAC LINUX WIN : css3/filters/effect-blur-hw.html = IMAGE3549 BUGWK87761 MAC LINUX WIN : css3/filters/effect-blur.html = IMAGE3550 BUGWK87761 MAC LINUX WIN : css3/filters/effect-brightness-hw.html = IMAGE3551 BUGWK87761 MAC LINUX WIN : css3/filters/effect-brightness.html = IMAGE3552 BUGWK87761 MAC LINUX WIN : css3/filters/effect-combined-hw.html = IMAGE3553 BUGWK87761 MAC LINUX WIN : css3/filters/effect-combined.html = IMAGE3554 BUGWK87761 MAC LINUX WIN : css3/filters/effect-contrast-hw.html = IMAGE3555 BUGWK87761 MAC LINUX WIN : css3/filters/effect-contrast.html = IMAGE3556 BUGWK87761 MAC LINUX WIN : css3/filters/effect-drop-shadow-hw.html = IMAGE3557 BUGWK87761 MAC LINUX WIN : css3/filters/effect-drop-shadow.html = IMAGE3558 BUGWK87761 MAC LINUX WIN : css3/filters/effect-grayscale-hw.html = IMAGE3559 BUGWK87761 MAC LINUX WIN : css3/filters/effect-grayscale.html = IMAGE3560 BUGWK87761 MAC LINUX WIN : css3/filters/effect-hue-rotate-hw.html = IMAGE3561 BUGWK87761 MAC LINUX WIN : css3/filters/effect-hue-rotate.html = IMAGE3562 BUGWK87761 MAC LINUX WIN : css3/filters/effect-invert-hw.html = IMAGE3563 BUGWK87761 MAC LINUX WIN : css3/filters/effect-invert.html = IMAGE3564 BUGWK87761 MAC LINUX WIN : css3/filters/effect-opacity-hw.html = IMAGE3565 BUGWK87761 MAC LINUX WIN : css3/filters/effect-opacity.html = IMAGE3566 BUGWK87761 MAC LINUX WIN : css3/filters/effect-saturate-hw.html = IMAGE3567 BUGWK87761 MAC LINUX WIN : css3/filters/effect-saturate.html = IMAGE3568 BUGWK87761 MAC LINUX WIN : css3/filters/effect-sepia-hw.html = IMAGE3569 BUGWK87761 MAC LINUX WIN : css3/filters/effect-sepia.html = IMAGE3570 BUGWK87761 MAC LINUX WIN : css3/filters/regions-expanding.html = IMAGE3571 BUGWK87761 MAC : fast/css/background-shorthand-invalid-url.html = IMAGE3572 BUGWK87761 MAC : fast/css/color-correction-on-backgrounds.html = IMAGE3573 BUGWK87761 MAC : fast/css/color-correction.html = IMAGE3574 BUGWK87761 MAC : fast/images/color-jpeg-with-color-profile.html = IMAGE3575 BUGWK87761 MAC : fast/media/mq-min-pixel-ratio.html = IMAGE3576 BUGWK87761 MAC : fast/reflections/reflection-direction.html = IMAGE3577 BUGWK87761 MAC : fast/reflections/reflection-masks-opacity.html = IMAGE3578 BUGWK87761 MAC : fast/reflections/reflection-with-zoom.html = IMAGE3579 // There is already an entry for MAC DEBUG3580 BUGWK87761 MAC RELEASE : fast/reflections/reflection-masks-outset.html = IMAGE3581 BUGWK87761 MAC : fast/reflections/reflection-masks.html = IMAGE3582 BUGWK87761 MAC LINUX : http/tests/local/file-url-sent-as-referer.html = IMAGE3583 BUGWK87761 MAC : platform/chromium/virtual/threaded/compositing/visibility/visibility-image-layers.html = IMAGE3584 BUGWK87761 MAC LINUX : scrollbars/listbox-scrollbar-combinations.html = IMAGE3585 BUGWK87761 MAC LINUX : scrollbars/overflow-scrollbar-combinations.html = IMAGE3586 BUGWK87761 LINUX : svg/as-border-image/svg-as-border-image.html = IMAGE3587 BUGWK87761 MAC LINUX : svg/custom/createImageElement.svg = IMAGE3588 BUGWK87761 MAC LINUX : svg/custom/createImageElement2.xhtml = IMAGE3589 BUGWK87761 MAC LINUX : svg/custom/focus-ring.svg = IMAGE3590 BUGWK87761 MAC LINUX : svg/custom/group-opacity.svg = IMAGE3591 BUGWK87761 MAC LINUX : svg/custom/image-parent-translation.xhtml = IMAGE3592 BUGWK87761 MAC LINUX : svg/custom/image-small-width-height.svg = IMAGE3593 BUGWK87761 MAC : svg/custom/image-with-transform-clip-filter.svg = IMAGE3594 BUGWK87761 MAC LINUX : svg/custom/js-update-image-and-display.svg = IMAGE3595 BUGWK87761 MAC LINUX : svg/custom/js-update-image-and-display2.svg = IMAGE3596 BUGWK87761 MAC LINUX : svg/custom/js-update-image-and-display3.svg = IMAGE3597 BUGWK87761 MAC LINUX : svg/custom/js-update-image.svg = IMAGE3598 BUGWK87761 MAC : svg/custom/pointer-events-image-css-transform.svg = IMAGE3599 BUGWK87761 MAC : svg/custom/pointer-events-image.svg = IMAGE3600 BUGWK87761 MAC LINUX : svg/custom/text-image-opacity.svg = IMAGE3601 BUGWK87761 MAC LINUX : svg/custom/use-on-g-containing-foreignObject-and-image.svg = IMAGE3602 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-dom-height-attr.html = IMAGE3603 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-dom-preserveAspectRatio-attr.html = IMAGE3604 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-dom-width-attr.html = IMAGE3605 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-dom-x-attr.html = IMAGE3606 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-dom-y-attr.html = IMAGE3607 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-svgdom-height-prop.html = IMAGE3608 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-svgdom-preserveAspectRatio-prop.html = IMAGE3609 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-svgdom-width-prop.html = IMAGE3610 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-svgdom-x-prop.html = IMAGE3611 BUGWK87761 MAC LINUX : svg/dynamic-updates/SVGImageElement-svgdom-y-prop.html = IMAGE3612 BUGWK87761 MAC LINUX : svg/filters/feImage-subregions-preseveAspectRatio-none-with-viewBox.svg = IMAGE3613 BUGWK87761 MAC LINUX : svg/filters/feImage-subregions-preseveAspectRatio-none.svg = IMAGE3614 BUGWK87761 MAC LINUX : svg/filters/feImage-subregions.svg = IMAGE3615 BUGWK87761 MAC LINUX : svg/filters/filter-source-position.svg = IMAGE3616 BUGWK87761 MAC LINUX : svg/repaint/image-href-change.svg = IMAGE3617 BUGWK87761 MAC LINUX : svg/transforms/animated-path-inside-transformed-html.xhtml = IMAGE3618 BUGWK87761 MAC : svg/wicd/test-rightsizing-b.xhtml = IMAGE3619 BUGWK87761 MAC LINUX : svg/zoom/page/zoom-background-images.html = IMAGE3620 BUGWK87761 MAC LINUX : svg/zoom/page/zoom-svg-through-object-with-absolute-size-2.xhtml = IMAGE3621 BUGWK87761 MAC LINUX : svg/zoom/page/zoom-svg-through-object-with-absolute-size.xhtml = IMAGE3622 BUGWK87761 MAC LINUX : svg/zoom/page/zoom-svg-through-object-with-percentage-size.xhtml = IMAGE3623 BUGWK87761 MAC : tables/mozilla/bugs/bug82946-2.html = IMAGE3624 BUGWK87761 MAC LINUX WIN : fast/images/jpeg-with-color-profile.html = MISSING3625 BUGWK87761 MAC LINUX WIN : fast/images/png-with-color-profile.html = MISSING3626 3627 3628 3540 BUGWK83076 SNOWLEOPARD RELEASE : compositing/geometry/outline-change.html = TIMEOUT PASS 3629 3541 BUGWK83076 SNOWLEOPARD RELEASE : css3/selectors3/xml/css3-modsel-161.xml = TIMEOUT PASS -
trunk/Source/WTF/ChangeLog
r120393 r120396 1 2012-06-14 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r120393. 4 http://trac.webkit.org/changeset/120393 5 https://bugs.webkit.org/show_bug.cgi?id=89163 6 7 breaks cr-mac build (Requested by morrita on #webkit). 8 9 * wtf/Platform.h: 10 1 11 2012-06-14 Tony Payne <tpayne@chromium.org> 2 12 -
trunk/Source/WTF/wtf/Platform.h
r120393 r120396 468 468 #if PLATFORM(CHROMIUM) 469 469 #if OS(DARWIN) 470 #if USE(SKIA_ON_MAC_CHROMIUM) 470 471 #define WTF_USE_SKIA 1 472 #else 473 #define WTF_USE_CG 1 474 #endif 471 475 #define WTF_USE_ATSUI 1 472 476 #define WTF_USE_CORE_TEXT 1 473 477 #define WTF_USE_ICCJPEG 1 474 #define WTF_USE_QCMSLIB 1475 478 #elif OS(ANDROID) 476 479 #define WTF_USE_SKIA 1 … … 478 481 #define WTF_USE_SKIA 1 479 482 #define WTF_USE_CHROMIUM_NET 1 480 #define WTF_USE_ICCJPEG 1481 #define WTF_USE_QCMSLIB 1482 483 #endif 483 484 #endif -
trunk/Source/WebCore/ChangeLog
r120395 r120396 1 2012-06-14 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r120393. 4 http://trac.webkit.org/changeset/120393 5 https://bugs.webkit.org/show_bug.cgi?id=89163 6 7 breaks cr-mac build (Requested by morrita on #webkit). 8 9 * WebCore.gyp/WebCore.gyp: 10 * platform/image-decoders/ImageDecoder.h: 11 (ImageFrame): 12 (ImageDecoder): 13 * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: 14 (turboSwizzled): 15 (WebCore::JPEGImageReader::JPEGImageReader): 16 (WebCore::JPEGImageReader::close): 17 (WebCore::JPEGImageReader::decode): 18 (JPEGImageReader): 19 (WebCore::JPEGImageDecoder::outputScanlines): 20 * platform/image-decoders/png/PNGImageDecoder.cpp: 21 (WebCore::PNGImageReader::PNGImageReader): 22 (WebCore::PNGImageReader::close): 23 (WebCore::PNGImageReader::currentBufferSize): 24 (PNGImageReader): 25 (WebCore::PNGImageReader::decodingSizeOnly): 26 (WebCore::PNGImageReader::interlaceBuffer): 27 (WebCore::PNGImageReader::hasAlpha): 28 (WebCore::PNGImageReader::setHasAlpha): 29 (WebCore::PNGImageDecoder::headerAvailable): 30 (WebCore::PNGImageDecoder::rowAvailable): 31 * platform/image-decoders/skia/ImageDecoderSkia.cpp: 32 (WebCore): 33 (WebCore::resolveColorSpace): 34 (WebCore::createColorSpace): 35 (WebCore::ImageFrame::setColorProfile): 36 (WebCore::ImageFrame::setStatus): 37 1 38 2012-06-14 Julien Chaffraix <jchaffraix@webkit.org> 2 39 -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r120393 r120396 1113 1113 '<(chromium_src_dir)/third_party/libwebp/libwebp.gyp:libwebp', 1114 1114 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', 1115 '<(chromium_src_dir)/third_party/qcms/qcms.gyp:qcms',1116 1115 '<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite', 1117 1116 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', … … 1242 1241 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', 1243 1242 '<(chromium_src_dir)/third_party/ots/ots.gyp:ots', 1244 '<(chromium_src_dir)/third_party/qcms/qcms.gyp:qcms',1245 1243 '<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite', 1246 1244 '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_glsl', … … 1262 1260 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', 1263 1261 '<(chromium_src_dir)/third_party/ots/ots.gyp:ots', 1264 '<(chromium_src_dir)/third_party/qcms/qcms.gyp:qcms',1265 1262 '<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite', 1266 1263 '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_glsl', … … 2015 2012 '<(chromium_src_dir)/skia/skia.gyp:skia', 2016 2013 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', 2017 '<(chromium_src_dir)/third_party/qcms/qcms.gyp:qcms',2018 2014 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', 2019 2015 ], … … 2024 2020 '<(chromium_src_dir)/skia/skia.gyp:skia', 2025 2021 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', 2026 '<(chromium_src_dir)/third_party/qcms/qcms.gyp:qcms',2027 2022 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', 2028 2023 ], -
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h
r120393 r120396 43 43 #endif 44 44 45 #if USE(QCMSLIB)46 #include "qcms.h"47 #include <wtf/MainThread.h>48 #if OS(DARWIN)49 #include "GraphicsContextCG.h"50 #include <CoreGraphics/CGColorSpace.h>51 #include <CoreGraphics/CGDirectDisplay.h>52 #include <CoreGraphics/CGDisplayConfiguration.h>53 #include <wtf/RetainPtr.h>54 #endif55 #endif56 57 45 namespace WebCore { 58 46 … … 178 166 #if USE(SKIA) 179 167 NativeImageSkia m_bitmap; 168 #if PLATFORM(CHROMIUM) && OS(DARWIN) 169 ColorProfile m_colorProfile; 170 #endif 180 171 #else 181 172 Vector<PixelData> m_backingStore; … … 183 174 IntSize m_size; 184 175 bool m_hasAlpha; 185 // FIXME: Do we need m_colorProfile anymore?186 176 ColorProfile m_colorProfile; 187 177 #endif … … 300 290 } 301 291 302 #if USE(QCMSLIB)303 static qcms_profile* qcmsOutputDeviceProfile()304 {305 static qcms_profile* outputDeviceProfile = 0;306 307 static bool qcmsInitialized = false;308 if (!qcmsInitialized) {309 ASSERT(isMainThread());310 qcmsInitialized = true;311 // FIXME: Add optional ICCv4 support.312 #if OS(DARWIN)313 RetainPtr<CGColorSpaceRef> monitorColorSpace(AdoptCF, CGDisplayCopyColorSpace(CGMainDisplayID()));314 CFDataRef iccProfile(CGColorSpaceCopyICCProfile(monitorColorSpace.get()));315 if (iccProfile) {316 size_t length = CFDataGetLength(iccProfile);317 const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile);318 outputDeviceProfile = qcms_profile_from_memory(systemProfile, length);319 if (outputDeviceProfile && qcms_profile_is_bogus(outputDeviceProfile)) {320 qcms_profile_release(outputDeviceProfile);321 outputDeviceProfile = 0;322 }323 }324 if (!outputDeviceProfile)325 outputDeviceProfile = qcms_profile_sRGB();326 #else327 // FIXME: sRGB profiles don't add much value. Use the user's monitor profile.328 outputDeviceProfile = qcms_profile_sRGB();329 #endif330 // FIXME: Check that the profile is valid. Fallback to sRGB if not?331 if (outputDeviceProfile)332 qcms_profile_precache_output_transform(outputDeviceProfile);333 }334 return outputDeviceProfile;335 }336 #endif337 338 292 // Sets the "decode failure" flag. For caller convenience (since so 339 293 // many callers want to return false after calling this), returns false … … 367 321 RefPtr<SharedBuffer> m_data; // The encoded data. 368 322 Vector<ImageFrame> m_frameBufferCache; 369 // FIXME: Do we need m_colorProfile any more, for any port?370 323 ColorProfile m_colorProfile; 371 324 bool m_scaled; -
trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
r120393 r120396 61 61 #include "iccjpeg.h" 62 62 #endif 63 #if USE(QCMSLIB)64 #include "qcms.h"65 #endif66 63 #include <setjmp.h> 67 64 } … … 80 77 inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_EXT_BGRA; } 81 78 #endif 82 inline bool turboSwizzled(J_COLOR_SPACE colorSpace) { return colorSpace == JCS_EXT_RGBA || colorSpace == JCS_EXT_BGRA; } 83 inline bool colorSpaceHasAlpha(J_COLOR_SPACE colorSpace) { return turboSwizzled(colorSpace); } 79 inline bool turboSwizzled(J_COLOR_SPACE colorSpace) { return colorSpace == rgbOutputColorSpace(); } 84 80 #else 85 81 inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_RGB; } 86 inline bool colorSpaceHasAlpha(J_COLOR_SPACE) { return false; }87 82 #endif 88 83 … … 169 164 , m_state(JPEG_HEADER) 170 165 , m_samples(0) 171 #if USE(QCMSLIB)172 , m_transform(0)173 #endif174 166 { 175 167 memset(&m_info, 0, sizeof(jpeg_decompress_struct)); … … 219 211 m_info.src = 0; 220 212 221 #if USE(QCMSLIB)222 if (m_transform)223 qcms_transform_release(m_transform);224 m_transform = 0;225 #endif226 213 jpeg_destroy_decompress(&m_info); 227 214 } … … 312 299 if (!rgbInputDeviceColorProfile.isEmpty()) 313 300 m_decoder->setColorProfile(rgbInputDeviceColorProfile); 314 #if USE(QCMSLIB)315 createColorTransform(rgbInputDeviceColorProfile, colorSpaceHasAlpha(m_info.out_color_space));316 #if defined(TURBO_JPEG_RGB_SWIZZLE)317 // Input RGBA data to qcms. Note: restored to BGRA on output.318 if (m_transform && m_info.out_color_space == JCS_EXT_BGRA)319 m_info.out_color_space = JCS_EXT_RGBA;320 #endif321 #endif322 301 } 323 302 … … 424 403 JSAMPARRAY samples() const { return m_samples; } 425 404 JPEGImageDecoder* decoder() { return m_decoder; } 426 #if USE(QCMSLIB)427 qcms_transform* colorTransform() const { return m_transform; }428 429 void createColorTransform(const ColorProfile& colorProfile, bool hasAlpha)430 {431 if (m_transform)432 qcms_transform_release(m_transform);433 m_transform = 0;434 435 if (colorProfile.isEmpty())436 return;437 qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile();438 if (!deviceProfile)439 return;440 qcms_profile* inputProfile = qcms_profile_from_memory(colorProfile.data(), colorProfile.size());441 if (!inputProfile)442 return;443 // We currently only support color profiles for RGB profiled images.444 ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile));445 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;446 // FIXME: Don't force perceptual intent if the image profile contains an intent.447 m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProfile, dataFormat, QCMS_INTENT_PERCEPTUAL);448 qcms_profile_release(inputProfile);449 }450 #endif451 405 452 406 private: … … 461 415 462 416 JSAMPARRAY m_samples; 463 464 #if USE(QCMSLIB)465 qcms_transform* m_transform;466 #endif467 417 }; 468 418 … … 572 522 #if !ENABLE(IMAGE_DECODER_DOWN_SAMPLING) && defined(TURBO_JPEG_RGB_SWIZZLE) 573 523 if (turboSwizzled(info->out_color_space)) { 574 ASSERT(!m_scaled); 575 while (info->output_scanline < info->output_height) { 576 unsigned char* row = reinterpret_cast<unsigned char*>(buffer.getAddr(0, info->output_scanline)); 577 if (jpeg_read_scanlines(info, &row, 1) != 1) 578 return false; 579 #if USE(QCMSLIB) 580 if (qcms_transform* transform = m_reader->colorTransform()) 581 qcms_transform_data_type(transform, row, row, info->output_width, rgbOutputColorSpace() == JCS_EXT_BGRA ? QCMS_OUTPUT_BGRX : QCMS_OUTPUT_RGBX); 582 #endif 524 ASSERT(!m_scaled); 525 while (info->output_scanline < info->output_height) { 526 unsigned char* row = reinterpret_cast<unsigned char*>(buffer.getAddr(0, info->output_scanline)); 527 if (jpeg_read_scanlines(info, &row, 1) != 1) 528 return false; 583 529 } 584 530 return true; … … 599 545 if (destY < 0) 600 546 continue; 601 #if USE(QCMSLIB)602 if (m_reader->colorTransform() && info->out_color_space == JCS_RGB)603 qcms_transform_data(m_reader->colorTransform(), *samples, *samples, info->output_width);604 #endif605 547 int width = m_scaled ? m_scaledColumns.size() : info->output_width; 606 548 for (int x = 0; x < width; ++x) { -
trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
r120393 r120396 42 42 43 43 #include "png.h" 44 #include <wtf/OwnArrayPtr.h>45 44 #include <wtf/PassOwnPtr.h> 46 45 47 46 #if PLATFORM(CHROMIUM) 48 47 #include "TraceEvent.h" 49 #endif50 51 #if USE(QCMSLIB)52 #include "qcms.h"53 48 #endif 54 49 … … 113 108 PNGImageReader(PNGImageDecoder* decoder) 114 109 : m_readOffset(0) 110 , m_decodingSizeOnly(false) 111 , m_interlaceBuffer(0) 112 , m_hasAlpha(false) 115 113 , m_currentBufferSize(0) 116 , m_decodingSizeOnly(false)117 , m_hasAlpha(false)118 , m_interlaceBuffer(0)119 #if USE(QCMSLIB)120 , m_transform(0)121 , m_rowBuffer()122 #endif123 114 { 124 115 m_png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, decodingFailed, decodingWarning); … … 137 128 // This will zero the pointers. 138 129 png_destroy_read_struct(&m_png, &m_info, 0); 139 #if USE(QCMSLIB)140 if (m_transform)141 qcms_transform_release(m_transform);142 m_transform = 0;143 #endif144 130 delete[] m_interlaceBuffer; 145 131 m_interlaceBuffer = 0; 146 132 m_readOffset = 0; 147 133 } 134 135 unsigned currentBufferSize() const { return m_currentBufferSize; } 148 136 149 137 bool decode(const SharedBuffer& data, bool sizeOnly) … … 170 158 } 171 159 160 bool decodingSizeOnly() const { return m_decodingSizeOnly; } 172 161 png_structp pngPtr() const { return m_png; } 173 162 png_infop infoPtr() const { return m_info; } 163 png_bytep interlaceBuffer() const { return m_interlaceBuffer; } 164 bool hasAlpha() const { return m_hasAlpha; } 174 165 175 166 void setReadOffset(unsigned offset) { m_readOffset = offset; } 176 unsigned currentBufferSize() const { return m_currentBufferSize; } 177 bool decodingSizeOnly() const { return m_decodingSizeOnly; } 178 void setHasAlpha(bool hasAlpha) { m_hasAlpha = hasAlpha; } 179 bool hasAlpha() const { return m_hasAlpha; } 180 181 png_bytep interlaceBuffer() const { return m_interlaceBuffer; } 167 void setHasAlpha(bool b) { m_hasAlpha = b; } 168 182 169 void createInterlaceBuffer(int size) { m_interlaceBuffer = new png_byte[size]; } 183 #if USE(QCMSLIB)184 png_bytep rowBuffer() const { return m_rowBuffer.get(); }185 void createRowBuffer(int size) { m_rowBuffer = adoptArrayPtr(new png_byte[size]); }186 qcms_transform* colorTransform() const { return m_transform; }187 188 void createColorTransform(const ColorProfile& colorProfile, bool hasAlpha)189 {190 if (m_transform)191 qcms_transform_release(m_transform);192 m_transform = 0;193 194 if (colorProfile.isEmpty())195 return;196 qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile();197 if (!deviceProfile)198 return;199 qcms_profile* inputProfile = qcms_profile_from_memory(colorProfile.data(), colorProfile.size());200 if (!inputProfile)201 return;202 // We currently only support color profiles for RGB and RGBA images.203 ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile));204 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;205 // FIXME: Don't force perceptual intent if the image profile contains an intent.206 m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProfile, dataFormat, QCMS_INTENT_PERCEPTUAL);207 qcms_profile_release(inputProfile);208 }209 #endif210 170 211 171 private: 172 unsigned m_readOffset; 173 bool m_decodingSizeOnly; 212 174 png_structp m_png; 213 175 png_infop m_info; 214 unsigned m_readOffset; 176 png_bytep m_interlaceBuffer; 177 bool m_hasAlpha; 215 178 unsigned m_currentBufferSize; 216 bool m_decodingSizeOnly;217 bool m_hasAlpha;218 png_bytep m_interlaceBuffer;219 #if USE(QCMSLIB)220 qcms_transform* m_transform;221 OwnArrayPtr<png_byte> m_rowBuffer;222 #endif223 179 }; 224 180 … … 343 299 // hand that to CoreGraphics. 344 300 readColorProfile(png, info, m_colorProfile); 345 #if USE(QCMSLIB)346 m_reader->createColorTransform(m_colorProfile, colorType & PNG_COLOR_MASK_ALPHA);347 m_colorProfile.clear();348 #endif349 301 } 350 302 … … 416 368 } 417 369 418 unsigned colorChannels = m_reader->hasAlpha() ? 4 : 3;419 370 if (PNG_INTERLACE_ADAM7 == png_get_interlace_type(png, m_reader->infoPtr())) { 371 unsigned colorChannels = m_reader->hasAlpha() ? 4 : 3; 420 372 m_reader->createInterlaceBuffer(colorChannels * size().width() * size().height()); 421 373 if (!m_reader->interlaceBuffer()) { … … 425 377 } 426 378 427 #if USE(QCMSLIB)428 if (m_reader->colorTransform()) {429 m_reader->createRowBuffer(colorChannels * size().width());430 if (!m_reader->rowBuffer()) {431 longjmp(JMPBUF(png), 1);432 return;433 }434 }435 #endif436 379 buffer.setStatus(ImageFrame::FramePartial); 437 380 buffer.setHasAlpha(false); … … 491 434 } 492 435 493 #if USE(QCMSLIB)494 if (qcms_transform* transform = m_reader->colorTransform()) {495 qcms_transform_data(transform, row, m_reader->rowBuffer(), size().width());496 row = m_reader->rowBuffer();497 }498 #endif499 500 436 // Write the decoded row pixels to the frame buffer. 501 437 int width = scaledSize().width(); -
trunk/Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp
r120393 r120396 27 27 #include "config.h" 28 28 #include "ImageDecoder.h" 29 30 #include "NotImplemented.h" 31 32 #if PLATFORM(CHROMIUM) && OS(DARWIN) 33 #include "GraphicsContextCG.h" 34 #include "SkCGUtils.h" 35 #endif 29 36 30 37 namespace WebCore { … … 108 115 } 109 116 117 #if PLATFORM(CHROMIUM) && OS(DARWIN) 118 static void resolveColorSpace(const SkBitmap& bitmap, CGColorSpaceRef colorSpace) 119 { 120 int width = bitmap.width(); 121 int height = bitmap.height(); 122 RetainPtr<CGImageRef> srcImage(AdoptCF, SkCreateCGImageRefWithColorspace(bitmap, colorSpace)); 123 SkAutoLockPixels lock(bitmap); 124 void* pixels = bitmap.getPixels(); 125 RetainPtr<CGContextRef> cgBitmap(AdoptCF, CGBitmapContextCreate(pixels, width, height, 8, width * 4, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst)); 126 if (!cgBitmap) 127 return; 128 CGContextSetBlendMode(cgBitmap.get(), kCGBlendModeCopy); 129 CGRect bounds = { {0, 0}, {width, height} }; 130 CGContextDrawImage(cgBitmap.get(), bounds, srcImage.get()); 131 } 132 133 static CGColorSpaceRef createColorSpace(const ColorProfile& colorProfile) 134 { 135 RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(colorProfile.data()), colorProfile.size())); 136 #ifndef TARGETING_LEOPARD 137 return CGColorSpaceCreateWithICCProfile(data.get()); 138 #else 139 RetainPtr<CGDataProviderRef> profileDataProvider(AdoptCF, CGDataProviderCreateWithCFData(data.get())); 140 CGFloat ranges[] = {0.0, 255.0, 0.0, 255.0, 0.0, 255.0}; 141 return CGColorSpaceCreateICCBased(3, ranges, profileDataProvider.get(), deviceRGBColorSpaceRef()); 142 #endif 143 } 144 #endif 145 110 146 void ImageFrame::setColorProfile(const ColorProfile& colorProfile) 111 147 { 112 // FIXME: Do we need this ImageFrame function anymore, on any port? 113 UNUSED_PARAM(colorProfile); 148 #if PLATFORM(CHROMIUM) && OS(DARWIN) 149 m_colorProfile = colorProfile; 150 #else 151 notImplemented(); 152 #endif 114 153 } 115 154 … … 117 156 { 118 157 m_status = status; 119 if (m_status == FrameComplete) 158 if (m_status == FrameComplete) { 120 159 m_bitmap.setDataComplete(); // Tell the bitmap it's done. 160 #if PLATFORM(CHROMIUM) && OS(DARWIN) 161 // resolveColorSpace() and callees assume that the alpha channel is 162 // premultiplied, so don't apply the color profile if it isn't. 163 if (m_colorProfile.isEmpty() || (!m_premultiplyAlpha && hasAlpha())) 164 return; 165 RetainPtr<CGColorSpaceRef> cgColorSpace(AdoptCF, createColorSpace(m_colorProfile)); 166 resolveColorSpace(m_bitmap.bitmap(), cgColorSpace.get()); 167 #endif 168 } 121 169 } 122 170
Note: See TracChangeset
for help on using the changeset viewer.