[AD] Another custom cursor question

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


While going through the code used by the other ports to set up the custom cursor, I came across this in the X11 port:

   for (iy = 0; iy < bmp_h; iy++) {
      for (ix = 0; ix < bmp_w; ix++) {
         ALLEGRO_COLOR col;
         unsigned char r, g, b, a;

         col = al_get_pixel(bmp, ix, iy);
         al_unmap_rgb(col, &r, &g, &b);
         a = 255;
         image->pixels[c++] = (a<<24) | (r<<16) | (g<<8) | (b);
      }
   }

The alpha cahnnel from the source bitmap is completely unused, which doesn't look right to me. Indeed, the Windows code has

         c = al_get_pixel(sprite, x, y);
         al_unmap_rgba(c, &r, &g, &b, &a);
         if (a != 0) {
	    /* Don't touch XOR value */
	    SetPixel(h_and_dc, x, y, 0);
	 }
	 else {
	    /* No need to touch AND value */
	    SetPixel(h_xor_dc, x, y, WINDOWS_RGB(0, 0, 0));
	 }

which does use the original bitmap's alpha channel and looks less fishy.
Is the X11 code above correct? If so, maybe a comment can be added as to why?

Evert




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/