Changeset 205661 in webkit


Ignore:
Timestamp:
Sep 8, 2016 2:16:38 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Get rid of the color profile from ImageFrame and ImageDecoder
https://bugs.webkit.org/show_bug.cgi?id=159699

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-09-08
Reviewed by Simon Fraser.

The color profile is set but it is never used.

  • platform/image-decoders/ImageDecoder.cpp:

(WebCore::ImageFrame::setColorProfile): Deleted.

  • platform/image-decoders/ImageDecoder.h:
  • platform/image-decoders/jpeg/JPEGImageDecoder.cpp:

(WebCore::JPEGImageReader::decode):
(WebCore::JPEGImageDecoder::outputScanlines):
(WebCore::readColorProfile): Deleted.

  • platform/image-decoders/jpeg/JPEGImageDecoder.h:
  • platform/image-decoders/png/PNGImageDecoder.cpp:

(WebCore::PNGImageDecoder::headerAvailable):
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::readColorProfile): Deleted.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r205660 r205661  
     12016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Get rid of the color profile from ImageFrame and ImageDecoder
     4        https://bugs.webkit.org/show_bug.cgi?id=159699
     5
     6        Reviewed by Simon Fraser.
     7
     8        The color profile is set but it is never used.
     9
     10        * platform/image-decoders/ImageDecoder.cpp:
     11        (WebCore::ImageFrame::setColorProfile): Deleted.
     12        * platform/image-decoders/ImageDecoder.h:
     13        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
     14        (WebCore::JPEGImageReader::decode):
     15        (WebCore::JPEGImageDecoder::outputScanlines):
     16        (WebCore::readColorProfile): Deleted.
     17        * platform/image-decoders/jpeg/JPEGImageDecoder.h:
     18        * platform/image-decoders/png/PNGImageDecoder.cpp:
     19        (WebCore::PNGImageDecoder::headerAvailable):
     20        (WebCore::PNGImageDecoder::rowAvailable):
     21        (WebCore::readColorProfile): Deleted.
     22
    1232016-09-08  Dave Hyatt  <hyatt@apple.com>
    224
  • trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp

    r202800 r205661  
    221221}
    222222
    223 void ImageFrame::setColorProfile(const ColorProfile& colorProfile)
    224 {
    225     m_colorProfile = colorProfile;
    226 }
    227 
    228223void ImageFrame::setStatus(FrameStatus status)
    229224{
  • trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h

    r202800 r205661  
    111111
    112112        void setHasAlpha(bool alpha);
    113         void setColorProfile(const ColorProfile&);
    114113        void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; }
    115114        void setStatus(FrameStatus status);
     
    215214        PixelData* m_bytes; // The memory is backed by m_backingStore.
    216215        IntSize m_size;
    217         // FIXME: Do we need m_colorProfile anymore?
    218         ColorProfile m_colorProfile;
    219216        bool m_hasAlpha;
    220217        IntRect m_originalFrameRect; // This will always just be the entire
     
    382379        RefPtr<SharedBuffer> m_data; // The encoded data.
    383380        Vector<ImageFrame, 1> m_frameBufferCache;
    384         // FIXME: Do we need m_colorProfile any more, for any port?
    385         ColorProfile m_colorProfile;
    386381        bool m_scaled { false };
    387382        Vector<int> m_scaledColumns;
  • trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

    r197171 r205661  
    197197}
    198198
    199 static ColorProfile readColorProfile(jpeg_decompress_struct* info)
    200 {
    201 #if USE(ICCJPEG)
    202     JOCTET* profile;
    203     unsigned int profileLength;
    204 
    205     if (!read_icc_profile(info, &profile, &profileLength))
    206         return ColorProfile();
    207 
    208     // Only accept RGB color profiles from input class devices.
    209     bool ignoreProfile = false;
    210     char* profileData = reinterpret_cast<char*>(profile);
    211     if (profileLength < ImageDecoder::iccColorProfileHeaderLength)
    212         ignoreProfile = true;
    213     else if (!ImageDecoder::rgbColorProfile(profileData, profileLength))
    214         ignoreProfile = true;
    215     else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength))
    216         ignoreProfile = true;
    217 
    218     ColorProfile colorProfile;
    219     if (!ignoreProfile)
    220         colorProfile.append(profileData, profileLength);
    221     free(profile);
    222     return colorProfile;
    223 #else
    224     UNUSED_PARAM(info);
    225     return ColorProfile();
    226 #endif
    227 }
    228 
    229199class JPEGImageReader {
    230200    WTF_MAKE_FAST_ALLOCATED;
     
    364334                m_info.out_color_space = JCS_RGB;
    365335#endif
    366             // Allow color management of the decoded RGBA pixels if possible.
    367             if (!m_decoder->ignoresGammaAndColorProfile()) {
    368                 ColorProfile rgbInputDeviceColorProfile = readColorProfile(info());
    369                 if (!rgbInputDeviceColorProfile.isEmpty())
    370                     m_decoder->setColorProfile(rgbInputDeviceColorProfile);
    371             }
    372 
    373336            // Don't allocate a giant and superfluous memory buffer when the
    374337            // image is a sequential JPEG.
     
    661624        // loading. The completed image will be marked fully opaque in jpegComplete().
    662625        buffer.setHasAlpha(true);
    663         buffer.setColorProfile(m_colorProfile);
    664626
    665627        // For JPEGs, the frame always fills the entire image.
  • trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h

    r202677 r205661  
    6767        void jpegComplete();
    6868
    69         void setColorProfile(const ColorProfile& colorProfile) { m_colorProfile = colorProfile; }
    7069        void setOrientation(ImageOrientation orientation) { m_orientation = orientation; }
    7170
  • trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp

    r197171 r205661  
    277277}
    278278
    279 static void readColorProfile(png_structp png, png_infop info, ColorProfile& colorProfile)
    280 {
    281     ASSERT(colorProfile.isEmpty());
    282 
    283 #ifdef PNG_iCCP_SUPPORTED
    284     char* profileName;
    285     int compressionType;
    286 #if (PNG_LIBPNG_VER < 10500)
    287     png_charp profile;
    288 #else
    289     png_bytep profile;
    290 #endif
    291     png_uint_32 profileLength;
    292     if (!png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength))
    293         return;
    294 
    295     // Only accept RGB color profiles from input class devices.
    296     bool ignoreProfile = false;
    297     char* profileData = reinterpret_cast<char*>(profile);
    298     if (profileLength < ImageDecoder::iccColorProfileHeaderLength)
    299         ignoreProfile = true;
    300     else if (!ImageDecoder::rgbColorProfile(profileData, profileLength))
    301         ignoreProfile = true;
    302     else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength))
    303         ignoreProfile = true;
    304 
    305     if (!ignoreProfile)
    306         colorProfile.append(profileData, profileLength);
    307 #endif
    308 }
    309 
    310279void PNGImageDecoder::headerAvailable()
    311280{
     
    406375        png_set_gray_to_rgb(png);
    407376
    408     if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreGammaAndColorProfile) {
    409         // We only support color profiles for color PALETTE and RGB[A] PNG. Supporting
    410         // color profiles for gray-scale images is slightly tricky, at least using the
    411         // CoreGraphics ICC library, because we expand gray-scale images to RGB but we
    412         // do not similarly transform the color profile. We'd either need to transform
    413         // the color profile or we'd need to decode into a gray-scale image buffer and
    414         // hand that to CoreGraphics.
    415         readColorProfile(png, info, m_colorProfile);
    416     }
    417 
    418377    // Deal with gamma and keep it under our control.
    419378    double gamma;
     
    507466        buffer.setStatus(ImageFrame::FramePartial);
    508467        buffer.setHasAlpha(false);
    509         buffer.setColorProfile(m_colorProfile);
    510468
    511469#if ENABLE(APNG)
Note: See TracChangeset for help on using the changeset viewer.