summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2009-07-03 18:01:29 +0900
committersuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2009-07-03 18:01:29 +0900
commit9a3c169704ee7d6c6e379fe43e7e27460096d569 (patch)
tree4eabdc680798dbc31437ddcafb5d67951608a85c
parent5ac77d159e1a972743064b40827397d9c6dcd954 (diff)
downloadfreetype2-9a3c169704ee7d6c6e379fe43e7e27460096d569.tar.gz
smooth: Fix some data types mismatching with their sources.
-rw-r--r--ChangeLog29
-rw-r--r--src/smooth/ftgrays.c34
2 files changed, 46 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 1991d3d66..2717d728c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ smooth: Fix some data types mismatching with their sources.
+
+ * src/smooth/ftgrays.c: The type of `TCoord' is
+ matched to `TPos', because they are mixed in
+ gray_set_cell(). The type of TCell->x is extended
+ to `TPos', because gray_find_cell() sets it by
+ TWorker.ex. The type of TCell->cover is extended
+ to `TCoord', because gray_render_scanline() adds
+ TCoord value to it. The type of TWork.cover is matched
+ with TCell->cover. The types of
+ TWork.{max_cells,num_cells} are changed to FT_PtrDist,
+ because they are calculated from the memory addresses.
+ The type of TWork.ycount is changed to TPos, because
+ it is calculated from TPos variables.
+ (gray_find_cell): The type of `x' is matched with
+ its initial value ras.ex.
+ (gray_render_scanline): The types of `mod', `lift'
+ and `rem' are changed to TCoord, because their values
+ are set with explicit casts to TCoord. When ras.area
+ is updated by the differential values including
+ `delta', they are explicitly casted to TArea, because
+ the type of `delta' is not TArea but TCoord.
+ (gray_render_line): The type of `mod' is extended
+ from int to TCoord, because (TCoord)dy is added to mod.
+ (gray_hline): The argument `acount' is extended to
+ TCoord, to match with the parameters in the callers.
+
+2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
cff: Fix some data types mismatching with their sources.
* src/cff/cffobjs.c (cff_face_init): The type of
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index efb438b4e..ba5541d91 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -275,7 +275,7 @@
/* need to define them to "float" or "double" when experimenting with */
/* new algorithms */
- typedef int TCoord; /* integer scanline/pixel coordinate */
+ typedef long TCoord; /* integer scanline/pixel coordinate */
typedef long TPos; /* sub-pixel coordinate */
/* determine the type used to store cell areas. This normally takes at */
@@ -306,8 +306,8 @@
typedef struct TCell_
{
- int x;
- int cover;
+ TPos x; /* same with TWorker.ex */
+ TCoord cover; /* same with TWorker.cover */
TArea area;
PCell next;
@@ -322,12 +322,12 @@
TPos count_ex, count_ey;
TArea area;
- int cover;
+ TCoord cover;
int invalid;
PCell cells;
- int max_cells;
- int num_cells;
+ FT_PtrDist max_cells;
+ FT_PtrDist num_cells;
TCoord cx, cy;
TPos x, y;
@@ -359,7 +359,7 @@
long buffer_size;
PCell* ycells;
- int ycount;
+ TPos ycount;
} TWorker, *PWorker;
@@ -456,7 +456,7 @@
gray_find_cell( RAS_ARG )
{
PCell *pcell, cell;
- int x = ras.ex;
+ TPos x = ras.ex;
if ( x > ras.count_ex )
@@ -588,9 +588,9 @@
TPos x2,
TCoord y2 )
{
- TCoord ex1, ex2, fx1, fx2, delta;
+ TCoord ex1, ex2, fx1, fx2, delta, mod, lift, rem;
long p, first, dx;
- int incr, lift, mod, rem;
+ int incr;
dx = x2 - x1;
@@ -612,7 +612,7 @@
if ( ex1 == ex2 )
{
delta = y2 - y1;
- ras.area += (TArea)( fx1 + fx2 ) * delta;
+ ras.area += (TArea)(( fx1 + fx2 ) * delta);
ras.cover += delta;
return;
}
@@ -640,7 +640,7 @@
mod += (TCoord)dx;
}
- ras.area += (TArea)( fx1 + first ) * delta;
+ ras.area += (TArea)(( fx1 + first ) * delta);
ras.cover += delta;
ex1 += incr;
@@ -670,7 +670,7 @@
delta++;
}
- ras.area += (TArea)ONE_PIXEL * delta;
+ ras.area += (TArea)(ONE_PIXEL * delta);
ras.cover += delta;
y1 += delta;
ex1 += incr;
@@ -679,7 +679,7 @@
}
delta = y2 - y1;
- ras.area += (TArea)( fx2 + ONE_PIXEL - first ) * delta;
+ ras.area += (TArea)(( fx2 + ONE_PIXEL - first ) * delta);
ras.cover += delta;
}
@@ -692,10 +692,10 @@
gray_render_line( RAS_ARG_ TPos to_x,
TPos to_y )
{
- TCoord ey1, ey2, fy1, fy2;
+ TCoord ey1, ey2, fy1, fy2, mod;
TPos dx, dy, x, x2;
long p, first;
- int delta, rem, mod, lift, incr;
+ int delta, rem, lift, incr;
ey1 = TRUNC( ras.last_ey );
@@ -1231,7 +1231,7 @@
gray_hline( RAS_ARG_ TCoord x,
TCoord y,
TPos area,
- int acount )
+ TCoord acount )
{
FT_Span* span;
int count;