Index: work/gtk/layersel/layersel.c =================================================================== --- work/gtk/layersel/layersel.c (revision 8497) +++ work/gtk/layersel/layersel.c (revision 8498) @@ -49,6 +49,14 @@ return ls->grp_row; } +#define set_pixel(dst, r, g, b, a) \ +do { \ + p[0] = r; \ + p[1] = g; \ + p[2] = b; \ + p[3] = a; \ +} while(0) + static GtkWidget *test_pixbuf_pixel_manipulated(int filled) { GdkPixbuf *pixbuf; @@ -74,24 +82,12 @@ w = width; p = pixels; while (w--) { - if ((height == 0) || (height == max_height-1) || (w == 0) || (w == width-1)) { - p[0] = 0x0; - p[1] = 0x0; - p[2] = 0x0; - p[3] = 0xff; - } - else if ((width-w+5 < height) || (filled)) { - p[0] = r; - p[1] = g; - p[2] = b; - p[3] = a; - } - else { - p[0] = 0xff; - p[1] = 0xff; - p[2] = 0xff; - p[3] = 0xff; - } + if ((height == 0) || (height == max_height-1) || (w == 0) || (w == width-1)) + set_pixel(p, 0, 0, 0, 0xff); /* frame */ + else if ((width-w+5 < height) || (filled)) + set_pixel(p, r, g, b, a); /* layer color fill (full or up-left triangle) */ + else + set_pixel(p, 0xff, 0xff, 0xff, 0xff); /* the unfilled part when triangle */ p += 4; } pixels += gdk_pixbuf_get_rowstride(pixbuf);