Author: gonzalo
Date: 2006-05-17 21:23:12 -0400 (Wed, 17 May 2006)
New Revision: 60810

Modified:
   trunk/libgdiplus/src/ChangeLog
   trunk/libgdiplus/src/bitmap.c
Log:
2006-05-17 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * bitmap.c: speed up the 8bppIndexed -> 32bpp conversion.



Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog      2006-05-17 21:58:37 UTC (rev 60809)
+++ trunk/libgdiplus/src/ChangeLog      2006-05-18 01:23:12 UTC (rev 60810)
@@ -1,3 +1,7 @@
+2006-05-17 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * bitmap.c: speed up the 8bppIndexed -> 32bpp conversion.
+
 2006-05-17  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * gdip.h: Added GpDashCap dash_cap to GpPen. It's not used (visually)

Modified: trunk/libgdiplus/src/bitmap.c
===================================================================
--- trunk/libgdiplus/src/bitmap.c       2006-05-17 21:58:37 UTC (rev 60809)
+++ trunk/libgdiplus/src/bitmap.c       2006-05-18 01:23:12 UTC (rev 60810)
@@ -2141,14 +2141,14 @@
        int             one_pixel_mask;
        int             one_pixel_shift;
        int             pixels_per_byte;
-       int             *rgb_scan0;
+       ARGB            *rgb_scan0;
        int             p;
        int             x;
        int             y;
        GpBitmap        *ret;
        GpStatus        status;
        unsigned char   *indexed_scan;
-       int             *rgb_scan;
+       ARGB            *rgb_scan;
        int             pixels_this_byte;
        unsigned short  sample;
        int             index;
@@ -2182,7 +2182,7 @@
                force_alpha = 0;
        }
 
-       rgb_stride = data->width * 4;
+       rgb_stride = data->width * sizeof (ARGB);
 
        /* ensure pixman_bits_t alignment */
        rgb_stride += (sizeof(pixman_bits_t)-1);
@@ -2200,8 +2200,17 @@
        /* convert the indexed pixels into RGB values and store them into the 
RGB frame */
        for (y=0; y < data->height; y++) {
                indexed_scan = (unsigned char *)(data->scan0) + y * 
data->stride;
-               rgb_scan = rgb_scan0 + (y * rgb_stride) / sizeof(int);
+               rgb_scan = rgb_scan0 + (y * data->width);
+               /* Speed up the 8bpp case */
+               if (pixels_per_byte == 1) {
+                       for (x = 0; x < data->width; x++) {
+                               index = *indexed_scan++;
+                               rgb_scan [x] = palette->Entries [index] | 
force_alpha;
+                       }
+                       continue;
+               }
 
+               /* For 4bpp and 1bpp */
                for (x=0; x < data->width; x += pixels_per_byte) {
                        pixels_this_byte = pixels_per_byte;
                        sample = *indexed_scan;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to