~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/text/gimptext-bitmap.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * GimpText
39
39
 
40
40
void
41
41
gimp_text_render_bitmap (PangoFont  *font,
42
 
                         PangoGlyph  glyph,
43
 
                         FT_Int32    flags,
44
 
                         FT_Matrix  *trafo,
45
 
                         gint        x,
46
 
                         gint        y,
47
 
                         FT_Bitmap  *bitmap)
 
42
                         PangoGlyph  glyph,
 
43
                         FT_Int32    flags,
 
44
                         FT_Matrix  *trafo,
 
45
                         gint        x,
 
46
                         gint        y,
 
47
                         FT_Bitmap  *bitmap)
48
48
{
49
49
  FT_Face       face;
50
50
  gint          y_start, y_limit, x_start, x_limit;
58
58
 
59
59
  FT_Load_Glyph (face, (FT_UInt) glyph, flags);
60
60
  FT_Render_Glyph (face->glyph,
61
 
                   (flags & FT_LOAD_TARGET_MONO ?
62
 
                    ft_render_mode_mono : ft_render_mode_normal));
 
61
                   (flags & FT_LOAD_TARGET_MONO ?
 
62
                    ft_render_mode_mono : ft_render_mode_normal));
63
63
 
64
64
  x = PANGO_PIXELS (x);
65
65
  y = PANGO_PIXELS (y);
66
66
 
67
67
  x_start = MAX (0, - (x + face->glyph->bitmap_left));
68
68
  x_limit = MIN (face->glyph->bitmap.width,
69
 
                 bitmap->width - (x + face->glyph->bitmap_left));
 
69
                 bitmap->width - (x + face->glyph->bitmap_left));
70
70
 
71
71
  y_start = MAX (0,  - (y - face->glyph->bitmap_top));
72
72
  y_limit = MIN (face->glyph->bitmap.rows,
73
 
                 bitmap->rows - (y - face->glyph->bitmap_top));
 
73
                 bitmap->rows - (y - face->glyph->bitmap_top));
74
74
 
75
75
  src = face->glyph->bitmap.buffer + y_start * face->glyph->bitmap.pitch;
76
76
 
83
83
    case ft_pixel_mode_grays:
84
84
      src += x_start;
85
85
      for (iy = y_start; iy < y_limit; iy++)
86
 
        {
87
 
          const guchar *s = src;
88
 
          guchar       *d = dest;
89
 
 
90
 
          for (ix = x_start; ix < x_limit; ix++)
91
 
            {
92
 
              switch (*s)
93
 
                {
94
 
                case 0:
95
 
                  break;
96
 
                case 0xff:
97
 
                  *d = 0xff;
98
 
                default:
99
 
                  *d = MIN ((gushort) *d + (const gushort) *s, 0xff);
100
 
                  break;
101
 
                }
102
 
 
103
 
              s++;
104
 
              d++;
105
 
            }
106
 
 
107
 
          dest += bitmap->pitch;
108
 
          src  += face->glyph->bitmap.pitch;
109
 
        }
 
86
        {
 
87
          const guchar *s = src;
 
88
          guchar       *d = dest;
 
89
 
 
90
          for (ix = x_start; ix < x_limit; ix++)
 
91
            {
 
92
              switch (*s)
 
93
                {
 
94
                case 0:
 
95
                  break;
 
96
                case 0xff:
 
97
                  *d = 0xff;
 
98
                default:
 
99
                  *d = MIN ((gushort) *d + (const gushort) *s, 0xff);
 
100
                  break;
 
101
                }
 
102
 
 
103
              s++;
 
104
              d++;
 
105
            }
 
106
 
 
107
          dest += bitmap->pitch;
 
108
          src  += face->glyph->bitmap.pitch;
 
109
        }
110
110
      break;
111
111
 
112
112
    case ft_pixel_mode_mono:
113
113
      src += x_start / 8;
114
114
      for (iy = y_start; iy < y_limit; iy++)
115
 
        {
116
 
          const guchar *s = src;
117
 
          guchar       *d = dest;
118
 
 
119
 
          for (ix = x_start; ix < x_limit; ix++)
120
 
            {
121
 
              if ((*s) & (1 << (7 - (ix % 8))))
122
 
                *d |= 0xff;
123
 
 
124
 
              if ((ix % 8) == 7)
125
 
                s++;
126
 
              d++;
127
 
            }
128
 
 
129
 
          dest += bitmap->pitch;
130
 
          src  += face->glyph->bitmap.pitch;
131
 
        }
 
115
        {
 
116
          const guchar *s = src;
 
117
          guchar       *d = dest;
 
118
 
 
119
          for (ix = x_start; ix < x_limit; ix++)
 
120
            {
 
121
              if ((*s) & (1 << (7 - (ix % 8))))
 
122
                *d |= 0xff;
 
123
 
 
124
              if ((ix % 8) == 7)
 
125
                s++;
 
126
              d++;
 
127
            }
 
128
 
 
129
          dest += bitmap->pitch;
 
130
          src  += face->glyph->bitmap.pitch;
 
131
        }
132
132
      break;
133
133
 
134
134
    default: