freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][gsoc-anurag-2023] Connect prelines to renderer


From: Anurag Thakur (@AdbhutDev)
Subject: [Git][freetype/freetype][gsoc-anurag-2023] Connect prelines to renderer
Date: Sun, 03 Sep 2023 20:31:00 +0000

Anurag Thakur pushed to branch gsoc-anurag-2023 at FreeType / FreeType

Commits:

  • 71f7fb72
    by Anurag Thakur at 2023-09-04T02:00:23+05:30
    Connect prelines to renderer
    

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,12 @@
    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
    +    FT_PreLine ptr = (*slot)->prelines;
    
    2575
    +
    
    2576
    +    for ( n = 0; n < outline->n_contours; n++ )
    
    2574 2577
         {
    
    2575
    -      FT_TRACE5(( "FT_Outline_Decompose: Contour %d\n", n ));
    
    2578
    +      FT_TRACE5(( "ft_decompose_outline: Contour %d\n", n ));
    
    2576 2579
     
    
    2577 2580
           first = last + 1;
    
    2578 2581
           last  = outline->contours[n];
    
    ... ... @@ -2629,6 +2632,22 @@
    2629 2632
           // if ( error )
    
    2630 2633
           //   goto Exit;
    
    2631 2634
     
    
    2635
    +
    
    2636
    +      FT_PreLine pl  = malloc(sizeof(FT_PreLineRec));
    
    2637
    +            pl->x1 = v_start.x/64;
    
    2638
    +            pl->y1 = v_start.y/64;
    
    2639
    +            pl->x2 = v_start.x/64;
    
    2640
    +            pl->y2 = v_start.y/64;
    
    2641
    +            pl->next = NULL;
    
    2642
    +
    
    2643
    +            if((*slot)->prelines == NULL){
    
    2644
    +                ptr = (*slot)->prelines = pl;
    
    2645
    +            }else{
    
    2646
    +            ptr->next = pl;
    
    2647
    +
    
    2648
    +            }
    
    2649
    +      
    
    2650
    +
    
    2632 2651
           while ( point < limit )
    
    2633 2652
           {
    
    2634 2653
             point++;
    
    ... ... @@ -2642,19 +2661,20 @@
    2642 2661
                 FT_Vector  vec;
    
    2643 2662
     
    
    2644 2663
     
    
    2645
    -            vec.x = SCALED( point->x );
    
    2646
    -            vec.y = SCALED( point->y );
    
    2664
    +            vec.x = point->x;
    
    2665
    +            vec.y = point->y;
    
    2647 2666
     
    
    2648 2667
                 FT_TRACE5(( "  line to (%.2f, %.2f)\n",
    
    2649 2668
                             (double)vec.x / 64, (double)vec.y / 64 ));
    
    2650 2669
                 //error = func_interface->line_to( &vec, user );
    
    2651 2670
                 FT_PreLine pl  = malloc(sizeof(FT_PreLineRec));
    
    2652
    -            pl->x1 = v_last.x;
    
    2653
    -            pl->y1 = v_last.y;
    
    2654
    -            pl->x2 = vec.x;
    
    2655
    -            pl->y2 = vec.y;
    
    2671
    +            pl->x1 = v_last.x/64;
    
    2672
    +            pl->y1 = v_last.y/64;
    
    2673
    +            pl->x2 = vec.x/64;
    
    2674
    +            pl->y2 = vec.y/64;
    
    2656 2675
                 pl->next = NULL;
    
    2657
    -            (*slot)->prelines->next = pl;
    
    2676
    +            ptr->next = pl;
    
    2677
    +            ptr = ptr->next;
    
    2658 2678
                 continue;
    
    2659 2679
               }
    
    2660 2680
     
    
    ... ... @@ -2947,14 +2967,15 @@
    2947 2967
             FT_Load_Glyph(face, gindex, FT_LOAD_NO_HINTING);
    
    2948 2968
     
    
    2949 2969
             // *face->garray[gindex]->prelines = (FT_PreLineRec){1,2,3,4, NULL}; // need to revise structs and pointers.
    
    2950
    -        FT_PreLine pl = face->garray[gindex]->prelines = malloc(sizeof(FT_PreLineRec));
    
    2951
    -        pl->x1 = 0;
    
    2952
    -        pl->x2 = 1;
    
    2953
    -        pl->y1 = 2;
    
    2954
    -        pl->y2 = 3;
    
    2955
    -        pl->next = NULL;
    
    2956
    -
    
    2957
    -        ft_decompose_outline(face->garray[gindex]);
    
    2970
    +        // FT_PreLine pl = face->garray[gindex]->prelines = malloc(sizeof(FT_PreLineRec));
    
    2971
    +        // pl->x1 = 0;
    
    2972
    +        // pl->x2 = 1;
    
    2973
    +        // pl->y1 = 2;
    
    2974
    +        // pl->y2 = 3;
    
    2975
    +        // pl->next = NULL;
    
    2976
    +
    
    2977
    +
    
    2978
    +        ft_decompose_outline(&face->garray[gindex]);
    
    2958 2979
     
    
    2959 2980
     
    
    2960 2981
           }
    

  • 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
    ... ... @@ -90,7 +90,7 @@
    90 90
                        FT_Render_Mode   mode,
    
    91 91
                        const FT_Vector* origin )
    
    92 92
       {
    
    93
    -    printf("%d %d %d %d \n", slot->prelines->x1, slot->prelines->x2, slot->prelines->y1, slot->prelines->y2);
    
    93
    +   // printf("%d %d %d %d \n", slot->prelines->x1, slot->prelines->x2, slot->prelines->y1, slot->prelines->y2);
    
    94 94
         FT_Error    error   = FT_Err_Ok;
    
    95 95
         FT_Outline* outline = &slot->outline;
    
    96 96
         FT_Bitmap*  bitmap  = &slot->bitmap;
    
    ... ... @@ -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 =
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]