On Thu, Jun 03, 2010 at 03:00:57PM +0200, Daniel Nyström wrote:
> This:
> 
> > GrDrawImageToFit(GrNewPixmap(640, 480, NULL),
> >                  myGC, 0, 0, 640, 480,
> >                  GrLoadImageFromFile("/path/to/png_with_alpha_channel.png", 
> > 0));
> 
> fails with the following error:
> 
> > nano-X: /path/to/microwin/src/drivers/fblin24.c: 35: linear24_drawpixel: 
> > Assertion `c < psd->ncolors' failed.
> 
> The function is defined like this:
> 
> > /* Set pixel at x, y, to pixelval c*/
> > static void linear24_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
> 
> and the assertion looks like:
> 
> >    assert (c < psd->ncolors);
> 
> It seems like the PNG buffer is read as 32 bit values, but the
> function quickly thereafter turn the pixelval into r, g and b:
> 
> >     r = PIXEL888RED(c);
> >     g = PIXEL888GREEN(c);
> >     b = PIXEL888BLUE(c);
> 
> And the pure 'c' is never used again. How about just remove that
> assertion? What would then fail? What would else be a way to get
> fblin24 handle png's with alpha chan?

the assertion is incorrect for non-palettized video modes.  I would just
remove the asserts, or change it to

        assert(psd->pixtype != MWPF_PALETTE || c < psd->ncolors)

-- 
  Aaron J. Grier | "Not your ordinary poofy goof." | agr...@poofygoof.com

---------------------------------------------------------------------
To unsubscribe, e-mail: nanogui-unsubscr...@linuxhacker.org
For additional commands, e-mail: nanogui-h...@linuxhacker.org

Reply via email to