smooth: Fix some data types mismatching with their sources.

This commit is contained in:
suzuki toshiya 2009-08-01 00:32:08 +09:00
parent c579dc4391
commit e45e052279
2 changed files with 46 additions and 17 deletions

View File

@ -1,3 +1,32 @@
2009-07-31 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-31 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
cff: Fix some data types mismatching with their sources.

View File

@ -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;