aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-navigation/orrery/orrery/use.GdkPixbuf.patch
blob: 92d194de081cd9fe111c6d56a1d7101de4f01c81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From: Benjamin Deering
Subject: orrery crashing X
Date: Thursday, September 2, 2010 - 5:25 pm
Link: http://kerneltrap.org/mailarchive/openmoko-community/2010/9/3/13218

diff -uNr orrery.orig//orrery.c orrery/orrery.c
--- orrery.orig//orrery.c	2009-11-30 06:59:44.000000000 +0100
+++ orrery/orrery.c	2010-11-15 22:33:17.000000000 +0100
@@ -1238,12 +1238,44 @@
     }
     currentEntry = currentEntry->forwardPointer;
   }
-  if (nDarkGreyPoints > 0)
-    gdk_draw_points(pixmap, darkGreyGC, darkGreyPoints, nDarkGreyPoints);
-  if (nGreyPoints > 0)
-    gdk_draw_points(pixmap, greyGC, greyPoints, nGreyPoints);
-  if (nWhitePoints > 0)
-    gdk_draw_points(pixmap, whiteGC, whitePoints, nWhitePoints);
+  GdkPixbuf* starDrawingBuf = gdk_pixbuf_get_from_drawable( NULL,
+                                                            pixmap,
+                                                            gdk_colormap_get_system()
+                                                            , 0, 0, 0, 0, displayWidth, displayHeight);
+  g_assert (gdk_pixbuf_get_bits_per_sample (starDrawingBuf) == 8);
+  guchar* p;
+  int rowstride = gdk_pixbuf_get_rowstride (starDrawingBuf);
+  guchar* pixels = gdk_pixbuf_get_pixels (starDrawingBuf);
+  int n_channels = gdk_pixbuf_get_n_channels (starDrawingBuf);
+  GdkGCValues starGCval;
+  GdkColor starColor;
+  int pointNum;
+  gdk_gc_get_values(darkGreyGC, &starGCval);
+  gdk_colormap_query_color( gdk_gc_get_colormap(darkGreyGC),starGCval.foreground.pixel, &starColor );
+  for( pointNum = 0; pointNum < nDarkGreyPoints; pointNum++) {
+    p = pixels + darkGreyPoints[pointNum].y * rowstride + darkGreyPoints[pointNum].x * n_channels;
+    p[0] = starColor.red & 0xff;
+    p[1] = starColor.green & 0xff;
+    p[2] = starColor.blue & 0xff;
+  }
+  gdk_gc_get_values(greyGC, &starGCval);
+  gdk_colormap_query_color( gdk_gc_get_colormap(greyGC), starGCval.foreground.pixel, &starColor );
+  for( pointNum = 0; pointNum < nGreyPoints; pointNum++) {
+    p = pixels + greyPoints[pointNum].y * rowstride + greyPoints[pointNum].x * n_channels;
+    p[0] = starColor.red & 0xff;
+    p[1] = starColor.green & 0xff;
+    p[2] = starColor.blue & 0xff;
+  }
+  gdk_gc_get_values(whiteGC, &starGCval);
+  gdk_colormap_query_color( gdk_gc_get_colormap(whiteGC), starGCval.foreground.pixel, &starColor );
+  for( pointNum = 0; pointNum < nWhitePoints; pointNum++) {
+    p = pixels + whitePoints[pointNum].y * rowstride + whitePoints[pointNum].x * n_channels;
+    p[0] = starColor.red & 0xff;
+    p[1] = starColor.green & 0xff;
+    p[2] = starColor.blue & 0xff;
+  }
+  gdk_draw_pixbuf ( pixmap , NULL , starDrawingBuf,
+            0, 0, 0, 0, displayWidth, displayHeight, GDK_RGB_DITHER_NORMAL, 0, 0 ) ;
 }
 
 void makeTimeString(char *string)