mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-24 13:50:41 +02:00
[quartz] fix floating point precision issue (#10531)
This ensures that error due to double-to-float conversion does not accumulate; the position of any glyph will be off by at most one double-to-float conversion error.
This commit is contained in:
parent
106f859045
commit
d801aa59f8
1 changed files with 8 additions and 6 deletions
|
|
@ -1314,8 +1314,8 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
|
|||
cg_advances = (CGSize*) malloc(sizeof(CGSize) * num_glyphs);
|
||||
}
|
||||
|
||||
double xprev = glyphs[0].x;
|
||||
double yprev = glyphs[0].y;
|
||||
float xprev = glyphs[0].x;
|
||||
float yprev = glyphs[0].y;
|
||||
|
||||
cg_glyphs[0] = glyphs[0].index;
|
||||
cg_advances[0].width = 0;
|
||||
|
|
@ -1323,10 +1323,12 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
|
|||
|
||||
for (i = 1; i < num_glyphs; i++) {
|
||||
cg_glyphs[i] = glyphs[i].index;
|
||||
cg_advances[i-1].width = glyphs[i].x - xprev;
|
||||
cg_advances[i-1].height = glyphs[i].y - yprev;
|
||||
xprev = glyphs[i].x;
|
||||
yprev = glyphs[i].y;
|
||||
float xf = glyphs[i].x;
|
||||
float yf = glyphs[i].y;
|
||||
cg_advances[i-1].width = xf - xprev;
|
||||
cg_advances[i-1].height = yf - yprev;
|
||||
xprev = xf;
|
||||
yprev = yf;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue