diff options
author | Carl Worth <cworth@cworth.org> | 2006-05-04 01:45:41 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2006-05-04 01:45:41 -0700 |
commit | a6b1b014bbd12be0f20c44d38d8847181be6d3ae (patch) | |
tree | ce01dacaf9262eb98aa365d960cb19a1a1552e5e /src/cairo-path.c | |
parent | 40b39dddf9cd919fb2f456a8e296a60cc8296fbf (diff) | |
download | cairo-a6b1b014bbd12be0f20c44d38d8847181be6d3ae.tar.gz |
Implement the device_offset functionality at surface, not gstate layer
This is a mega-patch that has the advantage that the entire test suite
passes both immediately before and immediately after this commit.
The disadvantage of the mega-patch is that it does not reflect the
development history of the device-offset branch, (with its various
fumblings and flailings). To capture that history, we will next merge
in that branch.
Diffstat (limited to 'src/cairo-path.c')
-rw-r--r-- | src/cairo-path.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/cairo-path.c b/src/cairo-path.c index 7358bee53..5c94ad901 100644 --- a/src/cairo-path.c +++ b/src/cairo-path.c @@ -568,3 +568,49 @@ _cairo_path_fixed_interpret (cairo_path_fixed_t *path, return CAIRO_STATUS_SUCCESS; } + +static void +_cairo_path_fixed_offset_and_scale (cairo_path_fixed_t *path, + cairo_fixed_t offx, + cairo_fixed_t offy, + cairo_fixed_t scalex, + cairo_fixed_t scaley) +{ + cairo_path_arg_buf_t *arg_buf = path->arg_buf_head; + int i; + cairo_int64_t i64temp; + cairo_fixed_t fixedtemp; + + while (arg_buf) { + for (i = 0; i < arg_buf->num_points; i++) { + if (scalex == CAIRO_FIXED_ONE) { + arg_buf->points[i].x += offx; + } else { + fixedtemp = arg_buf->points[i].x + offx; + i64temp = _cairo_int32x32_64_mul (fixedtemp, scalex); + arg_buf->points[i].x = _cairo_int64_to_int32(_cairo_int64_rsl (i64temp, 16)); + } + + if (scaley == CAIRO_FIXED_ONE) { + arg_buf->points[i].y += offy; + } else { + fixedtemp = arg_buf->points[i].y + offy; + i64temp = _cairo_int32x32_64_mul (fixedtemp, scaley); + arg_buf->points[i].y = _cairo_int64_to_int32(_cairo_int64_rsl (i64temp, 16)); + } + } + + arg_buf = arg_buf->next; + } +} + +void +_cairo_path_fixed_offset (cairo_path_fixed_t *path, + cairo_fixed_t offx, + cairo_fixed_t offy) +{ + _cairo_path_fixed_offset_and_scale (path, offx, offy, + CAIRO_FIXED_ONE, + CAIRO_FIXED_ONE); +} + |