Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Dec 2017 21:00:37 +0000 (21:00 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Dec 2017 21:00:37 +0000 (21:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180689

Reviewed by Tim Horton.

Source/WebCore:

Remove the ColorSpaceDeviceRGB enum and users.

ImageBuffer now uses sRGB instead of deviceRGB in the few cases that used the latter.

Switch Windows CG code to use sRGBColorSpaceRef() instead of deviceRGBColorSpaceRef().

Have linearRGBColorSpaceRef() use kCGColorSpaceLinearSRGB, which is present in iOS 9 and 10.11 and later.

* page/win/FrameCGWin.cpp:
(WebCore::imageFromRect):
* platform/graphics/Color.cpp:
(WebCore::operator<<):
* platform/graphics/ColorSpace.h:
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::transformColorSpace):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::Color::Color):
(WebCore::leakCGColor):
(WebCore::createCGColorWithDeviceRGBA): Deleted.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::sRGBColorSpaceRef):
(WebCore::linearRGBColorSpaceRef):
(WebCore::extendedSRGBColorSpaceRef):
(WebCore::displayP3ColorSpaceRef):
(WebCore::deviceRGBColorSpaceRef): Deleted.
* platform/graphics/cg/GraphicsContextCG.h:
(WebCore::cachedCGColorSpace):
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::CGContextWithHDC):
(WebCore::GraphicsContext::releaseWindowsContext):
(WebCore::GraphicsContext::drawWindowsBitmap):
* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::create):
(WebCore::BitmapImage::getHBITMAPOfSize):
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const):
* platform/win/DragImageCGWin.cpp:
(WebCore::allocImage):
(WebCore::createCgContextFromBitmap):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):

Source/WebKit:

Remove encoding of ColorSpaceDeviceRGB.

* Shared/WebCoreArgumentCoders.h:

Source/WebKitLegacy/mac:

Use sRGBColorSpaceRef() from WebCore.

* WebView/WebHTMLView.mm:
(imageFromRect):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225797 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/win/FrameCGWin.cpp
Source/WebCore/platform/graphics/Color.cpp
Source/WebCore/platform/graphics/ColorSpace.h
Source/WebCore/platform/graphics/ImageBuffer.cpp
Source/WebCore/platform/graphics/cg/ColorCG.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.h
Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/platform/graphics/win/ImageCGWin.cpp
Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm
Source/WebCore/platform/win/DragImageCGWin.cpp
Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm

index ad8e8d4..4c1c173 100644 (file)
@@ -1,3 +1,55 @@
+2017-12-12  Simon Fraser  <simon.fraser@apple.com>
+
+        Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
+        https://bugs.webkit.org/show_bug.cgi?id=180689
+
+        Reviewed by Tim Horton.
+
+        Remove the ColorSpaceDeviceRGB enum and users.
+
+        ImageBuffer now uses sRGB instead of deviceRGB in the few cases that used the latter.
+
+        Switch Windows CG code to use sRGBColorSpaceRef() instead of deviceRGBColorSpaceRef().
+
+        Have linearRGBColorSpaceRef() use kCGColorSpaceLinearSRGB, which is present in iOS 9 and 10.11 and later.
+
+        * page/win/FrameCGWin.cpp:
+        (WebCore::imageFromRect):
+        * platform/graphics/Color.cpp:
+        (WebCore::operator<<):
+        * platform/graphics/ColorSpace.h:
+        * platform/graphics/ImageBuffer.cpp:
+        (WebCore::ImageBuffer::transformColorSpace):
+        * platform/graphics/cg/ColorCG.cpp:
+        (WebCore::Color::Color):
+        (WebCore::leakCGColor):
+        (WebCore::createCGColorWithDeviceRGBA): Deleted.
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::sRGBColorSpaceRef):
+        (WebCore::linearRGBColorSpaceRef):
+        (WebCore::extendedSRGBColorSpaceRef):
+        (WebCore::displayP3ColorSpaceRef):
+        (WebCore::deviceRGBColorSpaceRef): Deleted.
+        * platform/graphics/cg/GraphicsContextCG.h:
+        (WebCore::cachedCGColorSpace):
+        * platform/graphics/cocoa/GraphicsContextCocoa.mm:
+        * platform/graphics/win/GraphicsContextCGWin.cpp:
+        (WebCore::CGContextWithHDC):
+        (WebCore::GraphicsContext::releaseWindowsContext):
+        (WebCore::GraphicsContext::drawWindowsBitmap):
+        * platform/graphics/win/ImageCGWin.cpp:
+        (WebCore::BitmapImage::create):
+        (WebCore::BitmapImage::getHBITMAPOfSize):
+        * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
+        (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const):
+        * platform/win/DragImageCGWin.cpp:
+        (WebCore::allocImage):
+        (WebCore::createCgContextFromBitmap):
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::postApplyResource):
+        * rendering/svg/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
+
 2017-12-12  Youenn Fablet  <youenn@apple.com>
 
         Navigation requests should use navigate fetch mode
index 336eb6d..4d067c0 100644 (file)
@@ -69,7 +69,7 @@ GDIObject<HBITMAP> imageFromRect(const Frame* frame, IntRect& ir)
 
     HGDIOBJ hbmpOld = SelectObject(hdc.get(), hbmp.get());
     CGContextRef context = CGBitmapContextCreate(static_cast<void*>(bits), w, h,
-        8, w * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
+        8, w * sizeof(RGBQUAD), sRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
     CGContextSaveGState(context);
 
     GraphicsContext gc(context);
index c2ebab5..82cae88 100644 (file)
@@ -668,9 +668,6 @@ TextStream& operator<<(TextStream& ts, const Color& color)
 TextStream& operator<<(TextStream& ts, ColorSpace colorSpace)
 {
     switch (colorSpace) {
-    case ColorSpaceDeviceRGB:
-        ts << "DeviceRGB";
-        break;
     case ColorSpaceSRGB:
         ts << "sRGB";
         break;
index e12c40a..11d017f 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef ColorSpace_h
-#define ColorSpace_h
+#pragma once
 
 namespace WebCore {
 
 enum ColorSpace {
-    ColorSpaceDeviceRGB,
     ColorSpaceSRGB,
     ColorSpaceLinearRGB,
     ColorSpaceDisplayP3
@@ -37,4 +35,3 @@ enum ColorSpace {
     
 } // namespace WebCore
 
-#endif // ColorSpace_h
index 57f4601..a56fd82 100644 (file)
@@ -126,8 +126,8 @@ void ImageBuffer::transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstCo
         return;
 
     // only sRGB <-> linearRGB are supported at the moment
-    if ((srcColorSpace != ColorSpaceLinearRGB && srcColorSpace != ColorSpaceDeviceRGB)
-        || (dstColorSpace != ColorSpaceLinearRGB && dstColorSpace != ColorSpaceDeviceRGB))
+    if ((srcColorSpace != ColorSpaceLinearRGB && srcColorSpace != ColorSpaceSRGB)
+        || (dstColorSpace != ColorSpaceLinearRGB && dstColorSpace != ColorSpaceSRGB))
         return;
 
     if (dstColorSpace == ColorSpaceLinearRGB) {
@@ -143,7 +143,7 @@ void ImageBuffer::transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstCo
             return array;
         }();
         platformTransformColorSpace(linearRgbLUT);
-    } else if (dstColorSpace == ColorSpaceDeviceRGB) {
+    } else if (dstColorSpace == ColorSpaceSRGB) {
         static const std::array<uint8_t, 256> deviceRgbLUT= [] {
             std::array<uint8_t, 256> array;
             for (unsigned i = 0; i < 256; i++) {
index 617a32f..a3ba44b 100644 (file)
@@ -55,21 +55,6 @@ RetainPtr<CGColorRef> TinyLRUCachePolicy<WebCore::Color, RetainPtr<CGColorRef>>:
 
 namespace WebCore {
 
-#if PLATFORM(IOS)
-static CGColorRef createCGColorWithDeviceRGBA(CGColorRef sourceColor)
-{
-    if (!sourceColor || CFEqual(CGColorGetColorSpace(sourceColor), deviceRGBColorSpaceRef()))
-        return CGColorRetain(sourceColor);
-
-    RetainPtr<CGColorTransformRef> colorTransform = adoptCF(CGColorTransformCreate(deviceRGBColorSpaceRef(), nullptr));
-    if (!colorTransform)
-        return CGColorRetain(sourceColor);
-
-    // CGColorTransformConvertColor() returns a +1 retained object.
-    return CGColorTransformConvertColor(colorTransform.get(), sourceColor, kCGRenderingIntentDefault);
-}
-#endif // PLATFORM(IOS)
-
 Color::Color(CGColorRef color)
 {
     if (!color) {
@@ -77,18 +62,8 @@ Color::Color(CGColorRef color)
         return;
     }
 
-#if !PLATFORM(IOS)
     size_t numComponents = CGColorGetNumberOfComponents(color);
     const CGFloat* components = CGColorGetComponents(color);
-#else
-    // FIXME: can we remove this?
-    RetainPtr<CGColorRef> correctedColor = adoptCF(createCGColorWithDeviceRGBA(color));
-    if (!correctedColor)
-        correctedColor = color;
-
-    size_t numComponents = CGColorGetNumberOfComponents(correctedColor.get());
-    const CGFloat* components = CGColorGetComponents(correctedColor.get());
-#endif // !PLATFORM(IOS)
 
     float r = 0;
     float g = 0;
@@ -128,7 +103,6 @@ static CGColorRef leakCGColor(const Color& color)
         case ColorSpaceDisplayP3:
             return CGColorCreate(displayP3ColorSpaceRef(), components);
         case ColorSpaceLinearRGB:
-        case ColorSpaceDeviceRGB:
             // FIXME: Do we ever create CGColorRefs in these spaces? It may only be ImageBuffers.
             return CGColorCreate(sRGBColorSpaceRef(), components);
         }
index d8f0e19..75be03c 100644 (file)
@@ -72,13 +72,6 @@ static void setCGStrokeColor(CGContextRef context, const Color& color)
     CGContextSetStrokeColorWithColor(context, cachedCGColor(color));
 }
 
-// FIXME: This should be removed soon.
-CGColorSpaceRef deviceRGBColorSpaceRef()
-{
-    static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB();
-    return deviceSpace;
-}
-
 CGColorSpaceRef sRGBColorSpaceRef()
 {
     static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
@@ -87,11 +80,26 @@ CGColorSpaceRef sRGBColorSpaceRef()
     // causing a crash under those conditions. Since the default color space in Windows
     // is sRGB, this all works out nicely.
     if (!sRGBSpace)
-        sRGBSpace = deviceRGBColorSpaceRef();
+        sRGBSpace = CGColorSpaceCreateDeviceRGB();
 #endif // PLATFORM(WIN)
     return sRGBSpace;
 }
-    
+
+#if PLATFORM(WIN) || PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+// See GraphicsContextCocoa for the pre-10.12 implementation.
+CGColorSpaceRef linearRGBColorSpaceRef()
+{
+#if PLATFORM(WIN)
+    // FIXME: Windows should be able to use linear sRGB, this is tracked by http://webkit.org/b/80000.
+    return CGColorSpaceCreateDeviceRGB();
+#else
+    static CGColorSpaceRef linearRGBSpace;
+    linearRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceLinearSRGB);
+    return linearRGBSpace;
+#endif
+}
+#endif
+
 CGColorSpaceRef extendedSRGBColorSpaceRef()
 {
     static CGColorSpaceRef extendedSRGBSpace;
@@ -100,28 +108,21 @@ CGColorSpaceRef extendedSRGBColorSpaceRef()
 #endif
     // If there is no support for exteneded sRGB, fall back to sRGB.
     if (!extendedSRGBSpace)
-        extendedSRGBSpace = sRGBColorSpaceRef();
+        extendedSRGBSpace = CGColorSpaceCreateDeviceRGB();
     return extendedSRGBSpace;
 }
 
 CGColorSpaceRef displayP3ColorSpaceRef()
 {
+    static CGColorSpaceRef displayP3Space;
 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 101100)
-    static CGColorSpaceRef displayP3Space = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3);
+    displayP3Space = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3);
 #else
-    static CGColorSpaceRef displayP3Space = sRGBColorSpaceRef();
+    displayP3Space = sRGBColorSpaceRef();
 #endif
     return displayP3Space;
 }
 
-#if PLATFORM(WIN)
-CGColorSpaceRef linearRGBColorSpaceRef()
-{
-    // FIXME: Windows should be able to use linear sRGB, this is tracked by http://webkit.org/b/80000.
-    return deviceRGBColorSpaceRef();
-}
-#endif
-
 static InterpolationQuality convertInterpolationQuality(CGInterpolationQuality quality)
 {
     switch (quality) {
index 06b3d6e..b6c64f7 100644 (file)
@@ -31,11 +31,10 @@ typedef struct CGColorSpace *CGColorSpaceRef;
 
 namespace WebCore {
 
-CGColorSpaceRef deviceRGBColorSpaceRef();
 WEBCORE_EXPORT CGColorSpaceRef sRGBColorSpaceRef();
 WEBCORE_EXPORT CGColorSpaceRef extendedSRGBColorSpaceRef();
 WEBCORE_EXPORT CGColorSpaceRef displayP3ColorSpaceRef();
-CGColorSpaceRef linearRGBColorSpaceRef();
+WEBCORE_EXPORT CGColorSpaceRef linearRGBColorSpaceRef();
 
 inline CGAffineTransform getUserToBaseCTM(CGContextRef context)
 {
@@ -45,8 +44,6 @@ inline CGAffineTransform getUserToBaseCTM(CGContextRef context)
 static inline CGColorSpaceRef cachedCGColorSpace(ColorSpace colorSpace)
 {
     switch (colorSpace) {
-    case ColorSpaceDeviceRGB:
-        return deviceRGBColorSpaceRef();
     case ColorSpaceSRGB:
         return sRGBColorSpaceRef();
     case ColorSpaceLinearRGB:
@@ -55,7 +52,7 @@ static inline CGColorSpaceRef cachedCGColorSpace(ColorSpace colorSpace)
         return displayP3ColorSpaceRef();
     }
     ASSERT_NOT_REACHED();
-    return deviceRGBColorSpaceRef();
+    return sRGBColorSpaceRef();
 }
 
 class CGContextStateSaver {
index 33c4800..34c63cd 100644 (file)
@@ -365,6 +365,7 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
 #endif
 }
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200
 CGColorSpaceRef linearRGBColorSpaceRef()
 {
     static CGColorSpaceRef linearSRGBSpace = nullptr;
@@ -387,5 +388,6 @@ CGColorSpaceRef linearRGBColorSpaceRef()
 
     return linearSRGBSpace;
 }
+#endif
 
-}
+} // namespace WebCore
index afbfea0..ec4f7a9 100644 (file)
@@ -58,7 +58,7 @@ static CGContextRef CGContextWithHDC(HDC hdc, bool hasAlpha)
 
     CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | (hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst);
     CGContextRef context = CGBitmapContextCreate(pixelData.buffer(), pixelData.size().width(), pixelData.size().height(), 8,
-                                                 pixelData.bytesPerRow(), deviceRGBColorSpaceRef(), bitmapInfo);
+                                                 pixelData.bytesPerRow(), sRGBColorSpaceRef(), bitmapInfo);
 
     // Flip coords
     CGContextTranslateCTM(context, 0, pixelData.size().height());
@@ -110,7 +110,7 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo
     ASSERT(pixelData.bitsPerPixel() == 32);
 
     CGContextRef bitmapContext = CGBitmapContextCreate(pixelData.buffer(), pixelData.size().width(), pixelData.size().height(), 8,
-                                                       pixelData.bytesPerRow(), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little |
+                                                       pixelData.bytesPerRow(), sRGBColorSpaceRef(), kCGBitmapByteOrder32Little |
                                                        (supportAlphaBlend ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst));
 
     CGImageRef image = CGBitmapContextCreateImage(bitmapContext);
@@ -128,7 +128,7 @@ void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& po
     // make a custom CGDataProvider that controls the WindowsBitmap lifetime.  see <rdar://6394455>
     RetainPtr<CFDataRef> imageData = adoptCF(CFDataCreate(kCFAllocatorDefault, image->buffer(), image->bufferLength()));
     RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(imageData.get()));
-    RetainPtr<CGImageRef> cgImage = adoptCF(CGImageCreate(image->size().width(), image->size().height(), 8, 32, image->bytesPerRow(), deviceRGBColorSpaceRef(),
+    RetainPtr<CGImageRef> cgImage = adoptCF(CGImageCreate(image->size().width(), image->size().height(), 8, 32, image->bytesPerRow(), sRGBColorSpaceRef(),
                                                          kCGBitmapByteOrder32Little | kCGImageAlphaFirst, dataProvider.get(), 0, true, kCGRenderingIntentDefault));
     CGContextDrawImage(m_data->m_cgContext.get(), CGRectMake(point.x(), point.y(), image->size().width(), image->size().height()), cgImage.get());   
 }
index 7e4a0b2..3ec28e9 100644 (file)
@@ -53,7 +53,7 @@ RefPtr<BitmapImage> BitmapImage::create(HBITMAP hBitmap)
         return 0;
 
     RetainPtr<CGContextRef> bitmapContext = adoptCF(CGBitmapContextCreate(dibSection.dsBm.bmBits, dibSection.dsBm.bmWidth, dibSection.dsBm.bmHeight, 8,
-        dibSection.dsBm.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
+        dibSection.dsBm.bmWidthBytes, sRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
 
     // The BitmapImage takes ownership of this.
     RetainPtr<CGImageRef> cgImage = adoptCF(CGBitmapContextCreateImage(bitmapContext.get()));
@@ -72,7 +72,7 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, const IntSize* size)
     int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight;
     
     CGContextRef cgContext = CGBitmapContextCreate(bmpInfo.bmBits, bmpInfo.bmWidth, bmpInfo.bmHeight,
-        8, bmpInfo.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
+        8, bmpInfo.bmWidthBytes, sRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
   
     GraphicsContext gc(cgContext);
 
index 4c8817d..e1fced1 100644 (file)
@@ -94,7 +94,7 @@ RetainPtr<CMSampleBufferRef> MockRealtimeVideoSourceMac::CMSampleBufferFromPixel
 
 RetainPtr<CVPixelBufferRef> MockRealtimeVideoSourceMac::pixelBufferFromCGImage(CGImageRef image) const
 {
-    static CGColorSpaceRef deviceRGBColorSpace = CGColorSpaceCreateDeviceRGB();
+    static CGColorSpaceRef sRGBColorSpace = sRGBColorSpaceRef();
 
     CGSize imageSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));
     if (!m_bufferPool) {
@@ -129,7 +129,7 @@ RetainPtr<CVPixelBufferRef> MockRealtimeVideoSourceMac::pixelBufferFromCGImage(C
 
     CVPixelBufferLockBaseAddress(pixelBuffer, 0);
     void* data = CVPixelBufferGetBaseAddress(pixelBuffer);
-    auto context = adoptCF(CGBitmapContextCreate(data, imageSize.width, imageSize.height, 8, CVPixelBufferGetBytesPerRow(pixelBuffer), deviceRGBColorSpace, (CGBitmapInfo) kCGImageAlphaNoneSkipFirst));
+    auto context = adoptCF(CGBitmapContextCreate(data, imageSize.width, imageSize.height, 8, CVPixelBufferGetBytesPerRow(pixelBuffer), sRGBColorSpace, (CGBitmapInfo) kCGImageAlphaNoneSkipFirst));
     CGContextDrawImage(context.get(), CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image);
     CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
 
index 2289b8f..d6cc339 100644 (file)
@@ -58,7 +58,7 @@ GDIObject<HBITMAP> allocImage(HDC dc, IntSize size, CGContextRef *targetRef)
         return hbmp;
 
     CGContextRef bitmapContext = CGBitmapContextCreate(bits, bmpInfo.bmiHeader.biWidth, bmpInfo.bmiHeader.biHeight, 8,
-                                                       bmpInfo.bmiHeader.biWidth * 4, deviceRGBColorSpaceRef(),
+                                                       bmpInfo.bmiHeader.biWidth * 4, sRGBColorSpaceRef(),
                                                        kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst);
     if (!bitmapContext)
         return GDIObject<HBITMAP>();
@@ -74,7 +74,7 @@ static CGContextRef createCgContextFromBitmap(HBITMAP bitmap)
     ASSERT(info.bmBitsPixel == 32);
 
     CGContextRef bitmapContext = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
-                                                       info.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst);
+                                                       info.bmWidthBytes, sRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst);
     return bitmapContext;
 }
 
index 2c2a49b..1a17f41 100644 (file)
@@ -278,7 +278,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderElement& renderer, Graphic
             filterData.state = FilterData::Applying;
             lastEffect->applyAll();
             lastEffect->correctFilterResultIfNeeded();
-            lastEffect->transformResultColorSpace(ColorSpaceDeviceRGB);
+            lastEffect->transformResultColorSpace(ColorSpaceSRGB);
         }
         filterData.state = FilterData::Built;
 
index 4717880..6f15030 100644 (file)
@@ -113,7 +113,7 @@ bool RenderSVGResourceMasker::drawContentIntoMaskImage(MaskerData* maskerData, C
     }
 
 #if !USE(CG)
-    maskerData->maskImage->transformColorSpace(ColorSpaceDeviceRGB, colorSpace);
+    maskerData->maskImage->transformColorSpace(ColorSpaceSRGB, colorSpace);
 #else
     UNUSED_PARAM(colorSpace);
 #endif
index 7686bfa..a381689 100644 (file)
@@ -1,3 +1,14 @@
+2017-12-12  Simon Fraser  <simon.fraser@apple.com>
+
+        Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
+        https://bugs.webkit.org/show_bug.cgi?id=180689
+
+        Reviewed by Tim Horton.
+
+        Remove encoding of ColorSpaceDeviceRGB.
+
+        * Shared/WebCoreArgumentCoders.h:
+
 2017-12-12  Brent Fulgham  <bfulgham@apple.com>
 
         REGRESSION(r216941): Plugin Process can't access AppStore Plugin Service
index b624784..e7010c1 100644 (file)
@@ -703,7 +703,6 @@ namespace WTF {
 template<> struct EnumTraits<WebCore::ColorSpace> {
     using values = EnumValues<
     WebCore::ColorSpace,
-    WebCore::ColorSpace::ColorSpaceDeviceRGB,
     WebCore::ColorSpace::ColorSpaceSRGB,
     WebCore::ColorSpace::ColorSpaceLinearRGB,
     WebCore::ColorSpace::ColorSpaceDisplayP3
index f75c0fa..f745289 100644 (file)
@@ -1,3 +1,15 @@
+2017-12-12  Simon Fraser  <simon.fraser@apple.com>
+
+        Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
+        https://bugs.webkit.org/show_bug.cgi?id=180689
+
+        Reviewed by Tim Horton.
+
+        Use sRGBColorSpaceRef() from WebCore.
+
+        * WebView/WebHTMLView.mm:
+        (imageFromRect):
+
 2017-12-11  Tim Horton  <timothy_horton@apple.com>
 
         Stop using deprecated target conditional for simulator builds
index 08729c0..45a194a 100644 (file)
 
 #if PLATFORM(IOS)
 #import "WebUIKitDelegate.h"
+#import <WebCore/GraphicsContextCG.h>
 #import <WebCore/KeyEventCodesIOS.h>
 #import <WebCore/PlatformEventFactoryIOS.h>
 #import <WebCore/WAKClipView.h>
@@ -7050,8 +7051,7 @@ static CGImageRef imageFromRect(Frame* frame, CGRect rect)
     size_t bitsPerComponent = 8;
     size_t bitsPerPixel = 4 * bitsPerComponent;
     size_t bytesPerRow = ((bitsPerPixel + 7) / 8) * width;
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-    RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace.get(), kCGImageAlphaPremultipliedLast));
+    RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, sRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
     if (!context)
         return nil;