From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KLyy1-0003Ro-5B for qemu-devel@nongnu.org; Thu, 24 Jul 2008 07:26:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KLyy0-0003RQ-FD for qemu-devel@nongnu.org; Thu, 24 Jul 2008 07:26:40 -0400 Received: from [199.232.76.173] (port=55697 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KLyy0-0003RN-As for qemu-devel@nongnu.org; Thu, 24 Jul 2008 07:26:40 -0400 Received: from savannah.gnu.org ([199.232.41.3]:39240 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KLyy0-0003uk-2m for qemu-devel@nongnu.org; Thu, 24 Jul 2008 07:26:40 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KLyxz-0003S7-E3 for qemu-devel@nongnu.org; Thu, 24 Jul 2008 11:26:39 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KLyxz-0003S2-3m for qemu-devel@nongnu.org; Thu, 24 Jul 2008 11:26:39 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Thu, 24 Jul 2008 11:26:39 +0000 Subject: [Qemu-devel] [4937] Fix 24 bit mode Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4937 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4937 Author: blueswir1 Date: 2008-07-24 11:26:38 +0000 (Thu, 24 Jul 2008) Log Message: ----------- Fix 24 bit mode Modified Paths: -------------- trunk/hw/tcx.c Modified: trunk/hw/tcx.c =================================================================== --- trunk/hw/tcx.c 2008-07-24 11:25:30 UTC (rev 4936) +++ trunk/hw/tcx.c 2008-07-24 11:26:38 UTC (rev 4937) @@ -124,19 +124,34 @@ } } +/* + XXX Could be much more optimal: + * detect if line/page/whole screen is in 24 bit mode + * if destination is also BGR, use memcpy + */ static inline void tcx24_draw_line32(TCXState *s1, uint8_t *d, const uint8_t *s, int width, const uint32_t *cplane, const uint32_t *s24) { - int x; - uint8_t val; + int x, bgr, r, g, b; + uint8_t val, *p8; uint32_t *p = (uint32_t *)d; uint32_t dval; + bgr = s1->ds->bgr; for(x = 0; x < width; x++, s++, s24++) { - if ((bswap32(*cplane++) & 0xff000000) == 0x03000000) { // 24-bit direct - dval = bswap32(*s24) & 0x00ffffff; + if ((be32_to_cpu(*cplane++) & 0xff000000) == 0x03000000) { + // 24-bit direct, BGR order + p8 = (uint8_t *)s24; + p8++; + b = *p8++; + g = *p8++; + r = *p8++; + if (bgr) + dval = rgb_to_pixel32bgr(r, g, b); + else + dval = rgb_to_pixel32(r, g, b); } else { val = *s; dval = s1->palette[val];