Title: [193953] branches/safari-601.1.46-branch/Source
Revision
193953
Author
matthew_han...@apple.com
Date
2015-12-11 04:34:30 -0800 (Fri, 11 Dec 2015)

Log Message

Merge r192712. rdar://problem/23814340

Modified Paths

Diff

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-11 12:34:30 UTC (rev 193953)
@@ -1,3 +1,52 @@
+2015-12-09  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r192712. rdar://problem/23814340
+
+    2015-11-20  Simon Fraser  <simon.fra...@apple.com>
+
+            More deviceRGB color cleanup
+            https://bugs.webkit.org/show_bug.cgi?id=151523
+            <rdar://problem/23638597>
+
+            Reviewed by Tim Horton.
+
+            Replace calls to deviceRGBColorSpaceRef() with sRGBColorSpaceRef(), and use
+            sRGBColorSpaceRef() in a few places that were manually creating the colorspace.
+
+            Also use cachedCGColor() in a more places that were manually constructing CGColorRefs
+            from Colors.
+
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
+            (WebCore::createImageFromPixelBuffer):
+            * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
+            * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+            (PlatformCALayerCocoa::setBackgroundColor):
+            (PlatformCALayerCocoa::setBorderColor):
+            * platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm:
+            (-[WebLightSystemBackdropLayer init]):
+            (-[WebDarkSystemBackdropLayer init]):
+            * platform/graphics/cg/GradientCG.cpp:
+            (WebCore::Gradient::platformGradient):
+            * platform/graphics/cg/GraphicsContext3DCG.cpp:
+            (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
+            (WebCore::GraphicsContext3D::paintToCanvas):
+            * platform/graphics/cg/ImageBufferCG.cpp:
+            (WebCore::ImageBuffer::copyImage):
+            (WebCore::ImageBuffer::toDataURL):
+            (WebCore::ImageDataToDataURL):
+            * platform/graphics/mac/GraphicsContextMac.mm:
+            (WebCore::linearRGBColorSpaceRef):
+            * platform/graphics/mac/WebGLLayer.mm:
+            (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
+            * platform/mediastream/mac/AVVideoCaptureSource.mm:
+            (WebCore::AVVideoCaptureSource::currentFrameCGImage):
+            * rendering/RenderThemeIOS.mm:
+            (WebCore::drawRadialGradient):
+            * rendering/RenderThemeMac.mm:
+            (WebCore::RenderThemeMac::paintMenuListButtonGradients):
+            (WebCore::RenderThemeMac::paintSliderTrack):
+
 2015-12-11  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r193859. rdar://problem/23814345

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -1576,7 +1576,7 @@
 
     [m_imageGenerator.get() setMaximumSize:CGSize(rect.size())];
     RetainPtr<CGImageRef> rawImage = adoptCF([m_imageGenerator.get() copyCGImageAtTime:CMTimeMakeWithSeconds(time, 600) actualTime:nil error:nil]);
-    RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawImage.get(), deviceRGBColorSpaceRef()));
+    RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawImage.get(), sRGBColorSpaceRef()));
 
 #if !LOG_DISABLED
     double duration = monotonicallyIncreasingTime() - start;
@@ -2310,7 +2310,7 @@
     CGDataProviderDirectCallbacks providerCallbacks = { 0, CVPixelBufferGetBytePointerCallback, CVPixelBufferReleaseBytePointerCallback, 0, CVPixelBufferReleaseInfoCallback };
     RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateDirect(pixelBuffer, byteLength, &providerCallbacks));
 
-    return adoptCF(CGImageCreate(width, height, 8, 32, bytesPerRow, deviceRGBColorSpaceRef(), bitmapInfo, provider.get(), NULL, false, kCGRenderingIntentDefault));
+    return adoptCF(CGImageCreate(width, height, 8, 32, bytesPerRow, sRGBColorSpaceRef(), bitmapInfo, provider.get(), NULL, false, kCGRenderingIntentDefault));
 }
 
 void MediaPlayerPrivateAVFoundationObjC::updateLastImage()

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -86,12 +86,7 @@
             // <rdar://problem/10959969> Handle case where drop-shadow is not the last filter.
             const auto& dropShadowOperation = downcast<DropShadowFilterOperation>(filterOperation);
             [layer setShadowOffset:CGSizeMake(dropShadowOperation.x(), dropShadowOperation.y())];
-
-            CGFloat components[4];
-            dropShadowOperation.color().getRGBA(components[0], components[1], components[2], components[3]);
-            RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-            RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
-            [layer setShadowColor:color.get()];
+            [layer setShadowColor:cachedCGColor(dropShadowOperation.color(), ColorSpaceDeviceRGB)];
             [layer setShadowRadius:dropShadowOperation.stdDeviation()];
             [layer setShadowOpacity:1];
             break;

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -702,14 +702,8 @@
 
 void PlatformCALayerCocoa::setBackgroundColor(const Color& value)
 {
-    CGFloat components[4];
-    value.getRGBA(components[0], components[1], components[2], components[3]);
-
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-    RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
-
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer setBackgroundColor:color.get()];
+    [m_layer setBackgroundColor:cachedCGColor(value, ColorSpaceDeviceRGB)];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -723,14 +717,8 @@
 void PlatformCALayerCocoa::setBorderColor(const Color& value)
 {
     if (value.isValid()) {
-        CGFloat components[4];
-        value.getRGBA(components[0], components[1], components[2], components[3]);
-
-        RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-        RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
-
         BEGIN_BLOCK_OBJC_EXCEPTIONS
-        [m_layer setBorderColor:color.get()];
+        [m_layer setBorderColor:cachedCGColor(value, ColorSpaceDeviceRGB)];
         END_BLOCK_OBJC_EXCEPTIONS
     } else {
         BEGIN_BLOCK_OBJC_EXCEPTIONS

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -51,7 +51,7 @@
 #endif
 
     CGFloat components[4] = { 0.8, 0.8, 0.8, 0.8 };
-    [super setBackgroundColor:CGColorCreate(cachedCGColorSpace(ColorSpaceSRGB), components)];
+    [super setBackgroundColor:CGColorCreate(sRGBColorSpaceRef(), components)];
 
     return self;
 }
@@ -77,7 +77,7 @@
 #endif
 
     CGFloat components[4] = { 0.2, 0.2, 0.2, 0.8 };
-    [super setBackgroundColor:CGColorCreate(cachedCGColorSpace(ColorSpaceSRGB), components)];
+    [super setBackgroundColor:CGColorCreate(sRGBColorSpaceRef(), components)];
 
     return self;
 }

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/GradientCG.cpp (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/GradientCG.cpp	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/GradientCG.cpp	2015-12-11 12:34:30 UTC (rev 193953)
@@ -62,7 +62,7 @@
         locations.uncheckedAppend(m_stops[i].stop);
     }
     
-    m_gradient = CGGradientCreateWithColorComponents(deviceRGBColorSpaceRef(), colorComponents.data(), locations.data(), m_stops.size());
+    m_gradient = CGGradientCreateWithColorComponents(sRGBColorSpaceRef(), colorComponents.data(), locations.data(), m_stops.size());
 
     return m_gradient;
 }

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp	2015-12-11 12:34:30 UTC (rev 193953)
@@ -358,7 +358,7 @@
         // alpha channel. Creation of a bitmap context with an alpha channel
         // doesn't seem to work unless it's premultiplied.
         bitmapContext = adoptCF(CGBitmapContextCreate(0, m_imageWidth, m_imageHeight, 8, m_imageWidth * 4,
-            deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+            sRGBColorSpaceRef(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
         if (!bitmapContext)
             return false;
 
@@ -521,7 +521,7 @@
     } else
         dataProvider = adoptCF(CGDataProviderCreateWithData(0, imagePixels, rowBytes * imageHeight, 0));
 
-    RetainPtr<CGImageRef> cgImage = adoptCF(CGImageCreate(imageWidth, imageHeight, 8, 32, rowBytes, deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+    RetainPtr<CGImageRef> cgImage = adoptCF(CGImageCreate(imageWidth, imageHeight, 8, 32, rowBytes, sRGBColorSpaceRef(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
         dataProvider.get(), 0, false, kCGRenderingIntentDefault));
 
     // CSS styling may cause the canvas's content to be resized on

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2015-12-11 12:34:30 UTC (rev 193953)
@@ -185,7 +185,7 @@
         image = createCroppedImageIfNecessary(image.get(), internalSize());
     } else {
         image = copyNativeImage(DontCopyBackingStore);
-        RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
+        RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), sRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
         CGContextSetBlendMode(context.get(), kCGBlendModeCopy);
         CGContextClipToRect(context.get(), FloatRect(FloatPoint::zero(), logicalSize()));
         FloatSize imageSizeInUserSpace = scaleSizeToUserSpace(logicalSize(), m_data.backingStoreSize, internalSize());
@@ -448,14 +448,14 @@
             return "data:,";
 
         image = adoptCF(CGImageCreate(logicalSize().width(), logicalSize().height(), 8, 32, 4 * logicalSize().width(),
-                                    deviceRGBColorSpaceRef(), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast,
+                                    sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast,
                                     dataProvider.get(), 0, false, kCGRenderingIntentDefault));
     } else if (m_resolutionScale == 1) {
         image = copyNativeImage(CopyBackingStore);
         image = createCroppedImageIfNecessary(image.get(), internalSize());
     } else {
         image = copyNativeImage(DontCopyBackingStore);
-        RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
+        RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), sRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
         CGContextSetBlendMode(context.get(), kCGBlendModeCopy);
         CGContextClipToRect(context.get(), CGRectMake(0, 0, logicalSize().width(), logicalSize().height()));
         FloatSize imageSizeInUserSpace = scaleSizeToUserSpace(logicalSize(), m_data.backingStoreSize, internalSize());
@@ -509,7 +509,7 @@
 
     RetainPtr<CGImageRef> image;
     image = adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(),
-                                deviceRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo,
+                                sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo,
                                 dataProvider.get(), 0, false, kCGRenderingIntentDefault));
 
     return CGImageToDataURL(image.get(), mimeType, quality);

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -301,9 +301,9 @@
     if (iccProfileData)
         linearSRGBSpace = CGColorSpaceCreateWithICCProfile((CFDataRef)iccProfileData.get());
 
-    // If we fail to load the linearized sRGB ICC profile, fall back to DeviceRGB.
+    // If we fail to load the linearized sRGB ICC profile, fall back to sRGB.
     if (!linearSRGBSpace)
-        return deviceRGBColorSpaceRef();
+        return sRGBColorSpaceRef();
 
     return linearSRGBSpace;
 }

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -142,7 +142,7 @@
 
     RetainPtr<CGColorSpaceRef> imageColorSpace = colorSpace;
     if (!imageColorSpace)
-        imageColorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+        imageColorSpace = sRGBColorSpaceRef();
 
     CGRect layerBounds = CGRectIntegral([self bounds]);
 

Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeIOS.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeIOS.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeIOS.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -173,7 +173,7 @@
 
 static void drawRadialGradient(CGContextRef context, IOSGradientRef gradient, const FloatPoint& startPoint, float startRadius, const FloatPoint& stopPoint, float stopRadius, Interpolation interpolation)
 {
-    RetainPtr<CGShadingRef> shading = adoptCF(CGShadingCreateRadial(deviceRGBColorSpaceRef(), startPoint, startRadius, stopPoint, stopRadius, getSharedFunctionRef(gradient, interpolation), false, false));
+    RetainPtr<CGShadingRef> shading = adoptCF(CGShadingCreateRadial(sRGBColorSpaceRef(), startPoint, startRadius, stopPoint, stopRadius, getSharedFunctionRef(gradient, interpolation), false, false));
     CGContextDrawShading(context, shading.get());
 }
 

Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeMac.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeMac.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeMac.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -1231,7 +1231,7 @@
     FloatRoundedRect border = FloatRoundedRect(o.style().getRoundedBorderFor(r));
     int radius = border.radii().topLeft().width();
 
-    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
+    CGColorSpaceRef cspace = sRGBColorSpaceRef();
 
     FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f);
     struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL };
@@ -1496,7 +1496,7 @@
 
     LocalCurrentGraphicsContext localContext(paintInfo.context);
     CGContextRef context = localContext.cgContext();
-    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
+    CGColorSpaceRef cspace = sRGBColorSpaceRef();
 
 #if ENABLE(DATALIST_ELEMENT)
     paintSliderTicks(o, paintInfo, r);

Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-12-11 12:34:30 UTC (rev 193953)
@@ -1,3 +1,29 @@
+2015-12-09  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r192712. rdar://problem/23814340
+
+    2015-11-20  Simon Fraser  <simon.fra...@apple.com>
+
+            More deviceRGB color cleanup
+            https://bugs.webkit.org/show_bug.cgi?id=151523
+            <rdar://problem/23638597>
+
+            Reviewed by Tim Horton.
+
+            Replace calls to deviceRGBColorSpaceRef() with sRGBColorSpaceRef(), and use
+            sRGBColorSpaceRef() in a few places that were manually creating the colorspace.
+
+            Also use cachedCGColor() in a more places that were manually constructing CGColorRefs
+            from Colors.
+
+            * Shared/cg/ShareableBitmapCG.cpp:
+            (WebKit::ShareableBitmap::createGraphicsContext):
+            (WebKit::ShareableBitmap::createCGImage):
+            * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+            (WebKit::cgColorFromColor):
+            * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+            (WebKit::RemoteLayerTreeDrawingAreaProxy::initializeDebugIndicator):
+
 2015-12-10  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r193481. rdar://problem/23110745

Modified: branches/safari-601.1.46-branch/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp	2015-12-11 12:34:30 UTC (rev 193953)
@@ -27,7 +27,7 @@
 #include "ShareableBitmap.h"
 
 #include <WebCore/BitmapImage.h>
-#include <WebCore/GraphicsContext.h>
+#include <WebCore/GraphicsContextCG.h>
 #include <wtf/RetainPtr.h>
 #include "CGUtilities.h"
 
@@ -48,11 +48,9 @@
 
 std::unique_ptr<GraphicsContext> ShareableBitmap::createGraphicsContext()
 {
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-
     ref(); // Balanced by deref in releaseBitmapContextData.
     RetainPtr<CGContextRef> bitmapContext = adoptCF(CGBitmapContextCreateWithData(data(),
-        m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(),
+        m_size.width(), m_size.height(), 8, m_size.width() * 4, sRGBColorSpaceRef(),
         bitmapInfo(m_flags), releaseBitmapContextData, this));
 
     // We want the origin to be in the top left corner so we flip the backing store context.
@@ -90,8 +88,7 @@
 {
     ASSERT_ARG(dataProvider, dataProvider);
 
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-    RetainPtr<CGImageRef> image = adoptCF(CGImageCreate(m_size.width(), m_size.height(), 8, 32, m_size.width() * 4, colorSpace.get(), bitmapInfo(m_flags), dataProvider, 0, false, kCGRenderingIntentDefault));
+    RetainPtr<CGImageRef> image = adoptCF(CGImageCreate(m_size.width(), m_size.height(), 8, 32, m_size.width() * 4, sRGBColorSpaceRef(), bitmapInfo(m_flags), dataProvider, 0, false, kCGRenderingIntentDefault));
     return image;
 }
 

Modified: branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -81,16 +81,12 @@
 
 namespace WebKit {
 
-static RetainPtr<CGColorRef> cgColorFromColor(Color color)
+static CGColorRef cgColorFromColor(const Color& color)
 {
     if (!color.isValid())
         return nil;
 
-    CGFloat components[4];
-    color.getRGBA(components[0], components[1], components[2], components[3]);
-
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
-    return adoptCF(CGColorCreate(colorSpace.get(), components));
+    return cachedCGColor(color, ColorSpaceDeviceRGB);
 }
 
 static NSString *toCAFilterType(PlatformCALayer::FilterType type)
@@ -149,10 +145,10 @@
         layer.bounds = properties.bounds;
     
     if (properties.changedProperties & RemoteLayerTreeTransaction::BackgroundColorChanged)
-        layer.backgroundColor = cgColorFromColor(properties.backgroundColor).get();
+        layer.backgroundColor = cgColorFromColor(properties.backgroundColor);
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::BorderColorChanged)
-        layer.borderColor = cgColorFromColor(properties.borderColor).get();
+        layer.borderColor = cgColorFromColor(properties.borderColor);
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::BorderWidthChanged)
         layer.borderWidth = properties.borderWidth;

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (193952 => 193953)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2015-12-11 10:01:24 UTC (rev 193952)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2015-12-11 12:34:30 UTC (rev 193953)
@@ -34,6 +34,7 @@
 #import "WebPageProxy.h"
 #import "WebProcessProxy.h"
 #import <QuartzCore/QuartzCore.h>
+#import <WebCore/GraphicsContextCG.h>
 #import <WebCore/IOSurfacePool.h>
 #import <WebCore/MachSendRight.h>
 #import <WebCore/WebActionDisablingCALayerDelegate.h>
@@ -355,14 +356,14 @@
     [m_tileMapHostLayer setMasksToBounds:YES];
     [m_tileMapHostLayer setBorderWidth:2];
 
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+    CGColorSpaceRef colorSpace = sRGBColorSpaceRef();
     {
         const CGFloat components[] = { 1, 1, 1, 0.6 };
-        RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
+        RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace, components));
         [m_tileMapHostLayer setBackgroundColor:color.get()];
 
         const CGFloat borderComponents[] = { 0, 0, 0, 1 };
-        RetainPtr<CGColorRef> borderColor = adoptCF(CGColorCreate(colorSpace.get(), borderComponents));
+        RetainPtr<CGColorRef> borderColor = adoptCF(CGColorCreate(colorSpace, borderComponents));
         [m_tileMapHostLayer setBorderColor:borderColor.get()];
     }
     
@@ -372,7 +373,7 @@
 
     {
         const CGFloat components[] = { 0, 1, 0, 1 };
-        RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
+        RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace, components));
         [m_exposedRectIndicatorLayer setBorderColor:color.get()];
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to