Commit 761d5d01 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

2010-12-28 Pratik Solanki <psolanki@apple.com>

        Reviewed by Eric Seidel.

        https://bugs.webkit.org/show_bug.cgi?id=51522
        Use deviceRGBColorSpaceRef() instead of calling CGColorSpaceCreateDeviceRGB()

        * page/win/FrameCGWin.cpp:
        (WebCore::imageFromRect):
        * platform/graphics/cg/GradientCG.cpp:
        (WebCore::Gradient::platformGradient):
        * platform/graphics/cg/GraphicsContext3DCG.cpp:
        (WebCore::GraphicsContext3D::paintToCanvas):
        * platform/graphics/cg/ImageCG.cpp:
        (WebCore::BitmapImage::checkForSolidColor):
        * platform/graphics/gstreamer/ImageGStreamerCG.mm:
        (ImageGStreamer::ImageGStreamer):
        * 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/image-decoders/cg/ImageDecoderCG.cpp:
        (WebCore::createColorSpace):
        * platform/win/DragImageCGWin.cpp:
        (WebCore::allocImage):
        (WebCore::createCgContextFromBitmap):
        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::paintMenuListButtonGradients):
        (WebCore::RenderThemeMac::paintSliderTrack):
        * rendering/RenderThemeSafari.cpp:
        (WebCore::RenderThemeSafari::paintMenuListButtonGradients):
        (WebCore::RenderThemeSafari::paintSliderTrack):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 192a76c1
2010-12-28 Pratik Solanki <psolanki@apple.com>
Reviewed by Eric Seidel.
https://bugs.webkit.org/show_bug.cgi?id=51522
Use deviceRGBColorSpaceRef() instead of calling CGColorSpaceCreateDeviceRGB()
* page/win/FrameCGWin.cpp:
(WebCore::imageFromRect):
* platform/graphics/cg/GradientCG.cpp:
(WebCore::Gradient::platformGradient):
* platform/graphics/cg/GraphicsContext3DCG.cpp:
(WebCore::GraphicsContext3D::paintToCanvas):
* platform/graphics/cg/ImageCG.cpp:
(WebCore::BitmapImage::checkForSolidColor):
* platform/graphics/gstreamer/ImageGStreamerCG.mm:
(ImageGStreamer::ImageGStreamer):
* 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/image-decoders/cg/ImageDecoderCG.cpp:
(WebCore::createColorSpace):
* platform/win/DragImageCGWin.cpp:
(WebCore::allocImage):
(WebCore::createCgContextFromBitmap):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonGradients):
(WebCore::RenderThemeMac::paintSliderTrack):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::paintMenuListButtonGradients):
(WebCore::RenderThemeSafari::paintSliderTrack):
2010-12-28 Daniel Bates <dbates@rim.com>
 
Reviewed by Sam Weinig.
......
......@@ -30,7 +30,7 @@
#include "BitmapInfo.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
#include "Settings.h"
#include <CoreGraphics/CoreGraphics.h>
......@@ -63,10 +63,8 @@ static HBITMAP imageFromRect(const Frame* frame, IntRect& ir)
HBITMAP hbmp = CreateDIBSection(0, &bmp, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(static_cast<void*>(bits), w, h,
8, w * sizeof(RGBQUAD), deviceRGB, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease(deviceRGB);
8, w * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
CGContextSaveGState(context);
GraphicsContext gc(context);
......
......@@ -28,7 +28,7 @@
#include "Gradient.h"
#include "CSSParser.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
#include <ApplicationServices/ApplicationServices.h>
#include <wtf/RetainPtr.h>
......@@ -65,7 +65,7 @@ CGShadingRef Gradient::platformGradient()
const CGFunctionCallbacks gradientCallbacks = { 0, gradientCallback, 0 };
RetainPtr<CGFunctionRef> colorFunction(AdoptCF, CGFunctionCreate(this, 1, intervalRanges, 4, colorComponentRanges, &gradientCallbacks));
static CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorSpaceRef colorSpace = deviceRGBColorSpaceRef();
if (m_radial)
m_gradient = CGShadingCreateRadial(colorSpace, m_p0, m_r0, m_p1, m_r1, colorFunction.get(), true, true);
......@@ -80,8 +80,6 @@ CGGradientRef Gradient::platformGradient()
if (m_gradient)
return m_gradient;
static CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
sortStopsIfNecessary();
const int cReservedStops = 3;
......@@ -100,7 +98,7 @@ CGGradientRef Gradient::platformGradient()
locations.uncheckedAppend(m_stops[i].stop);
}
m_gradient = CGGradientCreateWithColorComponents(colorSpace, colorComponents.data(), locations.data(), m_stops.size());
m_gradient = CGGradientCreateWithColorComponents(deviceRGBColorSpaceRef(), colorComponents.data(), locations.data(), m_stops.size());
return m_gradient;
}
......
......@@ -29,6 +29,7 @@
#if ENABLE(3D_CANVAS)
#include "GraphicsContext3D.h"
#include "GraphicsContextCG.h"
#include "Image.h"
......@@ -236,8 +237,7 @@ void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imag
return;
int rowBytes = imageWidth * 4;
RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithData(0, imagePixels, rowBytes * imageHeight, 0));
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
RetainPtr<CGImageRef> cgImage(AdoptCF, CGImageCreate(imageWidth, imageHeight, 8, 32, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
RetainPtr<CGImageRef> cgImage(AdoptCF, CGImageCreate(imageWidth, imageHeight, 8, 32, rowBytes, deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
dataProvider.get(), 0, false, kCGRenderingIntentDefault));
// CSS styling may cause the canvas's content to be resized on
// the page. Go back to the Canvas to figure out the correct
......
......@@ -112,8 +112,7 @@ void BitmapImage::checkForSolidColor()
// Currently we only check for solid color in the important special case of a 1x1 image.
if (image && CGImageGetWidth(image) == 1 && CGImageGetHeight(image) == 1) {
unsigned char pixel[4]; // RGBA
static CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
RetainPtr<CGContextRef> bmap(AdoptCF, CGBitmapContextCreate(pixel, 1, 1, 8, sizeof(pixel), space,
RetainPtr<CGContextRef> bmap(AdoptCF, CGBitmapContextCreate(pixel, 1, 1, 8, sizeof(pixel), deviceRGBColorSpaceRef(),
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big));
if (!bmap)
return;
......
......@@ -18,6 +18,8 @@
*/
#include "config.h"
#include "GraphicsContextCG.h"
#include "ImageGStreamer.h"
#if USE(GSTREAMER)
......@@ -43,8 +45,7 @@ ImageGStreamer::ImageGStreamer(GstBuffer*& buffer, IntSize size)
RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(0, static_cast<UInt8*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer), kCFAllocatorNull));
RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithCFData(data.get()));
static CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGImageRef frameImage = CGImageCreate(size.width(), size.height(), 8, 32, size.width()*4, colorSpace,
CGImageRef frameImage = CGImageCreate(size.width(), size.height(), 8, 32, size.width()*4, deviceRGBColorSpaceRef(),
kCGBitmapByteOrder32Little | kCGImageAlphaFirst, provider.get(), 0, false, kCGRenderingIntentDefault);
m_image = BitmapImage::create(frameImage);
}
......
......@@ -24,7 +24,7 @@
*/
#include "config.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
#include "AffineTransform.h"
#include "Path.h"
......@@ -40,7 +40,6 @@ namespace WebCore {
static CGContextRef CGContextWithHDC(HDC hdc, bool hasAlpha)
{
HBITMAP bitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP));
CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
BITMAP info;
GetObject(bitmap, sizeof(info), &info);
......@@ -48,8 +47,7 @@ static CGContextRef CGContextWithHDC(HDC hdc, bool hasAlpha)
CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | (hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst);
CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
info.bmWidthBytes, deviceRGB, bitmapInfo);
CGColorSpaceRelease(deviceRGB);
info.bmWidthBytes, deviceRGBColorSpaceRef(), bitmapInfo);
// Flip coords
CGContextTranslateCTM(context, 0, info.bmHeight);
......@@ -101,11 +99,9 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo
GetObject(bitmap, sizeof(info), &info);
ASSERT(info.bmBitsPixel == 32);
CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
CGContextRef bitmapContext = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
info.bmWidthBytes, deviceRGB, kCGBitmapByteOrder32Little |
info.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little |
(supportAlphaBlend ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst));
CGColorSpaceRelease(deviceRGB);
CGImageRef image = CGBitmapContextCreateImage(bitmapContext);
CGContextDrawImage(m_data->m_cgContext.get(), dstRect, image);
......@@ -119,12 +115,11 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo
void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& point)
{
RetainPtr<CGColorSpaceRef> deviceRGB(AdoptCF, CGColorSpaceCreateDeviceRGB());
// FIXME: Creating CFData is non-optimal, but needed to avoid crashing when printing. Ideally we should
// 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(), deviceRGB.get(),
RetainPtr<CGImageRef> cgImage(AdoptCF, CGImageCreate(image->size().width(), image->size().height(), 8, 32, image->bytesPerRow(), deviceRGBColorSpaceRef(),
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());
}
......
......@@ -28,7 +28,7 @@
#include "BitmapImage.h"
#include "BitmapInfo.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
#include "PlatformString.h"
#include <ApplicationServices/ApplicationServices.h>
#include <windows.h>
......@@ -50,9 +50,8 @@ PassRefPtr<BitmapImage> BitmapImage::create(HBITMAP hBitmap)
if (!dibSection.dsBm.bmBits)
return 0;
RetainPtr<CGColorSpaceRef> deviceRGB(AdoptCF, CGColorSpaceCreateDeviceRGB());
RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(dibSection.dsBm.bmBits, dibSection.dsBm.bmWidth, dibSection.dsBm.bmHeight, 8,
dibSection.dsBm.bmWidthBytes, deviceRGB.get(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
dibSection.dsBm.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
// The BitmapImage takes ownership of this.
CGImageRef cgImage = CGBitmapContextCreateImage(bitmapContext.get());
......@@ -70,9 +69,8 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, LPSIZE size)
ASSERT(bmpInfo.bmBitsPixel == 32);
int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight;
CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
CGContextRef cgContext = CGBitmapContextCreate(bmpInfo.bmBits, bmpInfo.bmWidth, bmpInfo.bmHeight,
8, bmpInfo.bmWidthBytes, deviceRGB, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
8, bmpInfo.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
GraphicsContext gc(cgContext);
......@@ -84,7 +82,6 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, LPSIZE size)
// Do cleanup
CGContextRelease(cgContext);
CGColorSpaceRelease(deviceRGB);
return true;
}
......
......@@ -26,6 +26,8 @@
#include "config.h"
#include "ImageDecoder.h"
#include "GraphicsContextCG.h"
#include <CoreGraphics/CGColorSpace.h>
#include <CoreGraphics/CGImage.h>
......@@ -83,10 +85,9 @@ static CGColorSpaceRef createColorSpace(const ColorProfile& colorProfile)
#if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
return CGColorSpaceCreateWithICCProfile(data.get());
#else
RetainPtr<CGColorSpaceRef> deviceColorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
RetainPtr<CGDataProviderRef> profileDataProvider(AdoptCF, CGDataProviderCreateWithCFData(data.get()));
CGFloat ranges[] = {0.0, 255.0, 0.0, 255.0, 0.0, 255.0};
return CGColorSpaceCreateICCBased(3, ranges, profileDataProvider.get(), deviceColorSpace.get());
return CGColorSpaceCreateICCBased(3, ranges, profileDataProvider.get(), deviceRGBColorSpaceRef());
#endif
}
......
......@@ -28,7 +28,7 @@
#include "BitmapInfo.h"
#include "CachedImage.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
#include "Image.h"
#include "RetainPtr.h"
......@@ -53,11 +53,9 @@ HBITMAP allocImage(HDC dc, IntSize size, CGContextRef *targetRef)
if (!targetRef)
return hbmp;
CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
CGContextRef bitmapContext = CGBitmapContextCreate(bits, bmpInfo.bmiHeader.biWidth, bmpInfo.bmiHeader.biHeight, 8,
bmpInfo.bmiHeader.biWidth * 4, deviceRGB,
bmpInfo.bmiHeader.biWidth * 4, deviceRGBColorSpaceRef(),
kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst);
CGColorSpaceRelease(deviceRGB);
if (!bitmapContext) {
DeleteObject(hbmp);
return 0;
......@@ -73,10 +71,8 @@ static CGContextRef createCgContextFromBitmap(HBITMAP bitmap)
GetObject(bitmap, sizeof(info), &info);
ASSERT(info.bmBitsPixel == 32);
CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
CGContextRef bitmapContext = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
info.bmWidthBytes, deviceRGB, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst);
CGColorSpaceRelease(deviceRGB);
info.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst);
return bitmapContext;
}
......
......@@ -27,7 +27,7 @@
#import "Document.h"
#import "Element.h"
#import "FrameView.h"
#import "GraphicsContext.h"
#import "GraphicsContextCG.h"
#import "HTMLInputElement.h"
#import "HTMLMediaElement.h"
#import "HTMLNames.h"
......@@ -1041,25 +1041,25 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn
int radius = topLeftRadius.width();
RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB());
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f);
struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> topFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks));
RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.bottom()), topFunction.get(), false, false));
RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.bottom()), topFunction.get(), false, false));
FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width() - 2.0f * radius, r.height() / 2.0f);
struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> bottomFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &bottomCallbacks));
RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.bottom()), bottomFunction.get(), false, false));
RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.bottom()), bottomFunction.get(), false, false));
struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.bottom()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.bottom()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
paintInfo.context->save();
CGContextClipToRect(context, r);
paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
......@@ -1289,7 +1289,7 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf
LocalCurrentGraphicsContext localContext(paintInfo.context);
CGContextRef context = paintInfo.context->platformContext();
RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB());
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
paintInfo.context->save();
CGContextClipToRect(context, bounds);
......@@ -1298,9 +1298,9 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading;
if (o->style()->appearance() == SliderVerticalPart)
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
else
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
IntSize radius(trackRadius, trackRadius);
paintInfo.context->addRoundedRectClip(bounds,
......
......@@ -31,7 +31,7 @@
#include "Element.h"
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
#include "HTMLInputElement.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
......@@ -760,25 +760,25 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain
int radius = topLeftRadius.width();
RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB());
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f);
struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> topFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks));
RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.bottom()), topFunction.get(), false, false));
RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.bottom()), topFunction.get(), false, false));
FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width() - 2.0f * radius, r.height() / 2.0f);
struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> bottomFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &bottomCallbacks));
RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.bottom()), bottomFunction.get(), false, false));
RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.bottom()), bottomFunction.get(), false, false));
struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.bottom()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.bottom()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
paintInfo.context->save();
CGContextClipToRect(context, r);
paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
......@@ -968,7 +968,7 @@ bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paint
}
CGContextRef context = paintInfo.context->platformContext();
RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB());
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
paintInfo.context->save();
CGContextClipToRect(context, bounds);
......@@ -977,9 +977,9 @@ bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paint
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading;
if (o->style()->appearance() == SliderVerticalPart)
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
else
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
IntSize radius(trackRadius, trackRadius);
paintInfo.context->addRoundedRectClip(bounds,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment