2121
2222#include " elst.h"
2323#include " errcode.h" // for ASSERT_HOST
24+ #include " tesstypes.h" // for TDimension
2425
2526#include < tesseract/export.h> // for DLLSYM
2627
@@ -43,7 +44,7 @@ class ICOORD {
4344 // / constructor
4445 // /@param xin x value
4546 // /@param yin y value
46- ICOORD (int16_t xin, int16_t yin) {
47+ ICOORD (TDimension xin, TDimension yin) {
4748 xcoord = xin;
4849 ycoord = yin;
4950 }
@@ -54,20 +55,20 @@ class ICOORD {
5455 bool Serialize (TFile *f) const ;
5556
5657 // / access function
57- int16_t x () const {
58+ TDimension x () const {
5859 return xcoord;
5960 }
6061 // / access_function
61- int16_t y () const {
62+ TDimension y () const {
6263 return ycoord;
6364 }
6465
6566 // / rewrite function
66- void set_x (int16_t xin) {
67+ void set_x (TDimension xin) {
6768 xcoord = xin; // write new value
6869 }
6970 // / rewrite function
70- void set_y (int16_t yin) { // value to set
71+ void set_y (TDimension yin) { // value to set
7172 ycoord = yin;
7273 }
7374
@@ -128,15 +129,15 @@ class ICOORD {
128129 // / cross product
129130 friend int32_t operator *(const ICOORD &, const ICOORD &);
130131 // / multiply
131- friend ICOORD operator *(const ICOORD &, int16_t );
132+ friend ICOORD operator *(const ICOORD &, TDimension );
132133 // / multiply
133- friend ICOORD operator *(int16_t , const ICOORD &);
134+ friend ICOORD operator *(TDimension , const ICOORD &);
134135 // / multiply
135- friend ICOORD &operator *=(ICOORD &, int16_t );
136+ friend ICOORD &operator *=(ICOORD &, TDimension );
136137 // / divide
137- friend ICOORD operator /(const ICOORD &, int16_t );
138+ friend ICOORD operator /(const ICOORD &, TDimension );
138139 // / divide
139- friend ICOORD &operator /=(ICOORD &, int16_t );
140+ friend ICOORD &operator /=(ICOORD &, TDimension );
140141 // / rotate
141142 // /@param vec by vector
142143 void rotate (const FCOORD &vec);
@@ -155,8 +156,8 @@ class ICOORD {
155156 bool DeSerialize (bool swap, FILE *fp);
156157
157158protected:
158- int16_t xcoord; // /< x value
159- int16_t ycoord; // /< y value
159+ TDimension xcoord; // /< x value
160+ TDimension ycoord; // /< y value
160161};
161162
162163class ICOORDELT : public ELIST_LINK ,
@@ -171,7 +172,7 @@ class ICOORDELT : public ELIST_LINK,
171172 // / constructor
172173 // /@param xin x value
173174 // /@param yin y value
174- ICOORDELT (int16_t xin, int16_t yin) {
175+ ICOORDELT (TDimension xin, TDimension yin) {
175176 xcoord = xin;
176177 ycoord = yin;
177178 }
@@ -438,7 +439,7 @@ inline int32_t operator*( // cross product
438439
439440inline ICOORD operator *( // scalar multiply
440441 const ICOORD &op1, // operands
441- int16_t scale) {
442+ TDimension scale) {
442443 ICOORD result; // output
443444
444445 result.xcoord = op1.xcoord * scale;
@@ -447,7 +448,7 @@ inline ICOORD operator*( // scalar multiply
447448}
448449
449450inline ICOORD operator *( // scalar multiply
450- int16_t scale,
451+ TDimension scale,
451452 const ICOORD &op1 // operands
452453) {
453454 ICOORD result; // output
@@ -465,7 +466,7 @@ inline ICOORD operator*( // scalar multiply
465466
466467inline ICOORD &operator *=( // scalar multiply
467468 ICOORD &op1, // operands
468- int16_t scale) {
469+ TDimension scale) {
469470 op1.xcoord *= scale;
470471 op1.ycoord *= scale;
471472 return op1;
@@ -479,7 +480,7 @@ inline ICOORD &operator*=( // scalar multiply
479480
480481inline ICOORD operator /( // scalar divide
481482 const ICOORD &op1, // operands
482- int16_t scale) {
483+ TDimension scale) {
483484 ICOORD result; // output
484485
485486 result.xcoord = op1.xcoord / scale;
@@ -495,7 +496,7 @@ inline ICOORD operator/( // scalar divide
495496
496497inline ICOORD &operator /=( // scalar divide
497498 ICOORD &op1, // operands
498- int16_t scale) {
499+ TDimension scale) {
499500 op1.xcoord /= scale;
500501 op1.ycoord /= scale;
501502 return op1;
@@ -509,8 +510,8 @@ inline ICOORD &operator/=( // scalar divide
509510
510511inline void ICOORD::rotate ( // rotate by vector
511512 const FCOORD &vec) {
512- auto tmp = static_cast <int16_t >(std::floor (xcoord * vec.x () - ycoord * vec.y () + 0 .5f ));
513- ycoord = static_cast <int16_t >(std::floor (ycoord * vec.x () + xcoord * vec.y () + 0 .5f ));
513+ auto tmp = static_cast <TDimension >(std::floor (xcoord * vec.x () - ycoord * vec.y () + 0 .5f ));
514+ ycoord = static_cast <TDimension >(std::floor (ycoord * vec.x () + xcoord * vec.y () + 0 .5f ));
514515 xcoord = tmp;
515516}
516517
0 commit comments