Re: [AD] small bug in 15 and 16 bit asm color converters

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


Hm, this patch is better.

-- 
Elias Pschernig
Index: src/misc/icolconv.s
===================================================================
RCS file: /cvsroot/alleg/allegro/src/misc/icolconv.s,v
retrieving revision 1.27
diff -u -p -r1.27 icolconv.s
--- src/misc/icolconv.s	27 Jul 2004 08:07:45 -0000	1.27
+++ src/misc/icolconv.s	23 Oct 2004 12:25:42 -0000
@@ -79,9 +79,12 @@
       movl %ecx, %ebp
 
 
-#define INIT_CONVERSION_2(mask_red, mask_green, mask_blue)                           \
+#define INIT_CONVERSION_2(mask_red, mask_green, mask_blue, diff_24bit)               \
       /* init register values */                                                   ; \
                                                                                    ; \
+      movl diff_24bit, %esi                                                        ; \
+      movd %esi, %mm6                                                              ; \
+      punpckldq %mm6, %mm6                                                         ; \
       movl mask_green, %esi                                                        ; \
       movd %esi, %mm3                                                              ; \
       punpckldq %mm3, %mm3                                                         ; \
@@ -566,7 +569,7 @@ FUNC (_colorconv_blit_15_to_32)
    pushl %esi
    pushl %edi
 
-   INIT_CONVERSION_2 ($0x7c00, $0x03e0, $0x001f);
+   INIT_CONVERSION_2 ($0x7c00, $0x03e0, $0x001f, $0x00070707);
 
    /* 15 bit to 32 bit conversion:
     we have:    
@@ -602,6 +605,7 @@ FUNC (_colorconv_blit_15_to_32)
          PAND (4, 2)        /* pand %mm4, %mm2 */
          pslld $9, %mm2
          por %mm2, %mm0
+         por %mm6, %mm0
          movq %mm0, (%edi)
          addl $8, %edi
 
@@ -627,6 +631,7 @@ FUNC (_colorconv_blit_15_to_32)
          PAND (4, 2)        /* pand %mm4, %mm2 */
          pslld $9, %mm2
          por %mm2, %mm0
+         por %mm6, %mm0
          movd %mm0, (%edi)
          addl $4, %edi
 
@@ -814,7 +819,7 @@ FUNC (_colorconv_blit_16_to_32)
    pushl %esi
    pushl %edi
 
-   INIT_CONVERSION_2 ($0xf800, $0x07e0, $0x001f);
+   INIT_CONVERSION_2 ($0xf800, $0x07e0, $0x001f, $0x00070307);
 
    /* 16 bit to 32 bit conversion:
     we have:
@@ -850,6 +855,7 @@ FUNC (_colorconv_blit_16_to_32)
          PAND (4, 2)        /* pand %mm4, %mm2 */
          pslld $8, %mm2
          por %mm2, %mm0
+         por %mm6, %mm0
          movq %mm0, (%edi)
          addl $8, %edi
 
@@ -875,6 +881,7 @@ FUNC (_colorconv_blit_16_to_32)
          PAND (4, 2)        /* pand %mm4, %mm2 */
          pslld $8, %mm2
          por %mm2, %mm0
+         por %mm6, %mm0
          movd %mm0, (%edi)
          addl $4, %edi
 


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