Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs
Commits:
-
0a29651d
by Alexei Podtelezhnikov at 2022-02-05T16:49:03-05:00
2 changed files:
Changes:
... | ... | @@ -1387,7 +1387,7 @@ |
1387 | 1387 | target->rows = (int)source->rows;
|
1388 | 1388 | target->width = (int)source->width;
|
1389 | 1389 | target->pitch = source->pitch;
|
1390 | - target->buffer = source->buffer;
|
|
1390 | + target->buffer = source->buffer; /* source glyf still owns it */
|
|
1391 | 1391 | target->grays = source->num_grays;
|
1392 | 1392 | |
1393 | 1393 | switch ( source->pixel_mode )
|
... | ... | @@ -399,7 +399,6 @@ |
399 | 399 | int scale )
|
400 | 400 | {
|
401 | 401 | unsigned char* s = bit->buffer;
|
402 | - unsigned char* t;
|
|
403 | 402 | unsigned char* line;
|
404 | 403 | int pitch;
|
405 | 404 | int width;
|
... | ... | @@ -409,12 +408,13 @@ |
409 | 408 | : -bit->pitch;
|
410 | 409 | width = bit->width;
|
411 | 410 | |
412 | - t = (unsigned char*)malloc( (size_t)( pitch * bit->rows *
|
|
413 | - scale * scale ) );
|
|
414 | - if ( !t )
|
|
415 | - return;
|
|
411 | + line = (unsigned char*)malloc( (size_t)( pitch * bit->rows *
|
|
412 | + scale * scale ) );
|
|
413 | + |
|
414 | + bit->buffer = line; /* the bitmap now owns this buffer */
|
|
416 | 415 | |
417 | - line = t;
|
|
416 | + if ( !line )
|
|
417 | + return;
|
|
418 | 418 | |
419 | 419 | switch( bit->mode )
|
420 | 420 | {
|
... | ... | @@ -515,7 +515,6 @@ |
515 | 515 | return;
|
516 | 516 | }
|
517 | 517 | |
518 | - bit->buffer = t;
|
|
519 | 518 | bit->rows *= scale;
|
520 | 519 | bit->width *= scale;
|
521 | 520 | bit->pitch *= scale;
|
... | ... | @@ -598,7 +597,7 @@ |
598 | 597 | ox + left * scale, oy - top * scale,
|
599 | 598 | st->axis_color );
|
600 | 599 | |
601 | - free( bitg.buffer );
|
|
600 | + grDoneBitmap( &bitg );
|
|
602 | 601 | |
603 | 602 | if ( glyf )
|
604 | 603 | FT_Done_Glyph( glyf );
|