[gtk+] Start using CGFloat



commit c8fef502e20d147ddc229fc4fec177bb1028b92a
Author: Kristian Rietveld <kris gtk org>
Date:   Mon Dec 28 09:01:01 2009 +0100

    Start using CGFloat
    
    Fixes a bunch of compiler warnings.  Since CGFloat does not exist on
    Tiger and earlier, we have added a typedef likewise as was done for
    NSInteger.

 gdk/quartz/gdkcolor-quartz.c   |    8 ++++----
 gdk/quartz/gdkgc-quartz.c      |   20 ++++++++++----------
 gdk/quartz/gdkprivate-quartz.h |   12 ++++++------
 gdk/quartz/gdkwindow-quartz.c  |    2 +-
 gdk/quartz/gdkwindow-quartz.h  |    2 ++
 5 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/gdk/quartz/gdkcolor-quartz.c b/gdk/quartz/gdkcolor-quartz.c
index 3dbc186..e528906 100644
--- a/gdk/quartz/gdkcolor-quartz.c
+++ b/gdk/quartz/gdkcolor-quartz.c
@@ -199,10 +199,10 @@ gdk_colormap_get_screen (GdkColormap *cmap)
 void
 _gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
 					  guint32      pixel,
-					  float       *red,
-					  float       *green,
-					  float       *blue,
-					  float       *alpha)
+					  CGFloat      *red,
+					  CGFloat      *green,
+					  CGFloat      *blue,
+					  CGFloat      *alpha)
 {
   *red   = (pixel >> 16 & 0xff) / 255.0;
   *green = (pixel >> 8  & 0xff) / 255.0;
diff --git a/gdk/quartz/gdkgc-quartz.c b/gdk/quartz/gdkgc-quartz.c
index 66a4e75..d0a2366 100644
--- a/gdk/quartz/gdkgc-quartz.c
+++ b/gdk/quartz/gdkgc-quartz.c
@@ -118,10 +118,10 @@ gdk_quartz_gc_set_dashes (GdkGC *gc,
 
   private->dash_count = n;
   g_free (private->dash_lengths);
-  private->dash_lengths = g_new (gfloat, n);
+  private->dash_lengths = g_new (CGFloat, n);
   for (i = 0; i < n; i++)
-    private->dash_lengths[i] = (gfloat) dash_list[i];
-  private->dash_phase = (gfloat) dash_offset;
+    private->dash_lengths[i] = (CGFloat) dash_list[i];
+  private->dash_phase = (CGFloat) dash_offset;
 }
 
 static void
@@ -269,7 +269,7 @@ _gdk_windowing_gc_copy (GdkGC *dst_gc,
 
   g_free (dst_quartz_gc->dash_lengths);
   dst_quartz_gc->dash_lengths = g_memdup (src_quartz_gc->dash_lengths,
-					  sizeof (float) * src_quartz_gc->dash_count);
+					  sizeof (CGFloat) * src_quartz_gc->dash_count);
   dst_quartz_gc->dash_count = src_quartz_gc->dash_count;
   dst_quartz_gc->dash_phase = src_quartz_gc->dash_phase;
 }
@@ -305,7 +305,7 @@ gdk_quartz_draw_stippled_pattern (void         *info,
   GdkGC      *gc = GDK_GC (info);
   CGImageRef  pattern_image;
   CGRect      rect;
-  gfloat      r, g, b, a;
+  CGFloat     r, g, b, a;
 
   pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl)->image;
   rect = CGRectMake (0, 0,
@@ -327,7 +327,7 @@ gdk_quartz_draw_opaque_stippled_pattern (void         *info,
   GdkGC      *gc = GDK_GC (info);
   CGImageRef  pattern_image;
   CGRect      rect;
-  gfloat      r, g, b, a;
+  CGFloat     r, g, b, a;
 
   pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl)->image;
   rect = CGRectMake (0, 0,
@@ -453,7 +453,7 @@ _gdk_quartz_gc_update_cg_context (GdkGC                      *gc,
     {
       CGLineCap  line_cap  = kCGLineCapButt;
       CGLineJoin line_join = kCGLineJoinMiter;
-      gfloat     r, g, b, a;
+      CGFloat    r, g, b, a;
 
       _gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap, 
 						fg_pixel,
@@ -515,9 +515,9 @@ _gdk_quartz_gc_update_cg_context (GdkGC                      *gc,
       GdkFill         fill = _gdk_gc_get_fill (gc);
       CGColorSpaceRef baseSpace;
       CGColorSpaceRef patternSpace;
-      gfloat          alpha     = 1.0;
-      gfloat          colors[4] = { 0.0, 0.0, 0.0, 0.0 };
-      gfloat          r, g, b, a;
+      CGFloat         alpha     = 1.0;
+      CGFloat         colors[4] = { 0.0, 0.0, 0.0, 0.0 };
+      CGFloat         r, g, b, a;
 
       if (fill == GDK_SOLID)
 	{
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index d7196b2..c857008 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -66,9 +66,9 @@ struct _GdkGCQuartz
   GdkCapStyle       cap_style;
   GdkJoinStyle      join_style;
 
-  gfloat           *dash_lengths;
+  CGFloat          *dash_lengths;
   gint              dash_count;
-  gfloat            dash_phase;
+  CGFloat           dash_phase;
 
   CGPatternRef      ts_pattern;
 
@@ -131,10 +131,10 @@ void   _gdk_quartz_gc_update_cg_context (GdkGC                      *gc,
 /* Colormap */
 void _gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
 					       guint32      pixel,
-					       gfloat      *red,
-					       gfloat      *green,
-					       gfloat      *blue,
-					       gfloat      *alpha);
+					       CGFloat     *red,
+					       CGFloat     *green,
+					       CGFloat     *blue,
+					       CGFloat     *alpha);
 
 /* Window */
 gboolean    _gdk_quartz_window_is_ancestor          (GdkWindow *ancestor,
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 91e5e18..f0bde1b 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -255,7 +255,7 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
   if (bg_pixmap == NULL)
     {
       CGContextRef cg_context;
-      gfloat r, g, b, a;
+      CGFloat r, g, b, a;
       gint i;
 
       cg_context = gdk_quartz_drawable_get_context (GDK_DRAWABLE (impl), FALSE);
diff --git a/gdk/quartz/gdkwindow-quartz.h b/gdk/quartz/gdkwindow-quartz.h
index f16c3af..df001f0 100644
--- a/gdk/quartz/gdkwindow-quartz.h
+++ b/gdk/quartz/gdkwindow-quartz.h
@@ -32,6 +32,8 @@
 #ifndef NSINTEGER_DEFINED
 typedef int NSInteger;
 typedef unsigned int NSUInteger;
+
+typedef float CGFloat;
 #endif
 
 G_BEGIN_DECLS



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