Changeset 185417 in webkit


Ignore:
Timestamp:
Jun 10, 2015 8:58:13 AM (9 years ago)
Author:
hyuki.kim@samsung.com
Message:

[EFL] Jpeg image export implementation for Canvas.
https://bugs.webkit.org/show_bug.cgi?id=145457

Reviewed by Gyuyoung Kim.

Add implementation of jpeg image export on Webkit EFL by using JPEGImageEncoder.

No new tests, fast/canvas/toDataURL-supportedTypes.html can be reused.

  • PlatformEfl.cmake:
  • platform/MIMETypeRegistry.cpp:

(WebCore::initializeSupportedImageMIMETypesForEncoding):

  • platform/graphics/cairo/ImageBufferCairo.cpp:
  • platform/graphics/efl/ImageBufferEfl.cpp: Added.

(WebCore::writeFunction):
(WebCore::encodeImage):
(WebCore::ImageBuffer::toDataURL):

  • platform/image-encoders/JPEGImageEncoder.cpp:

(WebCore::compressRGBABigEndianToJPEG):

Location:
trunk/Source/WebCore
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185416 r185417  
     12015-06-10  KwangHyuk Kim  <hyuki.kim@samsung.com>
     2
     3        [EFL] Jpeg image export implementation for Canvas.
     4        https://bugs.webkit.org/show_bug.cgi?id=145457
     5
     6        Reviewed by Gyuyoung Kim.
     7
     8        Add implementation of jpeg image export on Webkit EFL by using JPEGImageEncoder.
     9
     10        No new tests, fast/canvas/toDataURL-supportedTypes.html can be reused.
     11
     12        * PlatformEfl.cmake:
     13        * platform/MIMETypeRegistry.cpp:
     14        (WebCore::initializeSupportedImageMIMETypesForEncoding):
     15        * platform/graphics/cairo/ImageBufferCairo.cpp:
     16        * platform/graphics/efl/ImageBufferEfl.cpp: Added.
     17        (WebCore::writeFunction):
     18        (WebCore::encodeImage):
     19        (WebCore::ImageBuffer::toDataURL):
     20        * platform/image-encoders/JPEGImageEncoder.cpp:
     21        (WebCore::compressRGBABigEndianToJPEG):
     22
    1232015-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    224
  • trunk/Source/WebCore/PlatformEfl.cmake

    r185358 r185417  
    135135    platform/graphics/efl/GraphicsContext3DPrivate.cpp
    136136    platform/graphics/efl/IconEfl.cpp
     137    platform/graphics/efl/ImageBufferEfl.cpp
    137138    platform/graphics/efl/ImageEfl.cpp
    138139    platform/graphics/efl/IntPointEfl.cpp
     
    199200    platform/graphics/x11/PlatformDisplayX11.cpp
    200201    platform/graphics/x11/XUniqueResource.cpp
     202
     203    platform/image-encoders/JPEGImageEncoder.cpp
    201204
    202205    platform/image-decoders/ImageDecoder.cpp
  • trunk/Source/WebCore/platform/MIMETypeRegistry.cpp

    r170091 r185417  
    268268    supportedImageMIMETypesForEncoding->add("image/bmp");
    269269    supportedImageMIMETypesForEncoding->add("image/ico");
     270#elif PLATFORM(EFL)
     271    supportedImageMIMETypesForEncoding->add("image/png");
     272    supportedImageMIMETypesForEncoding->add("image/jpeg");
    270273#elif USE(CAIRO)
    271274    supportedImageMIMETypesForEncoding->add("image/png");
  • trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp

    r183807 r185417  
    362362}
    363363
    364 #if !PLATFORM(GTK)
     364#if !PLATFORM(GTK) && !PLATFORM(EFL)
    365365static cairo_status_t writeFunction(void* output, const unsigned char* data, unsigned int length)
    366366{
  • trunk/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp

    r178166 r185417  
    120120    rowBuffer.resize(compressData.image_width * 3);
    121121
     122    // add offset to prevent clobbered error caused by setjmp and longjmp.
     123    unsigned offset = 0;
    122124    const unsigned char* pixel = rgbaBigEndianData;
    123125    const unsigned char* pixelEnd = pixel + compressData.image_width * compressData.image_height * 4;
    124     while (pixel < pixelEnd) {
     126    while (pixel + offset < pixelEnd) {
    125127        JSAMPLE* output = rowBuffer.data();
    126         for (const unsigned char* rowEnd = pixel + compressData.image_width * 4; pixel < rowEnd;) {
    127             *output++ = static_cast<JSAMPLE>(*pixel++ & 0xFF); // red
    128             *output++ = static_cast<JSAMPLE>(*pixel++ & 0xFF); // green
    129             *output++ = static_cast<JSAMPLE>(*pixel++ & 0xFF); // blue
    130             ++pixel; // skip alpha
     128        for (const unsigned char* rowEnd = pixel + offset + compressData.image_width * 4; pixel + offset < rowEnd;) {
     129            *output++ = static_cast<JSAMPLE>(*(pixel + offset++) & 0xFF); // red
     130            *output++ = static_cast<JSAMPLE>(*(pixel + offset++) & 0xFF); // green
     131            *output++ = static_cast<JSAMPLE>(*(pixel + offset++) & 0xFF); // blue
     132            ++offset; // skip alpha
    131133        }
    132134        output = rowBuffer.data();
Note: See TracChangeset for help on using the changeset viewer.