diff options
author | Raph Levien <raph@src.gnome.org> | 1998-09-11 00:11:05 +0000 |
---|---|---|
committer | Raph Levien <raph@src.gnome.org> | 1998-09-11 00:11:05 +0000 |
commit | 6d13f0f9b336986ca246ae469a59aeb04853b31d (patch) | |
tree | f0bea284f914e40f8b05ff7b43149263250481f8 /gdk/gdkrgb.c | |
parent | 683cb5753ebcf57b9f3218798fa13237e8f52a5a (diff) | |
download | gdk-pixbuf-6d13f0f9b336986ca246ae469a59aeb04853b31d.tar.gz |
Checking in minor changes. Now synced with 0.9.0.GTK_1_1_2
Diffstat (limited to 'gdk/gdkrgb.c')
-rw-r--r-- | gdk/gdkrgb.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c index e91e4c514..46653b6ea 100644 --- a/gdk/gdkrgb.c +++ b/gdk/gdkrgb.c @@ -649,7 +649,13 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb) { gulong pixel; - if (image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR) + if (image_info->bitmap) + { + return ((rgb & 0xff0000) >> 16) + + ((rgb & 0xff00) >> 7) + + (rgb & 0xff) > 510; + } + else if (image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR) pixel = colorcube[((rgb & 0xf00000) >> 12) | ((rgb & 0xf000) >> 8) | ((rgb & 0xf0) >> 4)]; @@ -660,7 +666,8 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb) ((rgb & 0x8000) >> 12) | ((rgb & 0x80) >> 7)]; } - else + else if (image_info->visual->type == GDK_VISUAL_TRUE_COLOR || + image_info->visual->type == GDK_VISUAL_DIRECT_COLOR) { #ifdef VERBOSE g_print ("shift, prec: r %d %d g %d %d b %d %d\n", @@ -682,6 +689,15 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb) (8 - image_info->visual->blue_prec)) << image_info->visual->blue_shift)); } + else if (image_info->visual->type == GDK_VISUAL_STATIC_GRAY || + image_info->visual->type == GDK_VISUAL_GRAYSCALE) + { + int gray = ((rgb & 0xff0000) >> 16) + + ((rgb & 0xff00) >> 7) + + (rgb & 0xff); + + return gray >> (10 - image_info->visual->depth); + } return pixel; } @@ -2266,6 +2282,14 @@ gdk_rgb_convert_gray4_pack (GdkImage *image, obptr[0] = (pix0 << 4) | pix1; obptr++; } + if (width & 1) + { + r = *bp2++; + g = *bp2++; + b = *bp2++; + pix0 = (g + ((b + r) >> 1)) >> shift; + obptr[0] = (pix0 << 4); + } bptr += rowstride; obuf += bpl; } @@ -2356,6 +2380,16 @@ gdk_rgb_convert_gray4_d_pack (GdkImage *image, obptr[0] = (pix0 << 4) | pix1; obptr++; } + if (width & 1) + { + r = *bp2++; + g = *bp2++; + b = *bp2++; + gray = (g + ((b + r) >> 1)) >> 1; + gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec; + pix0 = (gray - (gray >> prec)) >> right; + obptr[0] = (pix0 << 4); + } bptr += rowstride; obuf += bpl; } |