equal
deleted
inserted
replaced
805 return 2; |
805 return 2; |
806 case M3G_RGB8: |
806 case M3G_RGB8: |
807 return 3; |
807 return 3; |
808 case M3G_RGBA8: |
808 case M3G_RGBA8: |
809 case M3G_BGRA8: |
809 case M3G_BGRA8: |
|
810 case M3G_ARGB8: |
810 case M3G_BGR8_32: |
811 case M3G_BGR8_32: |
811 case M3G_RGB8_32: |
812 case M3G_RGB8_32: |
812 return 4; |
813 return 4; |
813 default: |
814 default: |
814 M3G_ASSERT(M3G_FALSE); |
815 M3G_ASSERT(M3G_FALSE); |
839 M3Guint dstBpp = m3gBytesPerPixel(dstFormat); |
840 M3Guint dstBpp = m3gBytesPerPixel(dstFormat); |
840 M3G_ASSERT(srcBpp > 0 && dstBpp > 0); |
841 M3G_ASSERT(srcBpp > 0 && dstBpp > 0); |
841 |
842 |
842 while (count > 0) { |
843 while (count > 0) { |
843 M3Gsizei n = (count < SPAN_BUFFER_SIZE) ? count : SPAN_BUFFER_SIZE; |
844 M3Gsizei n = (count < SPAN_BUFFER_SIZE) ? count : SPAN_BUFFER_SIZE; |
844 convertToARGB(srcFormat, src, n, temp); |
845 if (srcFormat == M3G_ARGB8 && dstFormat != M3G_ARGB8) { |
845 convertFromARGB(temp, n, dstFormat, dst); |
846 convertFromARGB((M3Guint*)src, n, dstFormat, dst); |
|
847 } else if (srcFormat != M3G_ARGB8 && dstFormat == M3G_ARGB8) { |
|
848 convertToARGB(srcFormat, src, n, (M3Guint*)dst); |
|
849 } else { |
|
850 convertToARGB(srcFormat, src, n, temp); |
|
851 convertFromARGB(temp, n, dstFormat, dst); |
|
852 } |
846 count -= SPAN_BUFFER_SIZE; /* \note may go negative */ |
853 count -= SPAN_BUFFER_SIZE; /* \note may go negative */ |
847 src += n * srcBpp; |
854 src += n * srcBpp; |
848 dst += n * dstBpp; |
855 dst += n * dstBpp; |
849 } |
856 } |
850 } |
857 } |
1250 |
1257 |
1251 { |
1258 { |
1252 /* Allocate pixel & palette data; the palette is stored at |
1259 /* Allocate pixel & palette data; the palette is stored at |
1253 * the beginning of the pixel data chunk */ |
1260 * the beginning of the pixel data chunk */ |
1254 |
1261 |
1255 /* \ comment */ |
|
1256 M3Gbool paletted = ((img->flags & M3G_PALETTED) != 0) |
1262 M3Gbool paletted = ((img->flags & M3G_PALETTED) != 0) |
1257 && m3gSupportedPaletteFormat(srcFormat); |
1263 && m3gSupportedPaletteFormat(srcFormat); |
1258 M3GPixelFormat internalFormat = getInternalFormat(srcFormat, |
1264 M3GPixelFormat internalFormat = getInternalFormat(srcFormat, |
1259 paletted); |
1265 paletted); |
1260 M3Guint bpp = m3gBytesPerPixel(internalFormat); |
1266 M3Guint bpp = m3gBytesPerPixel(internalFormat); |