From kde-core-devel Wed Sep 06 18:12:06 2000 From: Geert Jansen Date: Wed, 06 Sep 2000 18:12:06 +0000 To: kde-core-devel Subject: Fwd: Patch for kpixmapio.cpp X-MARC-Message: https://marc.info/?l=kde-core-devel&m=96826854310784 Hi, this patch fixes a problem with 555 bit packing in KPixmapIO. The patch is correct. If nobody objects, I will apply it tonight. Greetings, Geert ---------- Forwarded Message ---------- Subject: Patch for kpixmapio.cpp Date: Wed, 6 Sep 2000 11:33:49 +0000 From: Josef Weidendorfer To: Geert Jansen Hello, can you forward the following patch for reviewing to kde-core-devel or review it yourself and commit ? I have a RIVA 128 (NVIDEA) Chip and Konsole Transparency was not working with 16Bit-Depth. 2 Reasons: Wrong recognition of mode AND wrong bitshifting. The following fixes it. PS: I'm not sure KPixmapIO does the right thing in 16-Bit modes, as it simply truncates low bits of the color values and does no dithering. The resulting images look ugly, as one sees that one doesn't have truecolor ;-) Greetings, Josef --- kpixmapio.cpp.old Wed Sep 6 11:15:45 2000 +++ kpixmapio.cpp Wed Sep 6 11:20:11 2000 @@ -131,7 +131,7 @@ else if ((bpp == 17) && (red_shift == 11) && (green_shift == 5) && (blue_shift == 0)) d->byteorder = bo16_BGR_565; - else if ((bpp == 16) && (red_shift == 10) && (green_shift == 5) && + else if ((bpp == 17) && (red_shift == 10) && (green_shift == 5) && (blue_shift == 0)) d->byteorder = bo16_BGR_555; else if ((bpp == 8) || (bpp == 9)) @@ -566,10 +566,10 @@ for (x=0; x> 9) | ((pixel & 0xf800) >> 5) | + val = ((pixel & 0xf80000) >> 9) | ((pixel & 0xf800) >> 6) | ((pixel & 0xff) >> 3); pixel = *src++; - val |= (((pixel & 0xf80000) >> 9) | ((pixel & 0xf800) >> 5) | + val |= (((pixel & 0xf80000) >> 9) | ((pixel & 0xf800) >> 6) | ((pixel & 0xff) >> 3)) << 16; *dst++ = val; } @@ -577,7 +577,7 @@ { pixel = *src++; *((Q_INT16 *)dst) = ((pixel & 0xf80000) >> 9) | - ((pixel & 0xf800) >> 5) | ((pixel & 0xff) >> 3); + ((pixel & 0xf800) >> 6) | ((pixel & 0xff) >> 3); } } } else @@ -592,10 +592,10 @@ for (x=0; x> 9) | ((pixel & 0xf800) >> 5) | + val = ((pixel & 0xf80000) >> 9) | ((pixel & 0xf800) >> 6) | ((pixel & 0xff) >> 3); pixel = clut[*src++]; - val |= (((pixel & 0xf80000) >> 9) | ((pixel & 0xf800) >> 5) | + val |= (((pixel & 0xf80000) >> 9) | ((pixel & 0xf800) >> 6) | ((pixel & 0xff) >> 3)) << 16; *dst++ = val; } @@ -603,7 +603,7 @@ { pixel = clut[*src++]; *((Q_INT16 *)dst) = ((pixel & 0xf80000) >> 9) | - ((pixel & 0xf800) >> 5) | ((pixel & 0xff) >> 3); + ((pixel & 0xf800) >> 6) | ((pixel & 0xff) >> 3); } } } -- Josef Weidendorfer TUM: Josef.Weidendorfer@in.tum.de, 089/289-25357 BMW: Josef.Weidendorfer@bmw.de, 089/382-40787 -------------------------------------------------------