Anurag Thakur pushed to branch gsoc-anurag-2023 at FreeType / FreeType
Commits:
4 changed files:
Changes:
include/freetype/ftimage.h
... |
... |
@@ -1059,6 +1059,7 @@ FT_BEGIN_HEADER |
1059
|
1059
|
FT_Raster_BitSet_Func bit_set; /* unused */
|
1060
|
1060
|
void* user;
|
1061
|
1061
|
FT_BBox clip_box;
|
|
1062
|
+ void* prelines;
|
1062
|
1063
|
|
1063
|
1064
|
} FT_Raster_Params;
|
1064
|
1065
|
|
src/base/ftobjs.c
... |
... |
@@ -2570,9 +2570,10 @@ |
2570
|
2570
|
if ( !outline )
|
2571
|
2571
|
return FT_THROW( Invalid_Outline );
|
2572
|
2572
|
|
2573
|
|
- for ( n = 0; n < outline->n_contours; n++ )
|
|
2573
|
+ last = -1;
|
|
2574
|
+ for ( n = 0; n < outline->n_contours; n++ )
|
2574
|
2575
|
{
|
2575
|
|
- FT_TRACE5(( "FT_Outline_Decompose: Contour %d\n", n ));
|
|
2576
|
+ FT_TRACE5(( "ft_decompose_outline: Contour %d\n", n ));
|
2576
|
2577
|
|
2577
|
2578
|
first = last + 1;
|
2578
|
2579
|
last = outline->contours[n];
|
... |
... |
@@ -2629,6 +2630,7 @@ |
2629
|
2630
|
// if ( error )
|
2630
|
2631
|
// goto Exit;
|
2631
|
2632
|
|
|
2633
|
+ FT_PreLine ptr = (*slot)->prelines;
|
2632
|
2634
|
while ( point < limit )
|
2633
|
2635
|
{
|
2634
|
2636
|
point++;
|
... |
... |
@@ -2642,8 +2644,8 @@ |
2642
|
2644
|
FT_Vector vec;
|
2643
|
2645
|
|
2644
|
2646
|
|
2645
|
|
- vec.x = SCALED( point->x );
|
2646
|
|
- vec.y = SCALED( point->y );
|
|
2647
|
+ vec.x = point->x;
|
|
2648
|
+ vec.y = point->y;
|
2647
|
2649
|
|
2648
|
2650
|
FT_TRACE5(( " line to (%.2f, %.2f)\n",
|
2649
|
2651
|
(double)vec.x / 64, (double)vec.y / 64 ));
|
... |
... |
@@ -2654,7 +2656,8 @@ |
2654
|
2656
|
pl->x2 = vec.x;
|
2655
|
2657
|
pl->y2 = vec.y;
|
2656
|
2658
|
pl->next = NULL;
|
2657
|
|
- (*slot)->prelines->next = pl;
|
|
2659
|
+ ptr->next = pl;
|
|
2660
|
+ ptr = ptr->next;
|
2658
|
2661
|
continue;
|
2659
|
2662
|
}
|
2660
|
2663
|
|
... |
... |
@@ -2954,7 +2957,8 @@ |
2954
|
2957
|
pl->y2 = 3;
|
2955
|
2958
|
pl->next = NULL;
|
2956
|
2959
|
|
2957
|
|
- ft_decompose_outline(face->garray[gindex]);
|
|
2960
|
+
|
|
2961
|
+ ft_decompose_outline(&face->garray[gindex]);
|
2958
|
2962
|
|
2959
|
2963
|
|
2960
|
2964
|
}
|
src/dense/ftdense.c
... |
... |
@@ -9,6 +9,8 @@ |
9
|
9
|
#include <freetype/internal/ftobjs.h>
|
10
|
10
|
#include <math.h>
|
11
|
11
|
|
|
12
|
+
|
|
13
|
+#include <stdio.h>
|
12
|
14
|
#include "ftdense.h"
|
13
|
15
|
#include "ftdenseerrs.h"
|
14
|
16
|
|
... |
... |
@@ -416,10 +418,23 @@ FT_DEFINE_OUTLINE_FUNCS( dense_decompose_funcs, |
416
|
418
|
)
|
417
|
419
|
|
418
|
420
|
static int
|
419
|
|
-dense_render_glyph( dense_worker* worker, const FT_Bitmap* target )
|
|
421
|
+dense_render_glyph( dense_worker* worker, const FT_Bitmap* target, FT_PreLine pl )
|
420
|
422
|
{
|
421
|
|
- FT_Error error = FT_Outline_Decompose( &( worker->outline ),
|
422
|
|
- &dense_decompose_funcs, worker );
|
|
423
|
+ // FT_Error error = FT_Outline_Decompose( &( worker->outline ),
|
|
424
|
+ // &dense_decompose_funcs, worker );
|
|
425
|
+ FT_Vector point = {100, 100};
|
|
426
|
+ FT_Error error = dense_move_to(&point, worker);
|
|
427
|
+ while (pl!=NULL)
|
|
428
|
+ {
|
|
429
|
+ point.x = pl->x2/64;
|
|
430
|
+ point.y = pl->y2/64;
|
|
431
|
+ dense_line_to(&point, worker);
|
|
432
|
+ pl= pl->next;
|
|
433
|
+ }
|
|
434
|
+ point.x = 100;
|
|
435
|
+ point.y = 100;
|
|
436
|
+ dense_move_to(&point, worker);
|
|
437
|
+
|
423
|
438
|
// Render into bitmap
|
424
|
439
|
const FT20D12* source = worker->m_a;
|
425
|
440
|
unsigned char* dest = target->buffer;
|
... |
... |
@@ -495,6 +510,8 @@ dense_raster_render( FT_Raster raster, const FT_Raster_Params* params ) |
495
|
510
|
{
|
496
|
511
|
const FT_Outline* outline = (const FT_Outline*)params->source;
|
497
|
512
|
FT_Bitmap* target_map = params->target;
|
|
513
|
+ FT_PreLine pl = params->prelines;
|
|
514
|
+ printf("%d\n", pl->next->x1);
|
498
|
515
|
|
499
|
516
|
dense_worker worker[1];
|
500
|
517
|
|
... |
... |
@@ -536,7 +553,7 @@ dense_raster_render( FT_Raster raster, const FT_Raster_Params* params ) |
536
|
553
|
// Invert the pitch to account for different +ve y-axis direction in dense array
|
537
|
554
|
// (maybe temporary solution)
|
538
|
555
|
target_map->pitch *= -1;
|
539
|
|
- return dense_render_glyph( worker, target_map );
|
|
556
|
+ return dense_render_glyph( worker, target_map, pl );
|
540
|
557
|
}
|
541
|
558
|
|
542
|
559
|
FT_DEFINE_RASTER_FUNCS(
|
src/dense/ftdenserend.c
... |
... |
@@ -168,6 +168,7 @@ |
168
|
168
|
/* set up parameters */
|
169
|
169
|
params.target = bitmap;
|
170
|
170
|
params.source = outline;
|
|
171
|
+ params.prelines = slot->prelines;
|
171
|
172
|
|
172
|
173
|
/* render the outline */
|
173
|
174
|
error =
|
|