예제 #1
0
파일: ColorCG.cpp 프로젝트: clbr/webkitfltk
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);
}
예제 #2
0
CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush )
{
    const int maxcachedbrush = 58+5; // negative indices are for metabrushes, cache down to -5)
    int brushindex = brush+5;
    if ( brushindex < 0 || brushindex > maxcachedbrush )
    {
        CGColorRef color ;
        HIThemeBrushCreateCGColor( brush, &color );
        return color;
    }
    else
    {
        static bool inited = false;
        static CGColorRef themecolors[maxcachedbrush+1];
        if ( !inited )
        {
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
            for ( int i = 0 ; i <= maxcachedbrush ; ++i )
                HIThemeBrushCreateCGColor( i-5, &themecolors[i] );
            inited = true;
        }
        return CGColorRetain(themecolors[brushindex ]);
    }
}
예제 #3
0
CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush )
{
    const int maxcachedbrush = 58+5; // negative indices are for metabrushes, cache down to -5)
    int brushindex = brush+5;
    if ( brushindex < 0 || brushindex > maxcachedbrush )
    {
        CGColorRef color ;
        HIThemeBrushCreateCGColor( brush, &color );
        return color;
    }
    else
    {
        static bool inited = false;
        static CGColorRef themecolors[maxcachedbrush+1];
        if ( !inited )
        {
            for ( int i = 0 ; i <= maxcachedbrush ; ++i )
                HIThemeBrushCreateCGColor( i-5, &themecolors[i] );
            inited = true;
        }
        return CGColorRetain(themecolors[brushindex ]);
    }
}