From e007d5e04844dd6f69e8be233021550db1cd1898 Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 13 May 2004 15:07:36 +0000 Subject: [PATCH] Patch level :2.1 042 Files correlati :xvagadll.dll Ricompilazione Demo : [ ] Commento :corretta la get_ncolors scrivendo <256 e non <255 colori; senza questa correzione il 256-esimo colore della palette di una immagine veniva ignorata (e per pura sfiga, nel logo one-red, era il bianco!) git-svn-id: svn://10.65.10.50/trunk@12073 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/xvaga.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index b095ebdc3..3febf774d 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -2822,7 +2822,6 @@ void xvt_image_destroy(XVT_IMAGE image) COLOR xvt_image_get_clut(XVT_IMAGE image, short index) { XVT_ASSERT(image != NULL); -#if wxCHECK_VERSION(2,3,0) if (image) { const wxImage& bmp = ((const TXVT_IMAGE*)image)->Image(); @@ -2834,7 +2833,6 @@ COLOR xvt_image_get_clut(XVT_IMAGE image, short index) return MAKE_COLOR(r, g, b); } } -#endif return COLOR_BLACK; } @@ -2856,17 +2854,12 @@ void xvt_image_get_dimensions(XVT_IMAGE image, short *width, short *height) XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image) { -#if wxCHECK_VERSION(2,3,0) const wxImage& img = ((const TXVT_IMAGE*)image)->Image(); return img.HasPalette() ? XVT_IMAGE_CL8 : XVT_IMAGE_RGB; -#else - return XVT_IMAGE_RGB; -#endif } short xvt_image_get_ncolors(XVT_IMAGE image) { -#if wxCHECK_VERSION(2,3,0) int n = 0; if (image) { @@ -2875,7 +2868,7 @@ short xvt_image_get_ncolors(XVT_IMAGE image) { const wxPalette& pal = bmp.GetPalette(); unsigned char r, g, b; - for (n = 16; n < 255; n++) + for (n = 16; n < 256; n++) { if (!pal.GetRGB(n, &r, &g, &b)) break; @@ -2883,15 +2876,6 @@ short xvt_image_get_ncolors(XVT_IMAGE image) } } return n; -#else - int n = 0; - if (image) - { - wxImage& bmp = ((TXVT_IMAGE*)image)->Image(); - n = bmp.CountColours(257); - } - return n > 256 ? 0 : n; -#endif } COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y) @@ -2941,7 +2925,6 @@ XVT_IMAGE xvt_image_read_bmp(const char *filenamep) void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color) { wxImage& bmp = ((TXVT_IMAGE*)image)->Image(); -#if wxCHECK_VERSION(2,3,0) if (bmp.HasPalette()) { const wxPalette& pal = bmp.GetPalette(); @@ -2962,7 +2945,6 @@ void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color) bmp.SetRGB(x, y, c.Red(), c.Green(), c.Blue()); } } -#endif } void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors)