[gtk+/gtk-2-24] quartz: Always use generic color space



commit f62b56194bcf53b9a720fb4a5f5aca107120edf6
Author: Kristian Rietveld <kris gtk org>
Date:   Tue Oct 19 00:55:52 2010 +0200

    quartz: Always use generic color space
    
    Switch all usage of device color spaces to generic color spaces.  Since
    the former color spaces are no longer device-dependent as of Mac OS X
    10.4, these yielded a very costly color space conversion when drawing
    pixmaps to the screen.  We now avoid this by using the generic color
    space.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=624025

 gdk/quartz/gdkdrawable-quartz.c |    4 ++--
 gdk/quartz/gdkpixmap-quartz.c   |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index 393658c..cd27285 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -565,7 +565,7 @@ gdk_quartz_draw_pixbuf (GdkDrawable     *drawable,
 
   data = gdk_pixbuf_get_pixels (pixbuf);
 
-  colorspace = CGColorSpaceCreateDeviceRGB ();
+  colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
   data_provider = CGDataProviderCreateWithData (NULL, data, pixbuf_height * rowstride, NULL);
 
   image = CGImageCreate (pixbuf_width, pixbuf_height, 8,
@@ -610,7 +610,7 @@ gdk_quartz_draw_image (GdkDrawable     *drawable,
   if (!context)
     return;
 
-  colorspace = CGColorSpaceCreateDeviceRGB ();
+  colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
   data_provider = CGDataProviderCreateWithData (NULL, image->mem, image->height * image->bpl, NULL);
 
   /* FIXME: Make sure that this function draws 32-bit images correctly,
diff --git a/gdk/quartz/gdkpixmap-quartz.c b/gdk/quartz/gdkpixmap-quartz.c
index 9bf318e..5b89a22 100644
--- a/gdk/quartz/gdkpixmap-quartz.c
+++ b/gdk/quartz/gdkpixmap-quartz.c
@@ -65,7 +65,7 @@ gdk_pixmap_impl_quartz_get_image_parameters (GdkPixmap           *pixmap,
           *bytes_per_row = impl->width * 4;
 
         if (colorspace)
-          *colorspace = CGColorSpaceCreateDeviceRGB ();
+          *colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
 
         if (alpha_info)
           *alpha_info = kCGImageAlphaNoneSkipLast;
@@ -82,7 +82,7 @@ gdk_pixmap_impl_quartz_get_image_parameters (GdkPixmap           *pixmap,
           *bytes_per_row = impl->width * 4;
 
         if (colorspace)
-          *colorspace = CGColorSpaceCreateDeviceRGB ();
+          *colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
 
         if (alpha_info)
           *alpha_info = kCGImageAlphaPremultipliedFirst;
@@ -99,7 +99,7 @@ gdk_pixmap_impl_quartz_get_image_parameters (GdkPixmap           *pixmap,
           *bytes_per_row = impl->width;
 
         if (colorspace)
-          *colorspace = CGColorSpaceCreateDeviceGray ();
+          *colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericGray);
 
         if (alpha_info)
           *alpha_info = kCGImageAlphaNone;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]