]> git.pld-linux.org Git - packages/icon-slicer.git/blob - icon-slicer-0.3-attachpoints.patch
- release 3
[packages/icon-slicer.git] / icon-slicer-0.3-attachpoints.patch
1 diff -ur icon-slicer-0.3/src/main.c icon-slicer-0.3-attachpoints/src/main.c
2 --- icon-slicer-0.3/src/main.c  2003-06-25 22:17:32.000000000 +0200
3 +++ icon-slicer-0.3-attachpoints/src/main.c     2004-09-30 10:16:43.884414198 +0200
4 @@ -363,6 +363,35 @@
5      }
6  }
7  
8 +struct AttachPointCompare {
9 +  int rowstride;
10 +  const guchar *pixels;
11 +};
12 +
13 +static gint
14 +compare_attach_points     (gconstpointer  a,
15 +                          gconstpointer  b,
16 +                          gpointer       user_data)
17 +{
18 +  const ThemePoint *attach_point_a, *attach_point_b;
19 +  struct AttachPointCompare *compare;
20 +  guint8 red_a, red_b;
21 +  
22 +  attach_point_a = a;
23 +  attach_point_b = b;
24 +  compare = user_data;
25 +
26 +  red_a = compare->pixels[compare->rowstride * attach_point_a->y + 4*attach_point_a->x];
27 +  red_b = compare->pixels[compare->rowstride * attach_point_b->y + 4*attach_point_b->x];
28 +
29 +  if (red_a > red_b)
30 +    return -1;
31 +  if (red_a == red_b)
32 +    return 0;
33 +  return 1;
34 +}
35 +
36 +
37  static void
38  icon_fetch_attach_points (ThemeIcon         *icon,
39                           ThemeIconInstance *instance,
40 @@ -375,7 +404,8 @@
41    
42    const guchar *pixels;
43    int rowstride;
44 -
45 +  struct AttachPointCompare compare;
46 +  
47    theme_source_location_start (source, &icon->location, &start_x, &start_y);
48    image = theme_source_find_image (source, THEME_SOURCE_USE_ATTACH_POINTS);
49    if (!image)
50 @@ -390,6 +420,8 @@
51    
52    rowstride = gdk_pixbuf_get_rowstride (image->image);
53    pixels = gdk_pixbuf_get_pixels (image->image) + start_y * rowstride + start_x * 4;
54 +  compare.pixels = pixels;
55 +  compare.rowstride = rowstride;
56    
57    for (j = 0; j < source->gridsize; j++)
58      {
59 @@ -407,6 +439,10 @@
60        
61        pixels += rowstride;
62      }
63 +
64 +  instance->attach_points = g_slist_sort_with_data (instance->attach_points,
65 +                                                   compare_attach_points,
66 +                                                   &compare);
67  }
68  
69  static gboolean
This page took 0.066595 seconds and 3 git commands to generate.