m3g/m3gcore11/src/m3g_image.c
branchRCL_3
changeset 1 fed1595b188e
parent 0 5d03bc08d59c
child 4 15986eb6c500
--- a/m3g/m3gcore11/src/m3g_image.c	Tue Feb 02 01:47:50 2010 +0200
+++ b/m3g/m3gcore11/src/m3g_image.c	Sat Feb 20 00:07:50 2010 +0200
@@ -807,6 +807,7 @@
         return 3;
     case M3G_RGBA8:
     case M3G_BGRA8:
+    case M3G_ARGB8:
     case M3G_BGR8_32:
     case M3G_RGB8_32:
         return 4;
@@ -841,8 +842,14 @@
 
     while (count > 0) {
         M3Gsizei n = (count < SPAN_BUFFER_SIZE) ? count : SPAN_BUFFER_SIZE;
-        convertToARGB(srcFormat, src, n, temp);
-        convertFromARGB(temp, n, dstFormat, dst);
+        if (srcFormat == M3G_ARGB8 && dstFormat != M3G_ARGB8) {
+            convertFromARGB((M3Guint*)src, n, dstFormat, dst);
+        } else if (srcFormat != M3G_ARGB8 && dstFormat == M3G_ARGB8) {
+            convertToARGB(srcFormat, src, n, (M3Guint*)dst);
+        } else {
+            convertToARGB(srcFormat, src, n, temp);
+            convertFromARGB(temp, n, dstFormat, dst);
+        }
         count -= SPAN_BUFFER_SIZE; /* \note may go negative */
         src += n * srcBpp;
         dst += n * dstBpp;
@@ -1252,7 +1259,6 @@
             /* Allocate pixel & palette data; the palette is stored at
              * the beginning of the pixel data chunk */
 
-            /* \ comment */
             M3Gbool paletted = ((img->flags & M3G_PALETTED) != 0)
                 && m3gSupportedPaletteFormat(srcFormat);
             M3GPixelFormat internalFormat = getInternalFormat(srcFormat,