Author: gonzalo
Date: 2006-05-18 17:21:36 -0400 (Thu, 18 May 2006)
New Revision: 60839
Modified:
trunk/libgdiplus/src/bitmap.c
Log:
2006-05-18 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* bitmap.c: pixels_per_byte will be set to -3 in the default case now.
Don't read an uint32 for 24bpp streams.
Modified: trunk/libgdiplus/src/bitmap.c
===================================================================
--- trunk/libgdiplus/src/bitmap.c 2006-05-18 21:01:55 UTC (rev 60838)
+++ trunk/libgdiplus/src/bitmap.c 2006-05-18 21:21:36 UTC (rev 60839)
@@ -1341,12 +1341,6 @@
case Format1bppIndexed: state->one_pixel_mask = 0x01;
state->one_pixel_shift = 1; state->pixels_per_byte = 8; break;
case Format4bppIndexed: state->one_pixel_mask = 0x0F;
state->one_pixel_shift = 4; state->pixels_per_byte = 2; break;
case Format8bppIndexed: state->one_pixel_mask = 0xFF;
state->one_pixel_shift = 8; state->pixels_per_byte = 1; break;
- case Format24bppRgb: { /* gdip_get_pixel_format_bpp lies
because other code depends on Format24bppRgb being CAIRO_FORMAT_ARGB32
internally */
- // FIXME: fix comment;
- state->pixels_per_byte = -3;
- break;
- }
-
default: {
/* indicate full RGB processing */
state->pixels_per_byte = -gdip_get_pixel_format_bpp
(data->pixel_format) / 8;
@@ -1465,17 +1459,14 @@
*
* Note that pixel streams do not support 48- and 64-bit data
at this time.
*/
- ret = *(unsigned int *)state->scan;
- /* Special case: 24-bit data needs to have the cairo format
alpha component forced
- * to 0xFF, or many operations will do nothing (or do strange
things if the alpha
- * channel contains garbage).
- */
- if (state->data->pixel_format == Format24bppRgb) {
- int force_alpha;
- set_pixel_bgra(&force_alpha, 0,
- 0, 0, 0, 0xFF);
- ret |= force_alpha;
+ if (state->pixels_per_byte == -4) {
+ ret = *(unsigned int *)state->scan;
+ } else {
+ ret = 0xFF000000; /* Force alpha for 24bpp */
+ ret += state->scan [0];
+ ret += state->scan [1] << 8;
+ ret += state->scan [2] << 16;
}
state->scan -= state->pixels_per_byte;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches