b=358115, expose cairo transform_bounding_box, r=stuart

This commit is contained in:
vladimir%pobox.com 2006-10-26 02:02:36 +00:00
Родитель a57aad3493
Коммит 87199bb79c
5 изменённых файлов: 27 добавлений и 8 удалений

Просмотреть файл

@ -718,7 +718,7 @@ _cairo_gstate_backend_to_user_rectangle (cairo_gstate_t *gstate,
cairo_matrix_multiply (&matrix_inverse, &gstate->ctm_inverse,
&gstate->target->device_transform_inverse);
_cairo_matrix_transform_bounding_box (
cairo_matrix_transform_bounding_box (
&matrix_inverse, x1, y1, &width, &height, is_tight);
*x2 = *x1 + width;

Просмотреть файл

@ -356,10 +356,10 @@ cairo_matrix_transform_point (const cairo_matrix_t *matrix, double *x, double *y
slim_hidden_def(cairo_matrix_transform_point);
void
_cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
double *x, double *y,
double *width, double *height,
cairo_bool_t *is_tight)
cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
double *x, double *y,
double *width, double *height,
cairo_bool_t *is_tight)
{
int i;
double quad_x[4], quad_y[4];
@ -422,6 +422,7 @@ _cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
quad_x[2] == quad_x[0] && quad_y[2] == quad_y[3]);
}
}
slim_hidden_def(cairo_matrix_transform_bounding_box);
static void
_cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar)

Просмотреть файл

@ -1670,6 +1670,12 @@ cairo_public void
cairo_matrix_transform_point (const cairo_matrix_t *matrix,
double *x, double *y);
cairo_public void
cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
double *x, double *y,
double *width, double *height,
cairo_bool_t *is_tight);
/* Functions to be used while debugging (not intended for use in production code) */
cairo_public void
cairo_debug_reset_static_data (void);

Просмотреть файл

@ -2383,6 +2383,7 @@ slim_hidden_proto (cairo_matrix_multiply);
slim_hidden_proto (cairo_matrix_scale);
slim_hidden_proto (cairo_matrix_transform_distance);
slim_hidden_proto (cairo_matrix_transform_point);
slim_hidden_proto (cairo_matrix_transform_bounding_box);
slim_hidden_proto (cairo_matrix_translate);
slim_hidden_proto (cairo_move_to);
slim_hidden_proto (cairo_new_path);

Просмотреть файл

@ -213,7 +213,7 @@ public:
/**
* Transforms a point according to this matrix.
*/
gfxPoint Transform(const gfxPoint point) const {
gfxPoint Transform(const gfxPoint& point) const {
gfxPoint ret = point;
cairo_matrix_transform_point(&mat, &ret.x, &ret.y);
return ret;
@ -223,7 +223,7 @@ public:
* Transform a distance according to this matrix. This does not apply
* any translation components.
*/
gfxSize Transform(const gfxSize size) const {
gfxSize Transform(const gfxSize& size) const {
gfxSize ret = size;
cairo_matrix_transform_distance(&mat, &ret.width, &ret.height);
return ret;
@ -232,11 +232,22 @@ public:
/**
* Transforms both the point and distance according to this matrix.
*/
gfxRect Transform(const gfxRect rect) const {
gfxRect Transform(const gfxRect& rect) const {
gfxRect ret(Transform(rect.pos), Transform(rect.size));
return ret;
}
gfxRect TransformBounds(const gfxRect& rect) const {
double x = rect.pos.x;
double y = rect.pos.y;
double width = rect.size.width;
double height = rect.size.height;
cairo_matrix_transform_bounding_box (&mat, &x, &y, &width, &height, NULL);
return gfxRect(x, y, width, height);
}
/**
* Returns the translation component of this matrix.
*/