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; |
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; |
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-- ) |
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 ); |
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 |
} |
} |
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-- ) |
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-- ) |
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; |
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 ); |
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-- ) |
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; |
265 |
} |
} |
266 |
break; |
break; |
267 |
|
|
268 |
|
|
269 |
default: |
default: |
270 |
; |
; |
271 |
} |
} |