[CG] Provide a type identifier hint to the CGImageSource so getting the type identifi...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2017 01:23:55 +0000 (01:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2017 01:23:55 +0000 (01:23 +0000)
commite0b3a4a59322d400e06b88b4a776476756f8b6d8
tree3fcc819a2cd5f04eeee2fe318348c14e130e6803
parenta87dcda8b1ffb4edcefc495e05f2b91b3ad4c5bf
[CG] Provide a type identifier hint to the CGImageSource so getting the type identifier is more accurate
https://bugs.webkit.org/show_bug.cgi?id=171042

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-04-24
Reviewed by Tim Horton.

The image URL can be used to get the type identifier hint. Without providing
this hint, the image type identifier is not accurate for image formats.

Also add a function to the ImageDecoder class to get the typeIdentifier. Add
all the pluming from the ImageDecoder till the Image class.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyDecodedData):
(WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::internalStartAnimation):
(WebCore::BitmapImage::advanceAnimation):
(WebCore::BitmapImage::internalAdvanceAnimation):
(WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.cpp:
(WebCore::Image::sourceURL):
* platform/graphics/Image.h: Change the sourceURL() to return a URL so CG can create CFURLRef from it.
(WebCore::Image::uti):
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex):
(WebCore::ImageFrameCache::startAsyncDecodingQueue):
(WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
(WebCore::ImageFrameCache::stopAsyncDecodingQueue):
(WebCore::ImageFrameCache::clearMetadata):
(WebCore::ImageFrameCache::sourceURL):
(WebCore::ImageFrameCache::encodedDataStatus):
(WebCore::ImageFrameCache::uti):
(WebCore::ImageFrameCache::filenameExtension):
* platform/graphics/ImageFrameCache.h:
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::ensureDecoderAvailable):
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::uti):
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::ImageDecoder): Pass the type identifier hint to CGImageSourceCreateIncremental().
(WebCore::ImageDecoder::uti):
(WebCore::ImageDecoder::filenameExtension):
(WebCore::ImageDecoder::frameHasAlphaAtIndex):
(WebCore::ImageDecoder::createFrameImageAtIndex):
* platform/graphics/cg/ImageDecoderCG.h:
(WebCore::ImageDecoder::create):
* platform/graphics/win/ImageDecoderDirect2D.cpp:
(WebCore::ImageDecoder::encodedDataStatus):
* platform/graphics/win/ImageDecoderDirect2D.h:
(WebCore::ImageDecoder::create): Add an argument of type URL.
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::create): Add an argument of type URL.
* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageDecoder::encodedDataStatus): Make it const.
* platform/image-decoders/bmp/BMPImageDecoder.cpp:
(WebCore::BMPImageDecoder::encodedDataStatus):
* platform/image-decoders/bmp/BMPImageDecoder.h:
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::encodedDataStatus):
* platform/image-decoders/gif/GIFImageDecoder.h:
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::encodedDataStatus):
* platform/image-decoders/ico/ICOImageDecoder.h:
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::encodedDataStatus):
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::encodedDataStatus):
* platform/image-decoders/png/PNGImageDecoder.h:
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::encodedDataStatus):
* platform/image-decoders/webp/WEBPImageDecoder.h:
* platform/spi/cg/ImageIOSPI.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/Image.cpp
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/ImageFrameCache.cpp
Source/WebCore/platform/graphics/ImageFrameCache.h
Source/WebCore/platform/graphics/ImageSource.cpp
Source/WebCore/platform/graphics/ImageSource.h
Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
Source/WebCore/platform/graphics/cg/ImageDecoderCG.h
Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h
Source/WebCore/platform/image-decoders/ImageDecoder.cpp
Source/WebCore/platform/image-decoders/ImageDecoder.h
Source/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
Source/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h
Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.h
Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h
Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h
Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h
Source/WebCore/platform/spi/cg/ImageIOSPI.h [new file with mode: 0644]