Parcourir la source

Make dt_color.alpha work as would be expected

Léo Gaspard il y a 8 ans
Parent
commit
3283707c37
2 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 1 1
      dtext.c
  2. 2 0
      examples/basic.c

+ 1 - 1
dtext.c

@@ -171,7 +171,7 @@ dt_draw(dt_context *ctx, dt_font *fnt, dt_color const *color,
 	col.red   = (color->red   << 8) + color->red;
 	col.green = (color->green << 8) + color->green;
 	col.blue  = (color->blue  << 8) + color->blue;
-	col.alpha = 0xFFFF - ((color->alpha << 8) + color->alpha);
+	col.alpha = (color->alpha << 8) + color->alpha;
 	XRenderFillRectangle(ctx->dpy, PictOpSrc, ctx->fill, &col, 0, 0, 1, 1);
 
 	len = wcslen(txt);

+ 2 - 0
examples/basic.c

@@ -84,10 +84,12 @@ static void setup_x()
 static void setup_dt()
 {
 	memset(&color, 0, sizeof(color));
+	color.alpha = 0xFF;
 	memset(&color_inv, 0, sizeof(color_inv));
 	color_inv.red = 0xFF;
 	color_inv.green = 0xFF;
 	color_inv.blue = 0xFF;
+	color_inv.alpha = 0xFF;
 }
 
 static void draw()