/[freetype]/freetype2/src/base/ftbitmap.c
ViewVC logotype

Diff of /freetype2/src/base/ftbitmap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by freetype, Thu Feb 10 16:11:29 2005 UTC revision 1.4 by wl, Thu Feb 10 16:59:37 2005 UTC
# Line 63  Line 63 
63          FT_Int   pad;          FT_Int   pad;
64          FT_Long  old_size;          FT_Long  old_size;
65    
66    
67          old_size = target->rows * target->pitch;          old_size = target->rows * target->pitch;
68          if ( old_size < 0 )          if ( old_size < 0 )
69            old_size = -old_size;            old_size = -old_size;
# Line 81  Line 82 
82    
83          target->pitch = source->width + pad;          target->pitch = source->width + pad;
84    
85          if ( target->rows * target->pitch > old_size &&          if ( target->rows * target->pitch > old_size             &&
86               FT_QREALLOC( target->buffer,               FT_QREALLOC( target->buffer,
87                            old_size, target->rows * target->pitch ) )                            old_size, target->rows * target->pitch ) )
88            return error;            return error;
# Line 100  Line 101 
101          FT_Byte*  t = target->buffer;          FT_Byte*  t = target->buffer;
102          FT_Int    i;          FT_Int    i;
103    
104    
105          target->num_grays = 2;          target->num_grays = 2;
106    
107          for ( i = source->rows; i > 0; i-- )          for ( i = source->rows; i > 0; i-- )
# Line 108  Line 110 
110            FT_Byte*  tt = t;            FT_Byte*  tt = t;
111            FT_Int    j;            FT_Int    j;
112    
113    
114            /* get the full bytes */            /* get the full bytes */
115            for ( j = source->width >> 3; j > 0; j-- )            for ( j = source->width >> 3; j > 0; j-- )
116            {            {
117              FT_Int  val = ss[0]; /* avoid a byte->int cast on each line */              FT_Int  val = ss[0]; /* avoid a byte->int cast on each line */
118    
119    
120              tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );              tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );
121              tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );              tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );
122              tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );              tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );
# Line 132  Line 136 
136            {            {
137              FT_Int  val = *ss;              FT_Int  val = *ss;
138    
139    
140              for ( ; j > 0; j-- )              for ( ; j > 0; j-- )
141              {              {
142                tt[0] = (FT_Byte)(( val & 0x80 ) >> 7);                tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7);
143                val <<= 1;                val <<= 1;
144                tt   += 1;                tt   += 1;
145              }              }
# Line 156  Line 161 
161          FT_Int    t_pitch = target->pitch;          FT_Int    t_pitch = target->pitch;
162          FT_Int    i;          FT_Int    i;
163    
164    
165          target->num_grays = 256;          target->num_grays = 256;
166    
167          for ( i = source->rows; i > 0; i-- )          for ( i = source->rows; i > 0; i-- )
# Line 175  Line 181 
181          FT_Byte*  t = target->buffer;          FT_Byte*  t = target->buffer;
182          FT_Int    i;          FT_Int    i;
183    
184    
185          target->num_grays = 4;          target->num_grays = 4;
186    
187          for ( i = source->rows; i > 0; i-- )          for ( i = source->rows; i > 0; i-- )
# Line 183  Line 190 
190            FT_Byte*  tt = t;            FT_Byte*  tt = t;
191            FT_Int    j;            FT_Int    j;
192    
193    
194            /* get the full bytes */            /* get the full bytes */
195            for ( j = source->width >> 2; j > 0; j-- )            for ( j = source->width >> 2; j > 0; j-- )
196            {            {
197              FT_Int  val = ss[0];              FT_Int  val = ss[0];
198    
199              tt[0] = (FT_Byte)( (val & 0xC0) >> 6 );  
200              tt[1] = (FT_Byte)( (val & 0x30) >> 4 );              tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 );
201              tt[2] = (FT_Byte)( (val & 0x0C) >> 2 );              tt[1] = (FT_Byte)( ( val & 0x30 ) >> 4 );
202              tt[3] = (FT_Byte)( (val & 0x03) );              tt[2] = (FT_Byte)( ( val & 0x0C ) >> 2 );
203                tt[3] = (FT_Byte)( ( val & 0x03 ) );
204    
205              ss += 1;              ss += 1;
206              tt += 4;              tt += 4;
# Line 202  Line 211 
211            {            {
212              FT_Int  val = ss[0];              FT_Int  val = ss[0];
213    
214    
215              for ( ; j > 0; j-- )              for ( ; j > 0; j-- )
216              {              {
217                tt[0]  = (FT_Byte)( ( val & 0xC0 ) >> 6 );                tt[0]  = (FT_Byte)( ( val & 0xC0 ) >> 6 );
# Line 223  Line 233 
233          FT_Byte*  t = target->buffer;          FT_Byte*  t = target->buffer;
234          FT_Int    i;          FT_Int    i;
235    
236    
237          target->num_grays = 16;          target->num_grays = 16;
238    
239          for ( i = source->rows; i > 0; i-- )          for ( i = source->rows; i > 0; i-- )
# Line 231  Line 242 
242            FT_Byte*  tt = t;            FT_Byte*  tt = t;
243            FT_Int    j;            FT_Int    j;
244    
245    
246            /* get the full bytes */            /* get the full bytes */
247            for ( j = source->width >> 1; j > 0; j-- )            for ( j = source->width >> 1; j > 0; j-- )
248            {            {
249              FT_Int  val = ss[0];              FT_Int  val = ss[0];
250    
251              tt[0] = (FT_Byte)( (val & 0xF0) >> 4 );  
252              tt[1] = (FT_Byte)( (val & 0x0F) );              tt[0] = (FT_Byte)( ( val & 0xF0 ) >> 4 );
253                tt[1] = (FT_Byte)( ( val & 0x0F ) );
254    
255              ss += 1;              ss += 1;
256              tt += 2;              tt += 2;
# Line 252  Line 265 
265        }        }
266        break;        break;
267    
268    
269      default:      default:
270        ;        ;
271      }      }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26