apwfreetypelib

Check-in [75a6e99504]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixes and renaming.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:75a6e99504f6914ea6801066bfe4b26d6343e27a
User & Date: arnulf 2015-01-25 16:21:44
Context
2015-01-25
16:24
fixes and renaming check-in: 37d8d05b7b user: arnulf tags: trunk
16:21
fixes and renaming. check-in: 75a6e99504 user: arnulf tags: trunk
16:18
renaming and fixes. check-in: 57e19d7f58 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to aftraster/FTGrayOutlineFuncsClass.java.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
...
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
...
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
...
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
...
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
  }

  /* =====================================================================
   *    gray_move_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_move_to(FTVectorRec to, grayTWorker worker) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    int x;
    int y;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_move_to: to.x: %d, to.y: %d", to.x, to.y));

      /* record current cell, if any */
    gray_record_cell(worker);
................................................................................
  }

  /* =====================================================================
   *    gray_line_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_line_to(FTVectorRec to, grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_line_to: to.x: %d, to.y: %d", to.x, to.y));
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_line_to call gray_render_line");
    gray_render_line(worker, RasterUtil.UPSCALE(to.x), RasterUtil.UPSCALE(to.y));
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_line_to after call gray_render_line");
    return error;
................................................................................
  }

  /* =====================================================================
   *    gray_conic_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_conic_to(FTVectorRec control, FTVectorRec to, grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_conic_to");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    gray_render_conic(control, to, worker);
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_conic_to end");
    return error;
  }

  /* =====================================================================
   *    gray_cubic_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_cubic_to(FTVectorRec control1, FTVectorRec control2, FTVectorRec to, grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_cubic_to");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    gray_render_cubic(control1, control2, to, worker);
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_cubic_to end");
    return error;
  }

  /* =====================================================================
   *    gray_find_cell
   *
   * =====================================================================
   */
  private TCell gray_find_cell(grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_find_cell: ras.ex: %d, ras.ey: %d, ras.count_ex: %d, ras.num_cells: %d", worker.ex, worker.ey, worker.count_ex, worker.num_cells));
    int pcellIdx;
    int cellIdx;
    TCell cell = null;
    TCell pcell = null;
    int x = worker.ex;
    boolean useYcells = true;
................................................................................
  }

  /* =====================================================================
   *    gray_record_cell
   *
   * =====================================================================
   */
  public void gray_record_cell(grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_record_cell: ras.invalid: %b, ras.area: %x, ras.cover: %x\n", worker.invalid, worker.area, worker.cover));

    if (!worker.invalid && (worker.area | worker.cover) != 0) {
      TCell cell = gray_find_cell(worker);

      cell.area  += worker.area;
      cell.cover += worker.cover;
................................................................................
   * . the new horizontal position must be strictly less than max_ex
   *
   * Note that if a cell is to the left of the clipping region, it is
   * actually set to the (min_ex-1) horizontal position.
   *
   * =====================================================================
   */
  private void gray_set_cell(grayTWorker worker, int ex, int ey) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_set_cell: ex: %d, ey: %d, invalid: %b, ras.ex: %d, ras.ey: %d", ex, ey, worker.invalid, worker.ex, worker.ey));
      /* All cells that are on the left of the clipping region go to the */
      /* min_ex - 1 horizontal position.                                 */
    ey -= worker.min_ey;
    if (ex > worker.max_ex) {
      ex = worker.max_ex;
    }
................................................................................
  }

  /* =====================================================================
   *    gray_start_cell
   *
   * =====================================================================
   */
  private void gray_start_cell(grayTWorker worker, int ex, int ey) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_start_cell: ex: %d, ey: %d", ex, ey));

    if (ex > worker.max_ex) {
      ex = worker.max_ex;
    }
    if (ex < worker.min_ex) {
      ex = worker.min_ex - 1;
................................................................................


  /* =====================================================================
   *    gray_render_scanline
   *
   * =====================================================================
   */
  private void gray_render_scanline(grayTWorker worker, int ey, int x1, int y1, int x2, int y2) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_render_scanline");
    int ex1;
    int ex2;
    int fx1;
    int fx2;
    int delta;
    int mod;
................................................................................
  }

  /* =====================================================================
   *    gray_render_line
   *
   * =====================================================================
   */
  private void gray_render_line(grayTWorker worker, int to_x, int to_y) {
    int ey1;
    int ey2;
    int fy1;
    int fy2;
    int mod;
    int dx;
    int dy;
................................................................................
  }

  /* =====================================================================
   *    gray_render_conic
   *
   * =====================================================================
   */
  private void gray_render_conic(FTVectorRec control, FTVectorRec to, grayTWorker worker) {
    int dx;
    int dy;
    int min;
    int max;
    int y;
    int top;
    int level;
................................................................................
  }

  /* =====================================================================
   *    gray_render_cubic
   *
   * =====================================================================
   */
  private void gray_render_cubic(FTVectorRec control1, FTVectorRec control2, FTVectorRec to, grayTWorker worker) {
    FTVectorRec[] arc;
    FTReference<FTVectorRec[]> arc_ref = new FTReference<FTVectorRec[]>();
    int arcIdx = 0;
    int min;
    int max;
    int y;
    boolean noSplit = false;
................................................................................
  }

  /* =====================================================================
   *    gray_compute_cbox
   *
   * =====================================================================
   */
  public void gray_compute_cbox(grayTWorker worker) {
    FTOutlineRec outline = worker.outline;
    FTVectorRec vec;
    int vecIdx = 0;
    int limit = outline.getN_points();

Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_compute_cbox"));
    if (outline.getN_points() <= 0) {
................................................................................
    worker.outline = outline;
  }


  /* ==================== moveTo ===================================== */
  @Override
  public FTError.ErrorTag moveTo(FTVectorRec point, Object user) {
    return gray_move_to(point, (grayTWorker)user);
  }

  /* ==================== lineTo ===================================== */
  @Override
  public FTError.ErrorTag lineTo(FTVectorRec point, Object user) {
    return gray_line_to(point, (grayTWorker)user);
  }

  /* ==================== conicTo ===================================== */
  @Override
  public FTError.ErrorTag conicTo(FTVectorRec control, FTVectorRec point, Object user) {
    return gray_conic_to(control, point, (grayTWorker)user);
  }

  /* ==================== cubicTo ===================================== */
  @Override
  public FTError.ErrorTag cubicTo(FTVectorRec control1, FTVectorRec control2, FTVectorRec point, Object user) {
    return gray_cubic_to(control1, control2, point, (grayTWorker)user);
  }

}







|







 







|







 







|













|













|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|





|





|





|



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
...
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
...
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
...
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
...
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
  }

  /* =====================================================================
   *    gray_move_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_move_to(FTVectorRec to, grayTWorkerRec worker) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    int x;
    int y;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_move_to: to.x: %d, to.y: %d", to.x, to.y));

      /* record current cell, if any */
    gray_record_cell(worker);
................................................................................
  }

  /* =====================================================================
   *    gray_line_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_line_to(FTVectorRec to, grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_line_to: to.x: %d, to.y: %d", to.x, to.y));
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_line_to call gray_render_line");
    gray_render_line(worker, RasterUtil.UPSCALE(to.x), RasterUtil.UPSCALE(to.y));
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_line_to after call gray_render_line");
    return error;
................................................................................
  }

  /* =====================================================================
   *    gray_conic_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_conic_to(FTVectorRec control, FTVectorRec to, grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_conic_to");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    gray_render_conic(control, to, worker);
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_conic_to end");
    return error;
  }

  /* =====================================================================
   *    gray_cubic_to
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_cubic_to(FTVectorRec control1, FTVectorRec control2, FTVectorRec to, grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_cubic_to");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    gray_render_cubic(control1, control2, to, worker);
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_cubic_to end");
    return error;
  }

  /* =====================================================================
   *    gray_find_cell
   *
   * =====================================================================
   */
  private TCell gray_find_cell(grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_find_cell: ras.ex: %d, ras.ey: %d, ras.count_ex: %d, ras.num_cells: %d", worker.ex, worker.ey, worker.count_ex, worker.num_cells));
    int pcellIdx;
    int cellIdx;
    TCell cell = null;
    TCell pcell = null;
    int x = worker.ex;
    boolean useYcells = true;
................................................................................
  }

  /* =====================================================================
   *    gray_record_cell
   *
   * =====================================================================
   */
  public void gray_record_cell(grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_record_cell: ras.invalid: %b, ras.area: %x, ras.cover: %x\n", worker.invalid, worker.area, worker.cover));

    if (!worker.invalid && (worker.area | worker.cover) != 0) {
      TCell cell = gray_find_cell(worker);

      cell.area  += worker.area;
      cell.cover += worker.cover;
................................................................................
   * . the new horizontal position must be strictly less than max_ex
   *
   * Note that if a cell is to the left of the clipping region, it is
   * actually set to the (min_ex-1) horizontal position.
   *
   * =====================================================================
   */
  private void gray_set_cell(grayTWorkerRec worker, int ex, int ey) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_set_cell: ex: %d, ey: %d, invalid: %b, ras.ex: %d, ras.ey: %d", ex, ey, worker.invalid, worker.ex, worker.ey));
      /* All cells that are on the left of the clipping region go to the */
      /* min_ex - 1 horizontal position.                                 */
    ey -= worker.min_ey;
    if (ex > worker.max_ex) {
      ex = worker.max_ex;
    }
................................................................................
  }

  /* =====================================================================
   *    gray_start_cell
   *
   * =====================================================================
   */
  private void gray_start_cell(grayTWorkerRec worker, int ex, int ey) {
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_start_cell: ex: %d, ey: %d", ex, ey));

    if (ex > worker.max_ex) {
      ex = worker.max_ex;
    }
    if (ex < worker.min_ex) {
      ex = worker.min_ex - 1;
................................................................................


  /* =====================================================================
   *    gray_render_scanline
   *
   * =====================================================================
   */
  private void gray_render_scanline(grayTWorkerRec worker, int ey, int x1, int y1, int x2, int y2) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_render_scanline");
    int ex1;
    int ex2;
    int fx1;
    int fx2;
    int delta;
    int mod;
................................................................................
  }

  /* =====================================================================
   *    gray_render_line
   *
   * =====================================================================
   */
  private void gray_render_line(grayTWorkerRec worker, int to_x, int to_y) {
    int ey1;
    int ey2;
    int fy1;
    int fy2;
    int mod;
    int dx;
    int dy;
................................................................................
  }

  /* =====================================================================
   *    gray_render_conic
   *
   * =====================================================================
   */
  private void gray_render_conic(FTVectorRec control, FTVectorRec to, grayTWorkerRec worker) {
    int dx;
    int dy;
    int min;
    int max;
    int y;
    int top;
    int level;
................................................................................
  }

  /* =====================================================================
   *    gray_render_cubic
   *
   * =====================================================================
   */
  private void gray_render_cubic(FTVectorRec control1, FTVectorRec control2, FTVectorRec to, grayTWorkerRec worker) {
    FTVectorRec[] arc;
    FTReference<FTVectorRec[]> arc_ref = new FTReference<FTVectorRec[]>();
    int arcIdx = 0;
    int min;
    int max;
    int y;
    boolean noSplit = false;
................................................................................
  }

  /* =====================================================================
   *    gray_compute_cbox
   *
   * =====================================================================
   */
  public void gray_compute_cbox(grayTWorkerRec worker) {
    FTOutlineRec outline = worker.outline;
    FTVectorRec vec;
    int vecIdx = 0;
    int limit = outline.getN_points();

Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_compute_cbox"));
    if (outline.getN_points() <= 0) {
................................................................................
    worker.outline = outline;
  }


  /* ==================== moveTo ===================================== */
  @Override
  public FTError.ErrorTag moveTo(FTVectorRec point, Object user) {
    return gray_move_to(point, (grayTWorkerRec)user);
  }

  /* ==================== lineTo ===================================== */
  @Override
  public FTError.ErrorTag lineTo(FTVectorRec point, Object user) {
    return gray_line_to(point, (grayTWorkerRec)user);
  }

  /* ==================== conicTo ===================================== */
  @Override
  public FTError.ErrorTag conicTo(FTVectorRec control, FTVectorRec point, Object user) {
    return gray_conic_to(control, point, (grayTWorkerRec)user);
  }

  /* ==================== cubicTo ===================================== */
  @Override
  public FTError.ErrorTag cubicTo(FTVectorRec control1, FTVectorRec control2, FTVectorRec point, Object user) {
    return gray_cubic_to(control1, control2, point, (grayTWorkerRec)user);
  }

}

Changes to aftraster/FTSmoothRendererClass.java.

299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
...
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
...
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
...
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
...
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
...
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
...
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
...
912
913
914
915
916
917
918
919
920
921
922
923
   *    gray_raster_new
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_new(FTReference<FTRasterRec> raster_ref) {
Debug(0, DebugTag.DBG_INIT, TAG, "gray_raster_new");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    grayTRaster raster = null;
    raster_ref.Set(null);
    raster = new grayTRaster();
    if (raster != null) {
      raster_ref.Set(raster);
    }
    return error;
  }

  /* =====================================================================
   *    gray_raster_reset
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_reset(FTRasterRec raster_param, byte[] pool_base, int pool_size) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    grayTRaster raster = (grayTRaster)raster_param;

Debug(0, DebugTag.DBG_RENDER, TAG, "gray_raster_reset");
    if (raster != null) {
      if (pool_base != null) {
        grayTWorker worker =  new grayTWorker();
        raster.buffer = pool_base;
        raster.buffer_size = pool_size;
//          raster.band_size = (int)raster.buffer_size / sizeof(TCell) * 8;
        raster.band_size = (int)raster.buffer_size / 20;  // FIXME!!!
        raster.worker = worker;
      } else {
        raster.buffer = null;
................................................................................
  /* =====================================================================
   *    gray_raster_render
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_render(FTRasterRec raster_param, FTRasterParamsRec params) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_raster_render");
    grayTRaster raster = (grayTRaster)raster_param;
    FTOutlineRec outline = (FTOutlineRec)params.getSource();
    FTBitmapRec target_map = params.getTarget();
    grayTWorker worker;

    if (raster == null || raster.buffer == null || raster.buffer_size == 0) {
      return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
    }
    if (outline == null) {
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
    }
................................................................................
  }

  /* =====================================================================
   *    gray_render_span
   *
   * =====================================================================
   */
  private void gray_render_span(int y, int count, FTSpanRec[] spans, grayTWorker worker) {
    int spansIdx = 0;
    int pIdx;
    int qIdx;
    FTBitmapRec map = worker.target;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_render_span y: %d, count: %d", y, count));

    /* first of all, compute the scanline offset */
................................................................................
  }

  /* =====================================================================
   *    gray_init_cells
   *
   * =====================================================================
   */
  private void gray_init_cells(grayTWorker worker, byte[] buffer, int byte_size) {
    Debug(0, DebugTag.DBG_RENDER, TAG, "+++ gray_init_cells");

    worker.buffer = buffer;
    worker.buffer_size = byte_size;
    worker.ycells = new TCell[(int)byte_size / 10];
    worker.cells = null;
    worker.max_cells = 0;
................................................................................
  }

  /* =====================================================================
   *    gray_convert_glyph_inner
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_convert_glyph_inner(grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_convert_glyph_inner");
    func_interface = new FTGrayOutlineFuncsClass();
    FTReference<FTOutlineRec> outline_ref = new FTReference<FTOutlineRec>();
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

//      if (ft_setjmp(ras.jump_buffer) == 0) {
    error = worker.outline.FTOutlineDecompose((FTOutlineFuncs)func_interface, worker);
................................................................................
  }

  /* =====================================================================
   *    gray_hline
   *
   * =====================================================================
   */
  private void gray_hline(grayTWorker worker, int x, int y, int area, int acount) {
    Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_hline: x: %d, y: %d, area: 0x%08x, acount: %d", x, y, area, acount));
    int coverage = 0;
    int spanIdx = 0;

      /* compute the coverage line's coverage, depending on the    */
      /* outline fill rule                                         */
      /*                                                           */
................................................................................
        span.setLen(span.getLen() + acount);
        worker.gray_spans[count - 1] = span;
        return;
      }
      if (worker.span_y != y || count >= FTSpanRec.FT_MAX_GRAY_SPANS) {
        if (count > 0) {
          worker.renderSpan(worker.span_y, count, worker.gray_spans,
              (grayTWorker)worker.render_span_data);
        }
        if (count > 0) {
          int  n;
          StringBuffer str = new StringBuffer();

          str.append(String.format("y = %3d ", worker.span_y));
          for (n = 0; n < count; n++) {
................................................................................
  }

  /* =====================================================================
   *    gray_sweep
   *
   * =====================================================================
   */
  public void gray_sweep(grayTWorker worker, FTBitmapRec target) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_sweep");
    int  yindex;

    if (worker.num_cells == 0) {
      return;
    }
    worker.num_gray_spans = 0;
................................................................................
      }
      if (cover != 0) {
        gray_hline(worker, x, yindex, cover * (RasterUtil.ONE_PIXEL() * 2), worker.count_ex - x);
      }
    }
    if (worker.num_gray_spans > 0) {
      worker.renderSpan(worker.span_y, worker.num_gray_spans,
          worker.gray_spans, (grayTWorker)worker.render_span_data);
    }
    if (worker.num_gray_spans > 0) {
      FTSpanRec span;
      int spanIdx = 0;
      int n;
      StringBuffer str = new StringBuffer("");

................................................................................
  }

  /* =====================================================================
   *    gray_convert_glyph
   *
   * =====================================================================
   */
  public FTError.ErrorTag gray_convert_glyph(grayTWorker worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_convert_glyph");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    grayTBand[] bands = new grayTBand[40];
    int bandIdx = 0;
    int n;
    int i;
    int num_bands;
    int min;
    int max;
    int max_y;
    FTBBoxRec clip;
    boolean reduceBands = false;

    for (i = 0; i < 40; i++) {
      bands[i] = new grayTBand();
    }

      /* Set up state in the raster object */
    func_interface.gray_compute_cbox(worker);
      /* clip to target bitmap, exit if nothing to do */
    clip = worker.clip_box;
    if (worker.max_ex <= clip.getxMin() || worker.min_ex >= clip.getxMax() ||
................................................................................
  /* ==================== rasterDone ===================================== */
  @Override
  public FTError.ErrorTag rasterDone(FTRasterRec raster) {
    return gray_raster_done();
  }

  /* ==================== grayRenderSpan ===================================== */
  public void grayRenderSpan(int y, int count, FTSpanRec[] spans, grayTWorker worker) {
    gray_render_span(y, count, spans, worker);
  }

}







|

|













|




|







 







|


|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|


|











|







 







|




299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
...
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
...
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
...
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
...
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
...
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
...
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
...
912
913
914
915
916
917
918
919
920
921
922
923
   *    gray_raster_new
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_new(FTReference<FTRasterRec> raster_ref) {
Debug(0, DebugTag.DBG_INIT, TAG, "gray_raster_new");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    grayTRasterRec raster = null;
    raster_ref.Set(null);
    raster = new grayTRasterRec();
    if (raster != null) {
      raster_ref.Set(raster);
    }
    return error;
  }

  /* =====================================================================
   *    gray_raster_reset
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_reset(FTRasterRec raster_param, byte[] pool_base, int pool_size) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    grayTRasterRec raster = (grayTRasterRec)raster_param;

Debug(0, DebugTag.DBG_RENDER, TAG, "gray_raster_reset");
    if (raster != null) {
      if (pool_base != null) {
        grayTWorkerRec worker =  new grayTWorkerRec();
        raster.buffer = pool_base;
        raster.buffer_size = pool_size;
//          raster.band_size = (int)raster.buffer_size / sizeof(TCell) * 8;
        raster.band_size = (int)raster.buffer_size / 20;  // FIXME!!!
        raster.worker = worker;
      } else {
        raster.buffer = null;
................................................................................
  /* =====================================================================
   *    gray_raster_render
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_render(FTRasterRec raster_param, FTRasterParamsRec params) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_raster_render");
    grayTRasterRec raster = (grayTRasterRec)raster_param;
    FTOutlineRec outline = (FTOutlineRec)params.getSource();
    FTBitmapRec target_map = params.getTarget();
    grayTWorkerRec worker;

    if (raster == null || raster.buffer == null || raster.buffer_size == 0) {
      return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
    }
    if (outline == null) {
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
    }
................................................................................
  }

  /* =====================================================================
   *    gray_render_span
   *
   * =====================================================================
   */
  private void gray_render_span(int y, int count, FTSpanRec[] spans, grayTWorkerRec worker) {
    int spansIdx = 0;
    int pIdx;
    int qIdx;
    FTBitmapRec map = worker.target;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_render_span y: %d, count: %d", y, count));

    /* first of all, compute the scanline offset */
................................................................................
  }

  /* =====================================================================
   *    gray_init_cells
   *
   * =====================================================================
   */
  private void gray_init_cells(grayTWorkerRec worker, byte[] buffer, int byte_size) {
    Debug(0, DebugTag.DBG_RENDER, TAG, "+++ gray_init_cells");

    worker.buffer = buffer;
    worker.buffer_size = byte_size;
    worker.ycells = new TCell[(int)byte_size / 10];
    worker.cells = null;
    worker.max_cells = 0;
................................................................................
  }

  /* =====================================================================
   *    gray_convert_glyph_inner
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_convert_glyph_inner(grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_convert_glyph_inner");
    func_interface = new FTGrayOutlineFuncsClass();
    FTReference<FTOutlineRec> outline_ref = new FTReference<FTOutlineRec>();
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

//      if (ft_setjmp(ras.jump_buffer) == 0) {
    error = worker.outline.FTOutlineDecompose((FTOutlineFuncs)func_interface, worker);
................................................................................
  }

  /* =====================================================================
   *    gray_hline
   *
   * =====================================================================
   */
  private void gray_hline(grayTWorkerRec worker, int x, int y, int area, int acount) {
    Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_hline: x: %d, y: %d, area: 0x%08x, acount: %d", x, y, area, acount));
    int coverage = 0;
    int spanIdx = 0;

      /* compute the coverage line's coverage, depending on the    */
      /* outline fill rule                                         */
      /*                                                           */
................................................................................
        span.setLen(span.getLen() + acount);
        worker.gray_spans[count - 1] = span;
        return;
      }
      if (worker.span_y != y || count >= FTSpanRec.FT_MAX_GRAY_SPANS) {
        if (count > 0) {
          worker.renderSpan(worker.span_y, count, worker.gray_spans,
              (grayTWorkerRec)worker.render_span_data);
        }
        if (count > 0) {
          int  n;
          StringBuffer str = new StringBuffer();

          str.append(String.format("y = %3d ", worker.span_y));
          for (n = 0; n < count; n++) {
................................................................................
  }

  /* =====================================================================
   *    gray_sweep
   *
   * =====================================================================
   */
  public void gray_sweep(grayTWorkerRec worker, FTBitmapRec target) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_sweep");
    int  yindex;

    if (worker.num_cells == 0) {
      return;
    }
    worker.num_gray_spans = 0;
................................................................................
      }
      if (cover != 0) {
        gray_hline(worker, x, yindex, cover * (RasterUtil.ONE_PIXEL() * 2), worker.count_ex - x);
      }
    }
    if (worker.num_gray_spans > 0) {
      worker.renderSpan(worker.span_y, worker.num_gray_spans,
          worker.gray_spans, (grayTWorkerRec)worker.render_span_data);
    }
    if (worker.num_gray_spans > 0) {
      FTSpanRec span;
      int spanIdx = 0;
      int n;
      StringBuffer str = new StringBuffer("");

................................................................................
  }

  /* =====================================================================
   *    gray_convert_glyph
   *
   * =====================================================================
   */
  public FTError.ErrorTag gray_convert_glyph(grayTWorkerRec worker) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_convert_glyph");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    grayTBandRec[] bands = new grayTBandRec[40];
    int bandIdx = 0;
    int n;
    int i;
    int num_bands;
    int min;
    int max;
    int max_y;
    FTBBoxRec clip;
    boolean reduceBands = false;

    for (i = 0; i < 40; i++) {
      bands[i] = new grayTBandRec();
    }

      /* Set up state in the raster object */
    func_interface.gray_compute_cbox(worker);
      /* clip to target bitmap, exit if nothing to do */
    clip = worker.clip_box;
    if (worker.max_ex <= clip.getxMin() || worker.min_ex >= clip.getxMax() ||
................................................................................
  /* ==================== rasterDone ===================================== */
  @Override
  public FTError.ErrorTag rasterDone(FTRasterRec raster) {
    return gray_raster_done();
  }

  /* ==================== grayRenderSpan ===================================== */
  public void grayRenderSpan(int y, int count, FTSpanRec[] spans, grayTWorkerRec worker) {
    gray_render_span(y, count, spans, worker);
  }

}

Name change from aftraster/grayTBand.java to aftraster/grayTBandRec.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  /* ===================================================================== */
  /*    grayTBand                                                          */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

public class grayTBand extends FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "grayTBand";

    public short min = 0;   /* band's minimum */
    public short max = 0;   /* band's maximum */

    /* ==================== grayTBand ================================== */
    public grayTBand() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";







|









|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  /* ===================================================================== */
  /*    grayTBand                                                          */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

public class grayTBandRec extends FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "grayTBand";

    public short min = 0;   /* band's minimum */
    public short max = 0;   /* band's maximum */

    /* ==================== grayTBand ================================== */
    public grayTBandRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

Name change from aftraster/grayTRaster.java to aftraster/grayTRasterRec.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.apwtcl.apwfreetypelib.aftraster;

  /* ===================================================================== */
  /*    grayTRaster                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class grayTRaster extends FTRasterRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "grayTRaster";

    public int band_size = 0;
    public grayTWorker worker = null;

    /* ==================== grayTRaster ================================== */
    public grayTRaster() {
      oid++;
      id = oid;
    }
    
    /* ==================== grayTRaster ================================== */
    public grayTRaster(FTRasterRec raster_rec) {
      oid++;
      id = oid;
      this.buffer = raster_rec.buffer;
      this.buffer_size = raster_rec.buffer_size;
    }
    
    /* ==================== mySelf ================================== */







|






|


|





|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.apwtcl.apwfreetypelib.aftraster;

  /* ===================================================================== */
  /*    grayTRaster                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class grayTRasterRec extends FTRasterRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "grayTRaster";

    public int band_size = 0;
    public grayTWorkerRec worker = null;

    /* ==================== grayTRaster ================================== */
    public grayTRasterRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== grayTRaster ================================== */
    public grayTRasterRec(FTRasterRec raster_rec) {
      oid++;
      id = oid;
      this.buffer = raster_rec.buffer;
      this.buffer_size = raster_rec.buffer_size;
    }
    
    /* ==================== mySelf ================================== */

Name change from aftraster/grayTWorker.java to aftraster/grayTWorkerRec.java.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import org.apwtcl.apwfreetypelib.aftbase.FTBBoxRec;
import org.apwtcl.apwfreetypelib.aftbase.FTBitmapRec;
import org.apwtcl.apwfreetypelib.aftbase.FTOutlineRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;
import org.apwtcl.apwfreetypelib.aftutil.FTVectorRec;

public class grayTWorker extends FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "grayTWorker";
    private final static int MaxBezier = 32;

    public int ex;
................................................................................
//    public ft_jmp_buf jump_buffer;
    public Object buffer;
    public int buffer_size;
    public TCell[] ycells;
    public int ycount;

    /* ==================== grayTWorker ================================== */
    public grayTWorker() {
      int i;

      oid++;
      id = oid;
      target = new FTBitmapRec();
      outline = new FTOutlineRec();
      clip_box = new FTBBoxRec();
................................................................................

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

  public FTError.ErrorTag renderSpan(int y, int count, FTSpanRec[] spans, grayTWorker worker) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    Log.e(TAG, "renderSpan not yet implemented");
    return error;
  }

}







|







 







|







 







|






23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import org.apwtcl.apwfreetypelib.aftbase.FTBBoxRec;
import org.apwtcl.apwfreetypelib.aftbase.FTBitmapRec;
import org.apwtcl.apwfreetypelib.aftbase.FTOutlineRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;
import org.apwtcl.apwfreetypelib.aftutil.FTVectorRec;

public class grayTWorkerRec extends FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "grayTWorker";
    private final static int MaxBezier = 32;

    public int ex;
................................................................................
//    public ft_jmp_buf jump_buffer;
    public Object buffer;
    public int buffer_size;
    public TCell[] ycells;
    public int ycount;

    /* ==================== grayTWorker ================================== */
    public grayTWorkerRec() {
      int i;

      oid++;
      id = oid;
      target = new FTBitmapRec();
      outline = new FTOutlineRec();
      clip_box = new FTBBoxRec();
................................................................................

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

  public FTError.ErrorTag renderSpan(int y, int count, FTSpanRec[] spans, grayTWorkerRec worker) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    Log.e(TAG, "renderSpan not yet implemented");
    return error;
  }

}