apwfreetypelib

Check-in [37d8d05b7b]
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:37d8d05b7b943e33ceda39d4c558279a2603b121
User & Date: arnulf 2015-01-25 16:24:04
Context
2015-01-25
18:02
fixes new code and refactoring. check-in: 5f647f2006 user: arnulf tags: trunk
16:24
fixes and renaming check-in: 37d8d05b7b user: arnulf tags: trunk
16:21
fixes and renaming. check-in: 75a6e99504 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to aftraster/FTGrayOutlineFuncsClass.java.

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
  }

  /* =====================================================================
   *    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;
    boolean isYcell = true;

    if (x > worker.count_ex) {
      x = worker.count_ex;
    }
................................................................................
   *
   * =====================================================================
   */
  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;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_record_cell2: cell.area: %x, cell.cover: %x worker.area: %x, worker.cover: %x\n", cell.area, cell.cover, worker.area, worker.cover));
    }
  }








|



|
|







 







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
  }

  /* =====================================================================
   *    gray_find_cell
   *
   * =====================================================================
   */
  private TCellRec 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;
    TCellRec cell = null;
    TCellRec pcell = null;
    int x = worker.ex;
    boolean useYcells = true;
    boolean isYcell = true;

    if (x > worker.count_ex) {
      x = worker.count_ex;
    }
................................................................................
   *
   * =====================================================================
   */
  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) {
      TCellRec cell = gray_find_cell(worker);

      cell.area  += worker.area;
      cell.cover += worker.cover;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_record_cell2: cell.area: %x, cell.cover: %x worker.area: %x, worker.cover: %x\n", cell.area, cell.cover, worker.area, worker.cover));
    }
  }

Changes to aftraster/FTSmoothRendererClass.java.

493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
...
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
...
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
   * =====================================================================
   */
  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;
    worker.num_cells = 0;
    worker.area = 0;
    worker.cover = 0;
    worker.invalid = true;
  }
................................................................................

    if (worker.num_cells == 0) {
      return;
    }
    worker.num_gray_spans = 0;
    FTTrace.Trace(7, TAG, "gray_sweep: start "+worker.ycount);
    for (yindex = 0; yindex < worker.ycount; yindex++) {
      TCell cell  = worker.ycells[yindex];
      int cover = 0;
      int x = 0;

      for ( ; cell != null; cell = cell.next) {
        int area;

//System.out.println(String.format("cell->next: %d", cell.next == null ? -1 : cell.next.self_idx));
................................................................................
          int yindex;
          int cell_start;
          int cell_end;
          int cellsIdx = 0;

//            worker.ycells = (TCell[])worker.buffer;
          worker.ycount = bands[bandIdx].max - bands[bandIdx].min;
          worker.ycells = new TCell[(int)worker.ycount];
          cell_start = 0;
          cell_end = 1024;
//            cell_start = TCellSize * worker.ycount;
//            cell_mod = cell_start % TCellSize;
//            if (cell_mod > 0) {
//              cell_start += TCellSize - cell_mod;
//            }
//            cell_end = worker.buffer_size;
//            cell_end -= cell_end % TCellSize;
          cells_max = cell_end;
          cellsIdx = cell_start;
          cellsIdx = 0;
          worker.cells = new TCell[(int)cells_max];
          for (int j = 0; j < cells_max; j++) {
            worker.cells[j] = new TCell();
          }
          if (cellsIdx >= cells_max) {
            reduceBands = true;
          }
          if (!reduceBands) {
            worker.max_cells = (int)(cells_max - cellsIdx);
            if (worker.max_cells < 2) {







|







 







|







 







|












|

|







493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
...
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
...
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
   * =====================================================================
   */
  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 TCellRec[(int)byte_size / 10];
    worker.cells = null;
    worker.max_cells = 0;
    worker.num_cells = 0;
    worker.area = 0;
    worker.cover = 0;
    worker.invalid = true;
  }
................................................................................

    if (worker.num_cells == 0) {
      return;
    }
    worker.num_gray_spans = 0;
    FTTrace.Trace(7, TAG, "gray_sweep: start "+worker.ycount);
    for (yindex = 0; yindex < worker.ycount; yindex++) {
      TCellRec cell  = worker.ycells[yindex];
      int cover = 0;
      int x = 0;

      for ( ; cell != null; cell = cell.next) {
        int area;

//System.out.println(String.format("cell->next: %d", cell.next == null ? -1 : cell.next.self_idx));
................................................................................
          int yindex;
          int cell_start;
          int cell_end;
          int cellsIdx = 0;

//            worker.ycells = (TCell[])worker.buffer;
          worker.ycount = bands[bandIdx].max - bands[bandIdx].min;
          worker.ycells = new TCellRec[(int)worker.ycount];
          cell_start = 0;
          cell_end = 1024;
//            cell_start = TCellSize * worker.ycount;
//            cell_mod = cell_start % TCellSize;
//            if (cell_mod > 0) {
//              cell_start += TCellSize - cell_mod;
//            }
//            cell_end = worker.buffer_size;
//            cell_end -= cell_end % TCellSize;
          cells_max = cell_end;
          cellsIdx = cell_start;
          cellsIdx = 0;
          worker.cells = new TCellRec[(int)cells_max];
          for (int j = 0; j < cells_max; j++) {
            worker.cells[j] = new TCellRec();
          }
          if (cellsIdx >= cells_max) {
            reduceBands = true;
          }
          if (!reduceBands) {
            worker.max_cells = (int)(cells_max - cellsIdx);
            if (worker.max_cells < 2) {

Name change from aftraster/TCell.java to aftraster/TCellRec.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
41
42
43
44
45
46
  /* ===================================================================== */
  /*    TCell                                                          */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

    private int id;
    private static String TAG = "TCell";
    public static TCell[] tcells = new TCell[2048];
    public static int tcells_idx = 0;

    public int x;     /* same with grayTWorker.ex    */
    public int cover; /* same with grayTWorker.cover */
    public int area;
    public int nextIdx;
    public TCell next;
    public int self_idx;

    /* ==================== TCell ================================== */
    public TCell() {
      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
41
42
43
44
45
46
  /* ===================================================================== */
  /*    TCell                                                          */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

    private int id;
    private static String TAG = "TCell";
    public static TCellRec[] tcells = new TCellRec[2048];
    public static int tcells_idx = 0;

    public int x;     /* same with grayTWorker.ex    */
    public int cover; /* same with grayTWorker.cover */
    public int area;
    public int nextIdx;
    public TCellRec next;
    public int self_idx;

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

Name change from aftraster/TPoint.java to aftraster/TPointRec.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

    private int id;
    private static String TAG = "ftdemo.TPoint";

    public long x = 0L;
    public long y = 0L;

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







|









|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

    private int id;
    private static String TAG = "ftdemo.TPoint";

    public long x = 0L;
    public long y = 0L;

    /* ==================== ftdemo.TPoint ================================== */
    public TPointRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

Name change from aftraster/TProfile.java to aftraster/TProfileRec.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

    private int id;
    private static String TAG = "ftdemo.TProfile";

    public Long X = 0L;           /* current coordinate during sweep          */
    public int link = -1;         /* link to next profile (various purposes)  */
................................................................................
    public long start = 0L;       /* profile's starting scanline              */
    public Integer countL = 0;    /* number of lines to step before this      */
                                  /* profile becomes drawable                 */
    public int next = -1;         /* next profile in same contour, used       */
                                  /* during drop-out control                  */

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







|







 







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

    private int id;
    private static String TAG = "ftdemo.TProfile";

    public Long X = 0L;           /* current coordinate during sweep          */
    public int link = -1;         /* link to next profile (various purposes)  */
................................................................................
    public long start = 0L;       /* profile's starting scanline              */
    public Integer countL = 0;    /* number of lines to step before this      */
                                  /* profile becomes drawable                 */
    public int next = -1;         /* next profile in same contour, used       */
                                  /* during drop-out control                  */

    /* ==================== ftdemo.TProfile ================================== */
    public TProfileRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

Changes to aftraster/blackTWorkerRec.java.

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
                                     /* == precision_shift+1 for pixmaps    */
  private int[] buff = null;          /* The profiles buffer                 */
  private int sizeBuff = 0;           /* Render pool size                    */
  private int maxBuff = 0;            /* Profiles buffer size                */
  private int top = 0;                /* Current cursor in buffer            */
  private int error = 0;
  private int numTurns = 0;           /* number of Y-turns in outline        */
  private TPoint arc = null;          /* current Bezier arc pointer          */
  private int bWidth = 0;             /* target bitmap width                 */
  private byte[] bTarget = null;      /* target bitmap buffer                */
  private byte[] gTarget = null;      /* target pixmap buffer                */
  private int lastX = 0;
  private int lastY = 0;
  private int minY = 0;
  private int maxY = 0;
  private int num_Profs = 0;          /* current number of profiles          */
  private boolean fresh = false;      /* signals a fresh new profile which   */
                                     /* `start' field must be completed     */
  private boolean joint = false;      /* signals that the last arc ended     */
                                     /* exactly on a scanline.  Allows      */
                                     /* removal of doublets                 */
  private TProfile cProfile = null;   /* current profile                     */
  private TProfile fProfile = null;   /* head of linked list of profiles     */
  private TProfile gProfile = null;   /* contour's first profile in case     */
                                     /* of impact                           */
  private TStates state = null;       /* rendering state                     */
  private FTBitmapRec target = null;  /* description of target bit/pixmap    */
  private FTOutlineRec outline = null;
  private int traceOfs = 0;           /* current offset in target bitmap     */
  private int traceG = 0;             /* current offset in target pixmap     */
  private int traceIncr = 0;          /* sweep's increment in target bitmap  */
................................................................................
  private byte dropOutControl = 0;    /* current drop_out control method     */
  private boolean second_pass = false; /* indicates whether a horizontal pass */
                                     /* should be performed to control      */
                                     /* drop-out accurately when calling    */
                                     /* Render_Glyph.  Note that there is   */
                                     /* no horizontal pass during gray      */
                                     /* rendering.                          */
  private TPoint[] arcs = new TPoint[3 * MaxBezier + 1]; /* The Bezier stack  */
  private blackTBandRec[] band_stack = new blackTBandRec[16]; /* band stack used for sub-banding */
  private int band_top;               /* band stack top                      */

  /* ==================== blackTWorker ================================== */
  public blackTWorkerRec() {
    oid++;
    id = oid;







|













|
|
|







 







|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
                                     /* == precision_shift+1 for pixmaps    */
  private int[] buff = null;          /* The profiles buffer                 */
  private int sizeBuff = 0;           /* Render pool size                    */
  private int maxBuff = 0;            /* Profiles buffer size                */
  private int top = 0;                /* Current cursor in buffer            */
  private int error = 0;
  private int numTurns = 0;           /* number of Y-turns in outline        */
  private TPointRec arc = null;          /* current Bezier arc pointer          */
  private int bWidth = 0;             /* target bitmap width                 */
  private byte[] bTarget = null;      /* target bitmap buffer                */
  private byte[] gTarget = null;      /* target pixmap buffer                */
  private int lastX = 0;
  private int lastY = 0;
  private int minY = 0;
  private int maxY = 0;
  private int num_Profs = 0;          /* current number of profiles          */
  private boolean fresh = false;      /* signals a fresh new profile which   */
                                     /* `start' field must be completed     */
  private boolean joint = false;      /* signals that the last arc ended     */
                                     /* exactly on a scanline.  Allows      */
                                     /* removal of doublets                 */
  private TProfileRec cProfile = null;   /* current profile                     */
  private TProfileRec fProfile = null;   /* head of linked list of profiles     */
  private TProfileRec gProfile = null;   /* contour's first profile in case     */
                                     /* of impact                           */
  private TStates state = null;       /* rendering state                     */
  private FTBitmapRec target = null;  /* description of target bit/pixmap    */
  private FTOutlineRec outline = null;
  private int traceOfs = 0;           /* current offset in target bitmap     */
  private int traceG = 0;             /* current offset in target pixmap     */
  private int traceIncr = 0;          /* sweep's increment in target bitmap  */
................................................................................
  private byte dropOutControl = 0;    /* current drop_out control method     */
  private boolean second_pass = false; /* indicates whether a horizontal pass */
                                     /* should be performed to control      */
                                     /* drop-out accurately when calling    */
                                     /* Render_Glyph.  Note that there is   */
                                     /* no horizontal pass during gray      */
                                     /* rendering.                          */
  private TPointRec[] arcs = new TPointRec[3 * MaxBezier + 1]; /* The Bezier stack  */
  private blackTBandRec[] band_stack = new blackTBandRec[16]; /* band stack used for sub-banding */
  private int band_top;               /* band stack top                      */

  /* ==================== blackTWorker ================================== */
  public blackTWorkerRec() {
    oid++;
    id = oid;

Changes to aftraster/grayTWorkerRec.java.

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    public int min_ey;
    public int max_ey;
    public int count_ex;
    public int count_ey;
    public int area;
    public int cover;
    public boolean invalid;
    public TCell[] cells = null;
    public int max_cells;
    public int num_cells;
    public int cx;
    public int cy;
    public int x;
    public int y;
    public int last_ey;
................................................................................
    public Object render_span_data;
    public int span_y;
    public int band_size;
    public int band_shoot;
//    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++;







|







 







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    public int min_ey;
    public int max_ey;
    public int count_ex;
    public int count_ey;
    public int area;
    public int cover;
    public boolean invalid;
    public TCellRec[] cells = null;
    public int max_cells;
    public int num_cells;
    public int cx;
    public int cy;
    public int x;
    public int y;
    public int last_ey;
................................................................................
    public Object render_span_data;
    public int span_y;
    public int band_size;
    public int band_shoot;
//    public ft_jmp_buf jump_buffer;
    public Object buffer;
    public int buffer_size;
    public TCellRec[] ycells;
    public int ycount;

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

      oid++;