]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/include/fbmpop16.h
Virtual Jaguar GCC/SDL v1.0.3 import.
[virtualjaguar] / src / include / fbmpop16.h
index 2564ccbb5a0279559046e3ee76e6b5691c14f653..4b205937ac01b4e96ac09ff56945e9b9193418cc 100644 (file)
-               if (flags&FLAGS_READMODIFY)
+               if (flags & FLAGS_READMODIFY)
                {
-                       if (flags&FLAGS_HFLIP)
+                       if (flags & FLAGS_HFLIP)
                        {
                                while (iwidth)
                                {
-                                       if (flags&FLAGS_TRANSPARENT)
+                                       uint8 dataHi = jaguar_byte_read(ptr++), dataLo = jaguar_byte_read(ptr++);
+
+                                       if (flags & FLAGS_TRANSPARENT)
                                        {                                       
-                                               uint16 data=jaguar_byte_read(ptr++);
-                                               data<<=8;
-                                               data|=jaguar_byte_read(ptr++);
-                                               if (data)
+//                                             uint16 data = jaguar_byte_read(ptr++);
+//                                             data <<= 8;
+//                                             data |= jaguar_byte_read(ptr++);
+/*                                             if (data)
+                                               {
+                                                       *current_line_buffer-- = BLEND_Y(*current_line_buffer, data >> 8);
+                                                       *current_line_buffer-- = BLEND_CC(*current_line_buffer, data & 0xFF);
+                                               }*/
+                                               if (dataHi | dataLo)
                                                {
-                                                       *current_line_buffer--=BLEND_Y(*current_line_buffer,(data>>8));
-                                                       *current_line_buffer--=BLEND_CC(*current_line_buffer,(data&0xff));
+                                                       *current_line_buffer-- = BLEND_Y(*current_line_buffer, dataHi);
+                                                       *current_line_buffer-- = BLEND_CC(*current_line_buffer, dataLo);
                                                }
                                                else
-                                                       current_line_buffer-=2;
+                                                       current_line_buffer -= 2;
                                        }
-                                       else
+                                       else    // !FLAGS_TRANSPARENT
                                        {
-                                               *current_line_buffer--=BLEND_Y(*current_line_buffer,jaguar_byte_read(ptr++));
-                                               *current_line_buffer--=BLEND_CC(*current_line_buffer,jaguar_byte_read(ptr++));
+//                                             *current_line_buffer-- = BLEND_Y(*current_line_buffer, jaguar_byte_read(ptr++));
+//                                             *current_line_buffer-- = BLEND_CC(*current_line_buffer, jaguar_byte_read(ptr++));
+                                               *current_line_buffer-- = BLEND_Y(*current_line_buffer, dataHi);
+                                               *current_line_buffer-- = BLEND_CC(*current_line_buffer, dataLo);
                                        }
                                        iwidth--;
                                }
                        }
-                       else
+                       else    // !FLAGS_HFLIP
                        {
                                while (iwidth)
                                {
-                                       if (flags&FLAGS_TRANSPARENT)
+                                       uint8 dataHi = jaguar_byte_read(ptr++), dataLo = jaguar_byte_read(ptr++);
+
+                                       if (flags & FLAGS_TRANSPARENT)
                                        {                                       
-                                               uint16 data=jaguar_byte_read(ptr++);
-                                               data<<=8;
-                                               data|=jaguar_byte_read(ptr++);
+/*                                             uint16 data = jaguar_byte_read(ptr++);
+                                               data <<= 8;
+                                               data |= jaguar_byte_read(ptr++);
                                                if (data)
                                                {
-                                                       *current_line_buffer++=BLEND_Y(*current_line_buffer,(data>>8));
-                                                       *current_line_buffer++=BLEND_CC(*current_line_buffer,(data&0xff));
+                                                       *current_line_buffer++ = BLEND_Y(*current_line_buffer, data >> 8);
+                                                       *current_line_buffer++ = BLEND_CC(*current_line_buffer, data & 0xFF);
+                                               }*/
+                                               if (dataHi | dataLo)
+                                               {
+                                                       *current_line_buffer++ = BLEND_Y(*current_line_buffer, dataHi);
+                                                       *current_line_buffer++ = BLEND_CC(*current_line_buffer, dataLo);
                                                }
                                                else
-                                                       current_line_buffer+=2;
+                                                       current_line_buffer += 2;
                                        }
                                        else
                                        {
-                                               *current_line_buffer++=BLEND_Y(*current_line_buffer,jaguar_byte_read(ptr++));
-                                               *current_line_buffer++=BLEND_CC(*current_line_buffer,jaguar_byte_read(ptr++));
+//                                             *current_line_buffer++ = BLEND_Y(*current_line_buffer, jaguar_byte_read(ptr++));
+//                                             *current_line_buffer++ = BLEND_CC(*current_line_buffer, jaguar_byte_read(ptr++));
+                                               *current_line_buffer++ = BLEND_Y(*current_line_buffer, dataHi);
+                                               *current_line_buffer++ = BLEND_CC(*current_line_buffer, dataLo);
                                        }
                                        iwidth--;
                                }
                        }
                }
-               else
+               else    // !FLAGS_READMODIFY
                {
-                       if (flags&FLAGS_HFLIP)
+                       if (flags & FLAGS_HFLIP)
                        {
                                while (iwidth)
                                {
-                                       if (flags&FLAGS_TRANSPARENT)
+                                       uint8 dataHi = jaguar_byte_read(ptr++), dataLo = jaguar_byte_read(ptr++);
+
+                                       if (flags & FLAGS_TRANSPARENT)
                                        {                                       
-                                               uint16 data=jaguar_byte_read(ptr++);
-                                               data<<=8;
-                                               data|=jaguar_byte_read(ptr++);
+/*                                             uint16 data = jaguar_byte_read(ptr++);
+                                               data <<= 8;
+                                               data |= jaguar_byte_read(ptr++);
                                                if (data)
                                                {
-                                                       *current_line_buffer--=(data>>8);
-                                                       *current_line_buffer--=(data&0xff);
-                                               }
+                                                       *current_line_buffer-- = data >> 8;
+                                                       *current_line_buffer-- = data & 0xFF;
+                                               }*/
+                                               if (dataHi | dataLo)
+                                                       *current_line_buffer-- = dataHi,
+                                                       *current_line_buffer-- = dataLo;
                                                else
-                                                       current_line_buffer-=2;
+                                                       current_line_buffer -= 2;
                                        }
                                        else
                                        {
-                                               *current_line_buffer--=jaguar_byte_read(ptr++);
-                                               *current_line_buffer--=jaguar_byte_read(ptr++);
+//                                             *current_line_buffer-- = jaguar_byte_read(ptr++);
+//                                             *current_line_buffer-- = jaguar_byte_read(ptr++);
+                                               *current_line_buffer-- = dataHi;
+                                               *current_line_buffer-- = dataLo;
                                        }
                                        iwidth--;
                                }
                        }
-                       else
+                       else            // !FLAGS_HFLIP
                        {
-                               int count=0;
+                               int count = 0;
 
                                while (iwidth)
                                {
-                                       if (flags&FLAGS_TRANSPARENT)
-                                       {                                       
-                                               uint16 data=jaguar_byte_read(ptr++);
-                                               data<<=8;
-                                               data|=jaguar_byte_read(ptr++);
+                                       uint8 dataHi = jaguar_byte_read(ptr++), dataLo = jaguar_byte_read(ptr++);
+
+                                       if (flags & FLAGS_TRANSPARENT)
+                                       {
+/*                                             uint16 data = jaguar_byte_read(ptr++);
+                                               data <<= 8;
+                                               data |= jaguar_byte_read(ptr++);
                                                if (data)
                                                {
-                                                       *current_line_buffer++=(data>>8);
-                                                       *current_line_buffer++=(data&0xff);
-                                               }
+                                                       *current_line_buffer++ = data >> 8;
+                                                       *current_line_buffer++ = data & 0xFF;
+                                               }*/
+                                               if (dataHi | dataLo)
+                                                       *current_line_buffer++ = dataHi,
+                                                       *current_line_buffer++ = dataLo;
                                                else
-                                                       current_line_buffer+=2;
+                                                       current_line_buffer += 2;
                                        }
                                        else
                                        {
-                                               *current_line_buffer++=jaguar_byte_read(ptr++);
-                                               *current_line_buffer++=jaguar_byte_read(ptr++);
+//                                             *current_line_buffer++ = jaguar_byte_read(ptr++);
+//                                             *current_line_buffer++ = jaguar_byte_read(ptr++);
+                                               *current_line_buffer++ = dataHi;
+                                               *current_line_buffer++ = dataLo;
                                        }                               
-                                       count+=2;
-                                       if (count==8) // 8 bytes = a phrase (64 bits)
+                                       count += 2;
+                                       if (count == 8) // 8 bytes = a phrase (64 bits)
                                        {
-                                               ptr+=8*(pitch-1);
-                                               count=0;
+                                               ptr += 8 * (pitch - 1);
+                                               count = 0;
                                        }
                                        iwidth--;
                                }