| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftbitmap.c */ | 3 /* ftbitmap.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* FreeType utility functions for bitmaps (body). */ | 5 /* FreeType utility functions for bitmaps (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 2004-2009, 2011, 2013, 2014 by */ | 7 /* Copyright 2004-2015 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
| 11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| 18 | 18 |
| 19 #include <ft2build.h> | 19 #include <ft2build.h> |
| 20 #include FT_INTERNAL_DEBUG_H | 20 #include FT_INTERNAL_DEBUG_H |
| 21 | 21 |
| 22 #include FT_BITMAP_H | 22 #include FT_BITMAP_H |
| 23 #include FT_IMAGE_H | 23 #include FT_IMAGE_H |
| 24 #include FT_INTERNAL_OBJECTS_H | 24 #include FT_INTERNAL_OBJECTS_H |
| 25 | 25 |
| 26 | 26 |
| 27 static | 27 static |
| 28 const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 }; | 28 const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 29 | 29 |
| 30 | 30 |
| 31 /* documentation is in ftbitmap.h */ | 31 /* documentation is in ftbitmap.h */ |
| 32 | 32 |
| 33 FT_EXPORT_DEF( void ) | 33 FT_EXPORT_DEF( void ) |
| 34 FT_Bitmap_Init( FT_Bitmap *abitmap ) |
| 35 { |
| 36 if ( abitmap ) |
| 37 *abitmap = null_bitmap; |
| 38 } |
| 39 |
| 40 |
| 41 /* deprecated function name; retained for ABI compatibility */ |
| 42 |
| 43 FT_EXPORT_DEF( void ) |
| 34 FT_Bitmap_New( FT_Bitmap *abitmap ) | 44 FT_Bitmap_New( FT_Bitmap *abitmap ) |
| 35 { | 45 { |
| 36 if ( abitmap ) | 46 if ( abitmap ) |
| 37 *abitmap = null_bitmap; | 47 *abitmap = null_bitmap; |
| 38 } | 48 } |
| 39 | 49 |
| 40 | 50 |
| 41 /* documentation is in ftbitmap.h */ | 51 /* documentation is in ftbitmap.h */ |
| 42 | 52 |
| 43 FT_EXPORT_DEF( FT_Error ) | 53 FT_EXPORT_DEF( FT_Error ) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if ( source_pitch_sign == target_pitch_sign ) | 120 if ( source_pitch_sign == target_pitch_sign ) |
| 111 FT_MEM_COPY( target->buffer, source->buffer, size ); | 121 FT_MEM_COPY( target->buffer, source->buffer, size ); |
| 112 else | 122 else |
| 113 { | 123 { |
| 114 /* take care of bitmap flow */ | 124 /* take care of bitmap flow */ |
| 115 FT_UInt i; | 125 FT_UInt i; |
| 116 FT_Byte* s = source->buffer; | 126 FT_Byte* s = source->buffer; |
| 117 FT_Byte* t = target->buffer; | 127 FT_Byte* t = target->buffer; |
| 118 | 128 |
| 119 | 129 |
| 120 t += pitch * ( target->rows - 1 ); | 130 t += (FT_ULong)pitch * ( target->rows - 1 ); |
| 121 | 131 |
| 122 for ( i = target->rows; i > 0; i-- ) | 132 for ( i = target->rows; i > 0; i-- ) |
| 123 { | 133 { |
| 124 FT_ARRAY_COPY( t, s, pitch ); | 134 FT_ARRAY_COPY( t, s, pitch ); |
| 125 | 135 |
| 126 s += pitch; | 136 s += pitch; |
| 127 t -= pitch; | 137 t -= pitch; |
| 128 } | 138 } |
| 129 } | 139 } |
| 130 } | 140 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 153 width = bitmap->width; | 163 width = bitmap->width; |
| 154 height = bitmap->rows; | 164 height = bitmap->rows; |
| 155 pitch = bitmap->pitch; | 165 pitch = bitmap->pitch; |
| 156 if ( pitch < 0 ) | 166 if ( pitch < 0 ) |
| 157 pitch = -pitch; | 167 pitch = -pitch; |
| 158 | 168 |
| 159 switch ( bitmap->pixel_mode ) | 169 switch ( bitmap->pixel_mode ) |
| 160 { | 170 { |
| 161 case FT_PIXEL_MODE_MONO: | 171 case FT_PIXEL_MODE_MONO: |
| 162 bpp = 1; | 172 bpp = 1; |
| 163 new_pitch = ( width + xpixels + 7 ) >> 3; | 173 new_pitch = (int)( ( width + xpixels + 7 ) >> 3 ); |
| 164 break; | 174 break; |
| 165 case FT_PIXEL_MODE_GRAY2: | 175 case FT_PIXEL_MODE_GRAY2: |
| 166 bpp = 2; | 176 bpp = 2; |
| 167 new_pitch = ( width + xpixels + 3 ) >> 2; | 177 new_pitch = (int)( ( width + xpixels + 3 ) >> 2 ); |
| 168 break; | 178 break; |
| 169 case FT_PIXEL_MODE_GRAY4: | 179 case FT_PIXEL_MODE_GRAY4: |
| 170 bpp = 4; | 180 bpp = 4; |
| 171 new_pitch = ( width + xpixels + 1 ) >> 1; | 181 new_pitch = (int)( ( width + xpixels + 1 ) >> 1 ); |
| 172 break; | 182 break; |
| 173 case FT_PIXEL_MODE_GRAY: | 183 case FT_PIXEL_MODE_GRAY: |
| 174 case FT_PIXEL_MODE_LCD: | 184 case FT_PIXEL_MODE_LCD: |
| 175 case FT_PIXEL_MODE_LCD_V: | 185 case FT_PIXEL_MODE_LCD_V: |
| 176 bpp = 8; | 186 bpp = 8; |
| 177 new_pitch = ( width + xpixels ); | 187 new_pitch = (int)( width + xpixels ); |
| 178 break; | 188 break; |
| 179 default: | 189 default: |
| 180 return FT_THROW( Invalid_Glyph_Format ); | 190 return FT_THROW( Invalid_Glyph_Format ); |
| 181 } | 191 } |
| 182 | 192 |
| 183 /* if no need to allocate memory */ | 193 /* if no need to allocate memory */ |
| 184 if ( ypixels == 0 && new_pitch <= pitch ) | 194 if ( ypixels == 0 && new_pitch <= pitch ) |
| 185 { | 195 { |
| 186 /* zero the padding */ | 196 /* zero the padding */ |
| 187 FT_UInt bit_width = pitch * 8; | 197 FT_UInt bit_width = (FT_UInt)pitch * 8; |
| 188 FT_UInt bit_last = ( width + xpixels ) * bpp; | 198 FT_UInt bit_last = ( width + xpixels ) * bpp; |
| 189 | 199 |
| 190 | 200 |
| 191 if ( bit_last < bit_width ) | 201 if ( bit_last < bit_width ) |
| 192 { | 202 { |
| 193 FT_Byte* line = bitmap->buffer + ( bit_last >> 3 ); | 203 FT_Byte* line = bitmap->buffer + ( bit_last >> 3 ); |
| 194 FT_Byte* end = bitmap->buffer + pitch; | 204 FT_Byte* end = bitmap->buffer + pitch; |
| 195 FT_UInt shift = bit_last & 7; | 205 FT_UInt shift = bit_last & 7; |
| 196 FT_UInt mask = 0xFF00U >> shift; | 206 FT_UInt mask = 0xFF00U >> shift; |
| 197 FT_UInt count = height; | 207 FT_UInt count = height; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 220 return error; | 230 return error; |
| 221 | 231 |
| 222 /* new rows get added at the top of the bitmap, */ | 232 /* new rows get added at the top of the bitmap, */ |
| 223 /* thus take care of the flow direction */ | 233 /* thus take care of the flow direction */ |
| 224 if ( bitmap->pitch > 0 ) | 234 if ( bitmap->pitch > 0 ) |
| 225 { | 235 { |
| 226 FT_UInt len = ( width * bpp + 7 ) >> 3; | 236 FT_UInt len = ( width * bpp + 7 ) >> 3; |
| 227 | 237 |
| 228 | 238 |
| 229 for ( i = 0; i < bitmap->rows; i++ ) | 239 for ( i = 0; i < bitmap->rows; i++ ) |
| 230 FT_MEM_COPY( buffer + new_pitch * ( ypixels + i ), | 240 FT_MEM_COPY( buffer + (FT_UInt)new_pitch * ( ypixels + i ), |
| 231 bitmap->buffer + pitch * i, len ); | 241 bitmap->buffer + (FT_UInt)pitch * i, |
| 242 len ); |
| 232 } | 243 } |
| 233 else | 244 else |
| 234 { | 245 { |
| 235 FT_UInt len = ( width * bpp + 7 ) >> 3; | 246 FT_UInt len = ( width * bpp + 7 ) >> 3; |
| 236 | 247 |
| 237 | 248 |
| 238 for ( i = 0; i < bitmap->rows; i++ ) | 249 for ( i = 0; i < bitmap->rows; i++ ) |
| 239 FT_MEM_COPY( buffer + new_pitch * i, | 250 FT_MEM_COPY( buffer + (FT_UInt)new_pitch * i, |
| 240 bitmap->buffer + pitch * i, len ); | 251 bitmap->buffer + (FT_UInt)pitch * i, |
| 252 len ); |
| 241 } | 253 } |
| 242 | 254 |
| 243 FT_FREE( bitmap->buffer ); | 255 FT_FREE( bitmap->buffer ); |
| 244 bitmap->buffer = buffer; | 256 bitmap->buffer = buffer; |
| 245 | 257 |
| 246 if ( bitmap->pitch < 0 ) | 258 if ( bitmap->pitch < 0 ) |
| 247 new_pitch = -new_pitch; | 259 new_pitch = -new_pitch; |
| 248 | 260 |
| 249 /* set pitch only, width and height are left untouched */ | 261 /* set pitch only, width and height are left untouched */ |
| 250 bitmap->pitch = new_pitch; | 262 bitmap->pitch = new_pitch; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 300 |
| 289 switch ( bitmap->pixel_mode ) | 301 switch ( bitmap->pixel_mode ) |
| 290 { | 302 { |
| 291 case FT_PIXEL_MODE_GRAY2: | 303 case FT_PIXEL_MODE_GRAY2: |
| 292 case FT_PIXEL_MODE_GRAY4: | 304 case FT_PIXEL_MODE_GRAY4: |
| 293 { | 305 { |
| 294 FT_Bitmap tmp; | 306 FT_Bitmap tmp; |
| 295 | 307 |
| 296 | 308 |
| 297 /* convert to 8bpp */ | 309 /* convert to 8bpp */ |
| 298 FT_Bitmap_New( &tmp ); | 310 FT_Bitmap_Init( &tmp ); |
| 299 error = FT_Bitmap_Convert( library, bitmap, &tmp, 1 ); | 311 error = FT_Bitmap_Convert( library, bitmap, &tmp, 1 ); |
| 300 if ( error ) | 312 if ( error ) |
| 301 return error; | 313 return error; |
| 302 | 314 |
| 303 FT_Bitmap_Done( library, bitmap ); | 315 FT_Bitmap_Done( library, bitmap ); |
| 304 *bitmap = tmp; | 316 *bitmap = tmp; |
| 305 } | 317 } |
| 306 break; | 318 break; |
| 307 | 319 |
| 308 case FT_PIXEL_MODE_MONO: | 320 case FT_PIXEL_MODE_MONO: |
| 309 if ( xstr > 8 ) | 321 if ( xstr > 8 ) |
| 310 xstr = 8; | 322 xstr = 8; |
| 311 break; | 323 break; |
| 312 | 324 |
| 313 case FT_PIXEL_MODE_LCD: | 325 case FT_PIXEL_MODE_LCD: |
| 314 xstr *= 3; | 326 xstr *= 3; |
| 315 break; | 327 break; |
| 316 | 328 |
| 317 case FT_PIXEL_MODE_LCD_V: | 329 case FT_PIXEL_MODE_LCD_V: |
| 318 ystr *= 3; | 330 ystr *= 3; |
| 319 break; | 331 break; |
| 320 | 332 |
| 321 case FT_PIXEL_MODE_BGRA: | 333 case FT_PIXEL_MODE_BGRA: |
| 322 /* We don't embolden color glyphs. */ | 334 /* We don't embolden color glyphs. */ |
| 323 return FT_Err_Ok; | 335 return FT_Err_Ok; |
| 324 } | 336 } |
| 325 | 337 |
| 326 error = ft_bitmap_assure_buffer( library->memory, bitmap, xstr, ystr ); | 338 error = ft_bitmap_assure_buffer( library->memory, bitmap, |
| 339 (FT_UInt)xstr, (FT_UInt)ystr ); |
| 327 if ( error ) | 340 if ( error ) |
| 328 return error; | 341 return error; |
| 329 | 342 |
| 330 /* take care of bitmap flow */ | 343 /* take care of bitmap flow */ |
| 331 pitch = bitmap->pitch; | 344 pitch = bitmap->pitch; |
| 332 if ( pitch > 0 ) | 345 if ( pitch > 0 ) |
| 333 p = bitmap->buffer + pitch * ystr; | 346 p = bitmap->buffer + pitch * ystr; |
| 334 else | 347 else |
| 335 { | 348 { |
| 336 pitch = -pitch; | 349 pitch = -pitch; |
| 337 p = bitmap->buffer + pitch * ( bitmap->rows - 1 ); | 350 p = bitmap->buffer + (FT_UInt)pitch * ( bitmap->rows - 1 ); |
| 338 } | 351 } |
| 339 | 352 |
| 340 /* for each row */ | 353 /* for each row */ |
| 341 for ( y = 0; y < bitmap->rows ; y++ ) | 354 for ( y = 0; y < bitmap->rows ; y++ ) |
| 342 { | 355 { |
| 343 /* | 356 /* |
| 344 * Horizontally: | 357 * Horizontally: |
| 345 * | 358 * |
| 346 * From the last pixel on, make each pixel or'ed with the | 359 * From the last pixel on, make each pixel or'ed with the |
| 347 * `xstr' pixels before it. | 360 * `xstr' pixels before it. |
| 348 */ | 361 */ |
| 349 for ( x = pitch - 1; x >= 0; x-- ) | 362 for ( x = pitch - 1; x >= 0; x-- ) |
| 350 { | 363 { |
| 351 unsigned char tmp; | 364 unsigned char tmp; |
| 352 | 365 |
| 353 | 366 |
| 354 tmp = p[x]; | 367 tmp = p[x]; |
| 355 for ( i = 1; i <= xstr; i++ ) | 368 for ( i = 1; i <= xstr; i++ ) |
| 356 { | 369 { |
| 357 if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO ) | 370 if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO ) |
| 358 { | 371 { |
| 359 p[x] |= tmp >> i; | 372 p[x] |= tmp >> i; |
| 360 | 373 |
| 361 /* the maximum value of 8 for `xstr' comes from here */ | 374 /* the maximum value of 8 for `xstr' comes from here */ |
| 362 if ( x > 0 ) | 375 if ( x > 0 ) |
| 363 p[x] |= p[x - 1] << ( 8 - i ); | 376 p[x] |= p[x - 1] << ( 8 - i ); |
| 364 | 377 |
| 365 #if 0 | 378 #if 0 |
| 366 if ( p[x] == 0xff ) | 379 if ( p[x] == 0xFF ) |
| 367 break; | 380 break; |
| 368 #endif | 381 #endif |
| 369 } | 382 } |
| 370 else | 383 else |
| 371 { | 384 { |
| 372 if ( x - i >= 0 ) | 385 if ( x - i >= 0 ) |
| 373 { | 386 { |
| 374 if ( p[x] + p[x - i] > bitmap->num_grays - 1 ) | 387 if ( p[x] + p[x - i] > bitmap->num_grays - 1 ) |
| 375 { | 388 { |
| 376 p[x] = (unsigned char)( bitmap->num_grays - 1 ); | 389 p[x] = (unsigned char)( bitmap->num_grays - 1 ); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 400 | 413 |
| 401 | 414 |
| 402 q = p - bitmap->pitch * x; | 415 q = p - bitmap->pitch * x; |
| 403 for ( i = 0; i < pitch; i++ ) | 416 for ( i = 0; i < pitch; i++ ) |
| 404 q[i] |= p[i]; | 417 q[i] |= p[i]; |
| 405 } | 418 } |
| 406 | 419 |
| 407 p += bitmap->pitch; | 420 p += bitmap->pitch; |
| 408 } | 421 } |
| 409 | 422 |
| 410 bitmap->width += xstr; | 423 bitmap->width += (FT_UInt)xstr; |
| 411 bitmap->rows += ystr; | 424 bitmap->rows += (FT_UInt)ystr; |
| 412 | 425 |
| 413 return FT_Err_Ok; | 426 return FT_Err_Ok; |
| 414 } | 427 } |
| 415 | 428 |
| 416 | 429 |
| 417 static FT_Byte | 430 static FT_Byte |
| 418 ft_gray_for_premultiplied_srgb_bgra( const FT_Byte* bgra ) | 431 ft_gray_for_premultiplied_srgb_bgra( const FT_Byte* bgra ) |
| 419 { | 432 { |
| 420 FT_UInt a = bgra[3]; | 433 FT_UInt a = bgra[3]; |
| 421 FT_UInt l; | 434 FT_UInt l; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 case FT_PIXEL_MODE_BGRA: | 507 case FT_PIXEL_MODE_BGRA: |
| 495 { | 508 { |
| 496 FT_Int pad, old_target_pitch, target_pitch; | 509 FT_Int pad, old_target_pitch, target_pitch; |
| 497 FT_ULong old_size; | 510 FT_ULong old_size; |
| 498 | 511 |
| 499 | 512 |
| 500 old_target_pitch = target->pitch; | 513 old_target_pitch = target->pitch; |
| 501 if ( old_target_pitch < 0 ) | 514 if ( old_target_pitch < 0 ) |
| 502 old_target_pitch = -old_target_pitch; | 515 old_target_pitch = -old_target_pitch; |
| 503 | 516 |
| 504 old_size = target->rows * old_target_pitch; | 517 old_size = target->rows * (FT_UInt)old_target_pitch; |
| 505 | 518 |
| 506 target->pixel_mode = FT_PIXEL_MODE_GRAY; | 519 target->pixel_mode = FT_PIXEL_MODE_GRAY; |
| 507 target->rows = source->rows; | 520 target->rows = source->rows; |
| 508 target->width = source->width; | 521 target->width = source->width; |
| 509 | 522 |
| 510 pad = 0; | 523 pad = 0; |
| 511 if ( alignment > 0 ) | 524 if ( alignment > 0 ) |
| 512 { | 525 { |
| 513 pad = source->width % alignment; | 526 pad = (FT_Int)source->width % alignment; |
| 514 if ( pad != 0 ) | 527 if ( pad != 0 ) |
| 515 pad = alignment - pad; | 528 pad = alignment - pad; |
| 516 } | 529 } |
| 517 | 530 |
| 518 target_pitch = source->width + pad; | 531 target_pitch = (FT_Int)source->width + pad; |
| 519 | 532 |
| 520 if ( target_pitch > 0 && | 533 if ( target_pitch > 0 && |
| 521 (FT_ULong)target->rows > FT_ULONG_MAX / target_pitch ) | 534 (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) |
| 522 return FT_THROW( Invalid_Argument ); | 535 return FT_THROW( Invalid_Argument ); |
| 523 | 536 |
| 524 if ( target->rows * target_pitch > old_size && | 537 if ( target->rows * (FT_ULong)target_pitch > old_size && |
| 525 FT_QREALLOC( target->buffer, | 538 FT_QREALLOC( target->buffer, |
| 526 old_size, target->rows * target_pitch ) ) | 539 old_size, target->rows * (FT_UInt)target_pitch ) ) |
| 527 return error; | 540 return error; |
| 528 | 541 |
| 529 target->pitch = target->pitch < 0 ? -target_pitch : target_pitch; | 542 target->pitch = target->pitch < 0 ? -target_pitch : target_pitch; |
| 530 } | 543 } |
| 531 break; | 544 break; |
| 532 | 545 |
| 533 default: | 546 default: |
| 534 error = FT_THROW( Invalid_Argument ); | 547 error = FT_THROW( Invalid_Argument ); |
| 535 } | 548 } |
| 536 | 549 |
| 537 s = source->buffer; | 550 s = source->buffer; |
| 538 t = target->buffer; | 551 t = target->buffer; |
| 539 | 552 |
| 540 /* take care of bitmap flow */ | 553 /* take care of bitmap flow */ |
| 541 if ( source->pitch < 0 ) | 554 if ( source->pitch < 0 ) |
| 542 s -= source->pitch * ( source->rows - 1 ); | 555 s -= source->pitch * (FT_Int)( source->rows - 1 ); |
| 543 if ( target->pitch < 0 ) | 556 if ( target->pitch < 0 ) |
| 544 t -= target->pitch * ( target->rows - 1 ); | 557 t -= target->pitch * (FT_Int)( target->rows - 1 ); |
| 545 | 558 |
| 546 switch ( source->pixel_mode ) | 559 switch ( source->pixel_mode ) |
| 547 { | 560 { |
| 548 case FT_PIXEL_MODE_MONO: | 561 case FT_PIXEL_MODE_MONO: |
| 549 { | 562 { |
| 550 FT_UInt i; | 563 FT_UInt i; |
| 551 | 564 |
| 552 | 565 |
| 553 target->num_grays = 2; | 566 target->num_grays = 2; |
| 554 | 567 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 t += target->pitch; | 610 t += target->pitch; |
| 598 } | 611 } |
| 599 } | 612 } |
| 600 break; | 613 break; |
| 601 | 614 |
| 602 | 615 |
| 603 case FT_PIXEL_MODE_GRAY: | 616 case FT_PIXEL_MODE_GRAY: |
| 604 case FT_PIXEL_MODE_LCD: | 617 case FT_PIXEL_MODE_LCD: |
| 605 case FT_PIXEL_MODE_LCD_V: | 618 case FT_PIXEL_MODE_LCD_V: |
| 606 { | 619 { |
| 607 FT_Int width = source->width; | 620 FT_UInt width = source->width; |
| 608 FT_UInt i; | 621 FT_UInt i; |
| 609 | 622 |
| 610 | 623 |
| 611 target->num_grays = 256; | 624 target->num_grays = 256; |
| 612 | 625 |
| 613 for ( i = source->rows; i > 0; i-- ) | 626 for ( i = source->rows; i > 0; i-- ) |
| 614 { | 627 { |
| 615 FT_ARRAY_COPY( t, s, width ); | 628 FT_ARRAY_COPY( t, s, width ); |
| 616 | 629 |
| 617 s += source->pitch; | 630 s += source->pitch; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 FT_EXPORT_DEF( FT_Error ) | 762 FT_EXPORT_DEF( FT_Error ) |
| 750 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ) | 763 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ) |
| 751 { | 764 { |
| 752 if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP && | 765 if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP && |
| 753 !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) | 766 !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) |
| 754 { | 767 { |
| 755 FT_Bitmap bitmap; | 768 FT_Bitmap bitmap; |
| 756 FT_Error error; | 769 FT_Error error; |
| 757 | 770 |
| 758 | 771 |
| 759 FT_Bitmap_New( &bitmap ); | 772 FT_Bitmap_Init( &bitmap ); |
| 760 error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap ); | 773 error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap ); |
| 761 if ( error ) | 774 if ( error ) |
| 762 return error; | 775 return error; |
| 763 | 776 |
| 764 slot->bitmap = bitmap; | 777 slot->bitmap = bitmap; |
| 765 slot->internal->flags |= FT_GLYPH_OWN_BITMAP; | 778 slot->internal->flags |= FT_GLYPH_OWN_BITMAP; |
| 766 } | 779 } |
| 767 | 780 |
| 768 return FT_Err_Ok; | 781 return FT_Err_Ok; |
| 769 } | 782 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 787 memory = library->memory; | 800 memory = library->memory; |
| 788 | 801 |
| 789 FT_FREE( bitmap->buffer ); | 802 FT_FREE( bitmap->buffer ); |
| 790 *bitmap = null_bitmap; | 803 *bitmap = null_bitmap; |
| 791 | 804 |
| 792 return FT_Err_Ok; | 805 return FT_Err_Ok; |
| 793 } | 806 } |
| 794 | 807 |
| 795 | 808 |
| 796 /* END */ | 809 /* END */ |
| OLD | NEW |