mirror of
https://github.com/brl/mutter.git
synced 2025-04-14 14:19:40 +00:00
gradient: Port from GdkColor to GdkRGBA
GdkColor is about to be deprecated, so move to GdkRGBA instead. It might be worth considering using cairo patterns for the gradients rather than using custom code to render gradients to a pixbuf which is then drawn with cairo, but for now this is just a straight port of the existing code. https://bugzilla.gnome.org/show_bug.cgi?id=650586
This commit is contained in:
parent
48cabd1364
commit
8199699e7c
@ -37,19 +37,19 @@ typedef enum
|
|||||||
|
|
||||||
GdkPixbuf* meta_gradient_create_simple (int width,
|
GdkPixbuf* meta_gradient_create_simple (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to,
|
const GdkRGBA *to,
|
||||||
MetaGradientType style);
|
MetaGradientType style);
|
||||||
GdkPixbuf* meta_gradient_create_multi (int width,
|
GdkPixbuf* meta_gradient_create_multi (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int n_colors,
|
int n_colors,
|
||||||
MetaGradientType style);
|
MetaGradientType style);
|
||||||
GdkPixbuf* meta_gradient_create_interwoven (int width,
|
GdkPixbuf* meta_gradient_create_interwoven (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor colors1[2],
|
const GdkRGBA colors1[2],
|
||||||
int thickness1,
|
int thickness1,
|
||||||
const GdkColor colors2[2],
|
const GdkRGBA colors2[2],
|
||||||
int thickness2);
|
int thickness2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,27 +31,27 @@
|
|||||||
*/
|
*/
|
||||||
static GdkPixbuf* meta_gradient_create_horizontal (int width,
|
static GdkPixbuf* meta_gradient_create_horizontal (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to);
|
const GdkRGBA *to);
|
||||||
static GdkPixbuf* meta_gradient_create_vertical (int width,
|
static GdkPixbuf* meta_gradient_create_vertical (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to);
|
const GdkRGBA *to);
|
||||||
static GdkPixbuf* meta_gradient_create_diagonal (int width,
|
static GdkPixbuf* meta_gradient_create_diagonal (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to);
|
const GdkRGBA *to);
|
||||||
static GdkPixbuf* meta_gradient_create_multi_horizontal (int width,
|
static GdkPixbuf* meta_gradient_create_multi_horizontal (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int count);
|
int count);
|
||||||
static GdkPixbuf* meta_gradient_create_multi_vertical (int width,
|
static GdkPixbuf* meta_gradient_create_multi_vertical (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int count);
|
int count);
|
||||||
static GdkPixbuf* meta_gradient_create_multi_diagonal (int width,
|
static GdkPixbuf* meta_gradient_create_multi_diagonal (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int count);
|
int count);
|
||||||
|
|
||||||
|
|
||||||
@ -100,8 +100,8 @@ blank_pixbuf (int width, int height, gboolean no_padding)
|
|||||||
GdkPixbuf*
|
GdkPixbuf*
|
||||||
meta_gradient_create_simple (int width,
|
meta_gradient_create_simple (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to,
|
const GdkRGBA *to,
|
||||||
MetaGradientType style)
|
MetaGradientType style)
|
||||||
{
|
{
|
||||||
switch (style)
|
switch (style)
|
||||||
@ -136,7 +136,7 @@ meta_gradient_create_simple (int width,
|
|||||||
GdkPixbuf*
|
GdkPixbuf*
|
||||||
meta_gradient_create_multi (int width,
|
meta_gradient_create_multi (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int n_colors,
|
int n_colors,
|
||||||
MetaGradientType style)
|
MetaGradientType style)
|
||||||
{
|
{
|
||||||
@ -181,9 +181,9 @@ meta_gradient_create_multi (int width,
|
|||||||
GdkPixbuf*
|
GdkPixbuf*
|
||||||
meta_gradient_create_interwoven (int width,
|
meta_gradient_create_interwoven (int width,
|
||||||
int height,
|
int height,
|
||||||
const GdkColor colors1[2],
|
const GdkRGBA colors1[2],
|
||||||
int thickness1,
|
int thickness1,
|
||||||
const GdkColor colors2[2],
|
const GdkRGBA colors2[2],
|
||||||
int thickness2)
|
int thickness2)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -202,21 +202,21 @@ meta_gradient_create_interwoven (int width,
|
|||||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||||
|
|
||||||
r1 = colors1[0].red<<8;
|
r1 = (long)(colors1[0].red*0xffffff);
|
||||||
g1 = colors1[0].green<<8;
|
g1 = (long)(colors1[0].green*0xffffff);
|
||||||
b1 = colors1[0].blue<<8;
|
b1 = (long)(colors1[0].blue*0xffffff);
|
||||||
|
|
||||||
r2 = colors2[0].red<<8;
|
r2 = (long)(colors2[0].red*0xffffff);
|
||||||
g2 = colors2[0].green<<8;
|
g2 = (long)(colors2[0].green*0xffffff);
|
||||||
b2 = colors2[0].blue<<8;
|
b2 = (long)(colors2[0].blue*0xffffff);
|
||||||
|
|
||||||
dr1 = ((colors1[1].red-colors1[0].red)<<8)/(int)height;
|
dr1 = ((colors1[1].red-colors1[0].red)*0xffffff)/(int)height;
|
||||||
dg1 = ((colors1[1].green-colors1[0].green)<<8)/(int)height;
|
dg1 = ((colors1[1].green-colors1[0].green)*0xffffff)/(int)height;
|
||||||
db1 = ((colors1[1].blue-colors1[0].blue)<<8)/(int)height;
|
db1 = ((colors1[1].blue-colors1[0].blue)*0xffffff)/(int)height;
|
||||||
|
|
||||||
dr2 = ((colors2[1].red-colors2[0].red)<<8)/(int)height;
|
dr2 = ((colors2[1].red-colors2[0].red)*0xffffff)/(int)height;
|
||||||
dg2 = ((colors2[1].green-colors2[0].green)<<8)/(int)height;
|
dg2 = ((colors2[1].green-colors2[0].green)*0xffffff)/(int)height;
|
||||||
db2 = ((colors2[1].blue-colors2[0].blue)<<8)/(int)height;
|
db2 = ((colors2[1].blue-colors2[0].blue)*0xffffff)/(int)height;
|
||||||
|
|
||||||
for (i=0,k=0,l=0,ll=thickness1; i<height; i++)
|
for (i=0,k=0,l=0,ll=thickness1; i<height; i++)
|
||||||
{
|
{
|
||||||
@ -280,8 +280,8 @@ meta_gradient_create_interwoven (int width,
|
|||||||
*/
|
*/
|
||||||
static GdkPixbuf*
|
static GdkPixbuf*
|
||||||
meta_gradient_create_horizontal (int width, int height,
|
meta_gradient_create_horizontal (int width, int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to)
|
const GdkRGBA *to)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
long r, g, b, dr, dg, db;
|
long r, g, b, dr, dg, db;
|
||||||
@ -300,12 +300,12 @@ meta_gradient_create_horizontal (int width, int height,
|
|||||||
ptr = pixels;
|
ptr = pixels;
|
||||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||||
|
|
||||||
r0 = (guchar) (from->red / 256.0);
|
r0 = (guchar) (from->red * 0xff);
|
||||||
g0 = (guchar) (from->green / 256.0);
|
g0 = (guchar) (from->green * 0xff);
|
||||||
b0 = (guchar) (from->blue / 256.0);
|
b0 = (guchar) (from->blue * 0xff);
|
||||||
rf = (guchar) (to->red / 256.0);
|
rf = (guchar) (to->red * 0xff);
|
||||||
gf = (guchar) (to->green / 256.0);
|
gf = (guchar) (to->green * 0xff);
|
||||||
bf = (guchar) (to->blue / 256.0);
|
bf = (guchar) (to->blue * 0xff);
|
||||||
|
|
||||||
r = r0 << 16;
|
r = r0 << 16;
|
||||||
g = g0 << 16;
|
g = g0 << 16;
|
||||||
@ -348,8 +348,8 @@ meta_gradient_create_horizontal (int width, int height,
|
|||||||
*/
|
*/
|
||||||
static GdkPixbuf*
|
static GdkPixbuf*
|
||||||
meta_gradient_create_vertical (int width, int height,
|
meta_gradient_create_vertical (int width, int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to)
|
const GdkRGBA *to)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
long r, g, b, dr, dg, db;
|
long r, g, b, dr, dg, db;
|
||||||
@ -367,12 +367,12 @@ meta_gradient_create_vertical (int width, int height,
|
|||||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||||
|
|
||||||
r0 = (guchar) (from->red / 256.0);
|
r0 = (guchar) (from->red * 0xff);
|
||||||
g0 = (guchar) (from->green / 256.0);
|
g0 = (guchar) (from->green * 0xff);
|
||||||
b0 = (guchar) (from->blue / 256.0);
|
b0 = (guchar) (from->blue * 0xff);
|
||||||
rf = (guchar) (to->red / 256.0);
|
rf = (guchar) (to->red * 0xff);
|
||||||
gf = (guchar) (to->green / 256.0);
|
gf = (guchar) (to->green * 0xff);
|
||||||
bf = (guchar) (to->blue / 256.0);
|
bf = (guchar) (to->blue * 0xff);
|
||||||
|
|
||||||
r = r0<<16;
|
r = r0<<16;
|
||||||
g = g0<<16;
|
g = g0<<16;
|
||||||
@ -419,8 +419,8 @@ meta_gradient_create_vertical (int width, int height,
|
|||||||
|
|
||||||
static GdkPixbuf*
|
static GdkPixbuf*
|
||||||
meta_gradient_create_diagonal (int width, int height,
|
meta_gradient_create_diagonal (int width, int height,
|
||||||
const GdkColor *from,
|
const GdkRGBA *from,
|
||||||
const GdkColor *to)
|
const GdkRGBA *to)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf, *tmp;
|
GdkPixbuf *pixbuf, *tmp;
|
||||||
int j;
|
int j;
|
||||||
@ -467,7 +467,7 @@ meta_gradient_create_diagonal (int width, int height,
|
|||||||
|
|
||||||
static GdkPixbuf*
|
static GdkPixbuf*
|
||||||
meta_gradient_create_multi_horizontal (int width, int height,
|
meta_gradient_create_multi_horizontal (int width, int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
@ -498,16 +498,16 @@ meta_gradient_create_multi_horizontal (int width, int height,
|
|||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
|
|
||||||
r = colors[0].red << 8;
|
r = (long)(colors[0].red * 0xffffff);
|
||||||
g = colors[0].green << 8;
|
g = (long)(colors[0].green * 0xffffff);
|
||||||
b = colors[0].blue << 8;
|
b = (long)(colors[0].blue * 0xffffff);
|
||||||
|
|
||||||
/* render the first line */
|
/* render the first line */
|
||||||
for (i=1; i<count; i++)
|
for (i=1; i<count; i++)
|
||||||
{
|
{
|
||||||
dr = ((int)(colors[i].red - colors[i-1].red) <<8)/(int)width2;
|
dr = (int)((colors[i].red - colors[i-1].red) *0xffffff)/(int)width2;
|
||||||
dg = ((int)(colors[i].green - colors[i-1].green)<<8)/(int)width2;
|
dg = (int)((colors[i].green - colors[i-1].green)*0xffffff)/(int)width2;
|
||||||
db = ((int)(colors[i].blue - colors[i-1].blue) <<8)/(int)width2;
|
db = (int)((colors[i].blue - colors[i-1].blue) *0xffffff)/(int)width2;
|
||||||
for (j=0; j<width2; j++)
|
for (j=0; j<width2; j++)
|
||||||
{
|
{
|
||||||
*ptr++ = (unsigned char)(r>>16);
|
*ptr++ = (unsigned char)(r>>16);
|
||||||
@ -518,9 +518,9 @@ meta_gradient_create_multi_horizontal (int width, int height,
|
|||||||
b += db;
|
b += db;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
r = colors[i].red << 8;
|
r = (long)(colors[i].red * 0xffffff);
|
||||||
g = colors[i].green << 8;
|
g = (long)(colors[i].green * 0xffffff);
|
||||||
b = colors[i].blue << 8;
|
b = (long)(colors[i].blue * 0xffffff);
|
||||||
}
|
}
|
||||||
for (j=k; j<width; j++)
|
for (j=k; j<width; j++)
|
||||||
{
|
{
|
||||||
@ -539,7 +539,7 @@ meta_gradient_create_multi_horizontal (int width, int height,
|
|||||||
|
|
||||||
static GdkPixbuf*
|
static GdkPixbuf*
|
||||||
meta_gradient_create_multi_vertical (int width, int height,
|
meta_gradient_create_multi_vertical (int width, int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
@ -570,15 +570,15 @@ meta_gradient_create_multi_vertical (int width, int height,
|
|||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
|
|
||||||
r = colors[0].red << 8;
|
r = (long)(colors[0].red * 0xffffff);
|
||||||
g = colors[0].green << 8;
|
g = (long)(colors[0].green * 0xffffff);
|
||||||
b = colors[0].blue << 8;
|
b = (long)(colors[0].blue * 0xffffff);
|
||||||
|
|
||||||
for (i=1; i<count; i++)
|
for (i=1; i<count; i++)
|
||||||
{
|
{
|
||||||
dr = ((int)(colors[i].red - colors[i-1].red) <<8)/(int)height2;
|
dr = (int)((colors[i].red - colors[i-1].red) *0xffffff)/(int)height2;
|
||||||
dg = ((int)(colors[i].green - colors[i-1].green)<<8)/(int)height2;
|
dg = (int)((colors[i].green - colors[i-1].green)*0xffffff)/(int)height2;
|
||||||
db = ((int)(colors[i].blue - colors[i-1].blue) <<8)/(int)height2;
|
db = (int)((colors[i].blue - colors[i-1].blue) *0xffffff)/(int)height2;
|
||||||
|
|
||||||
for (j=0; j<height2; j++)
|
for (j=0; j<height2; j++)
|
||||||
{
|
{
|
||||||
@ -597,9 +597,9 @@ meta_gradient_create_multi_vertical (int width, int height,
|
|||||||
b += db;
|
b += db;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
r = colors[i].red << 8;
|
r = (long)(colors[i].red * 0xffffff);
|
||||||
g = colors[i].green << 8;
|
g = (long)(colors[i].green * 0xffffff);
|
||||||
b = colors[i].blue << 8;
|
b = (long)(colors[i].blue * 0xffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k<height)
|
if (k<height)
|
||||||
@ -629,7 +629,7 @@ meta_gradient_create_multi_vertical (int width, int height,
|
|||||||
|
|
||||||
static GdkPixbuf*
|
static GdkPixbuf*
|
||||||
meta_gradient_create_multi_diagonal (int width, int height,
|
meta_gradient_create_multi_diagonal (int width, int height,
|
||||||
const GdkColor *colors,
|
const GdkRGBA *colors,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf, *tmp;
|
GdkPixbuf *pixbuf, *tmp;
|
||||||
|
@ -33,18 +33,20 @@ draw_checkerboard (cairo_t *cr,
|
|||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
gint i, j, xcount, ycount;
|
gint i, j, xcount, ycount;
|
||||||
GdkColor color1, color2;
|
GdkRGBA color1, color2;
|
||||||
|
|
||||||
#define CHECK_SIZE 10
|
#define CHECK_SIZE 10
|
||||||
#define SPACING 2
|
#define SPACING 2
|
||||||
|
|
||||||
color1.red = 30000;
|
color1.red = 30000. / 65535.;
|
||||||
color1.green = 30000;
|
color1.green = 30000. / 65535.;
|
||||||
color1.blue = 30000;
|
color1.blue = 30000. / 65535.;
|
||||||
|
color1.alpha = 1.0;
|
||||||
|
|
||||||
color2.red = 50000;
|
color2.red = 50000. / 65535.;
|
||||||
color2.green = 50000;
|
color2.green = 50000. / 65535.;
|
||||||
color2.blue = 50000;
|
color2.blue = 50000. / 65535.;
|
||||||
|
color2.alpha = 1.0;
|
||||||
|
|
||||||
xcount = 0;
|
xcount = 0;
|
||||||
i = SPACING;
|
i = SPACING;
|
||||||
@ -55,9 +57,9 @@ draw_checkerboard (cairo_t *cr,
|
|||||||
while (j < height)
|
while (j < height)
|
||||||
{
|
{
|
||||||
if (ycount % 2)
|
if (ycount % 2)
|
||||||
gdk_cairo_set_source_color (cr, &color1);
|
gdk_cairo_set_source_rgba (cr, &color1);
|
||||||
else
|
else
|
||||||
gdk_cairo_set_source_color (cr, &color2);
|
gdk_cairo_set_source_rgba (cr, &color2);
|
||||||
|
|
||||||
/* If we're outside event->area, this will do nothing.
|
/* If we're outside event->area, this will do nothing.
|
||||||
* It might be mildly more efficient if we handled
|
* It might be mildly more efficient if we handled
|
||||||
@ -82,10 +84,10 @@ render_simple (cairo_t *cr,
|
|||||||
gboolean with_alpha)
|
gboolean with_alpha)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkColor from, to;
|
GdkRGBA from, to;
|
||||||
|
|
||||||
gdk_color_parse ("blue", &from);
|
gdk_rgba_parse (&from, "blue");
|
||||||
gdk_color_parse ("green", &to);
|
gdk_rgba_parse (&to, "green");
|
||||||
|
|
||||||
pixbuf = meta_gradient_create_simple (width, height,
|
pixbuf = meta_gradient_create_simple (width, height,
|
||||||
&from, &to,
|
&from, &to,
|
||||||
@ -153,13 +155,13 @@ render_multi (cairo_t *cr,
|
|||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
#define N_COLORS 5
|
#define N_COLORS 5
|
||||||
GdkColor colors[N_COLORS];
|
GdkRGBA colors[N_COLORS];
|
||||||
|
|
||||||
gdk_color_parse ("red", &colors[0]);
|
gdk_rgba_parse (&colors[0], "red");
|
||||||
gdk_color_parse ("blue", &colors[1]);
|
gdk_rgba_parse (&colors[1], "blue");
|
||||||
gdk_color_parse ("orange", &colors[2]);
|
gdk_rgba_parse (&colors[2], "orange");
|
||||||
gdk_color_parse ("pink", &colors[3]);
|
gdk_rgba_parse (&colors[3], "pink");
|
||||||
gdk_color_parse ("green", &colors[4]);
|
gdk_rgba_parse (&colors[4], "green");
|
||||||
|
|
||||||
pixbuf = meta_gradient_create_multi (width, height,
|
pixbuf = meta_gradient_create_multi (width, height,
|
||||||
colors, N_COLORS,
|
colors, N_COLORS,
|
||||||
@ -200,12 +202,12 @@ render_interwoven_func (cairo_t *cr,
|
|||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
#define N_COLORS 4
|
#define N_COLORS 4
|
||||||
GdkColor colors[N_COLORS];
|
GdkRGBA colors[N_COLORS];
|
||||||
|
|
||||||
gdk_color_parse ("red", &colors[0]);
|
gdk_rgba_parse (&colors[0], "red");
|
||||||
gdk_color_parse ("blue", &colors[1]);
|
gdk_rgba_parse (&colors[1], "blue");
|
||||||
gdk_color_parse ("pink", &colors[2]);
|
gdk_rgba_parse (&colors[2], "pink");
|
||||||
gdk_color_parse ("green", &colors[3]);
|
gdk_rgba_parse (&colors[3], "green");
|
||||||
|
|
||||||
pixbuf = meta_gradient_create_interwoven (width, height,
|
pixbuf = meta_gradient_create_interwoven (width, height,
|
||||||
colors, height / 10,
|
colors, height / 10,
|
||||||
@ -234,7 +236,7 @@ draw_callback (GtkWidget *widget,
|
|||||||
gtk_style_context_lookup_color (style, "foreground-color", &color);
|
gtk_style_context_lookup_color (style, "foreground-color", &color);
|
||||||
gtk_style_context_restore (style);
|
gtk_style_context_restore (style);
|
||||||
|
|
||||||
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
|
gdk_cairo_set_source_rgba (cr, &color);
|
||||||
|
|
||||||
(* func) (cr,
|
(* func) (cr,
|
||||||
gtk_widget_get_allocated_width (widget),
|
gtk_widget_get_allocated_width (widget),
|
||||||
|
@ -1020,7 +1020,7 @@ meta_gradient_spec_render (const MetaGradientSpec *spec,
|
|||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
int n_colors;
|
int n_colors;
|
||||||
GdkColor *colors;
|
GdkRGBA *colors;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
int i;
|
int i;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
@ -1030,13 +1030,18 @@ meta_gradient_spec_render (const MetaGradientSpec *spec,
|
|||||||
if (n_colors == 0)
|
if (n_colors == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
colors = g_new (GdkColor, n_colors);
|
colors = g_new (GdkRGBA, n_colors);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
tmp = spec->color_specs;
|
tmp = spec->color_specs;
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
meta_color_spec_render (tmp->data, style, &colors[i]);
|
GdkColor gdk_color;
|
||||||
|
meta_color_spec_render (tmp->data, style, &gdk_color);
|
||||||
|
|
||||||
|
colors[i].red = gdk_color.red / 65535.;
|
||||||
|
colors[i].green = gdk_color.green / 65535.;
|
||||||
|
colors[i].blue = gdk_color.blue / 65535.;
|
||||||
|
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
++i;
|
++i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user