mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 21:08:10 +02:00
Rename _cairo_matrix_compute_scale_factors to _cairo_matrix_compute_basis_scale_factors
This commit is contained in:
parent
f7a91e5bd7
commit
22552dae51
7 changed files with 31 additions and 18 deletions
|
|
@ -642,7 +642,7 @@ _compute_transform (cairo_ft_font_transform_t *sf,
|
|||
* freetype's transformation.
|
||||
*/
|
||||
|
||||
status = _cairo_matrix_compute_scale_factors (scale,
|
||||
status = _cairo_matrix_compute_basis_scale_factors (scale,
|
||||
&x_scale, &y_scale,
|
||||
1);
|
||||
if (status)
|
||||
|
|
|
|||
|
|
@ -524,10 +524,23 @@ _cairo_matrix_compute_determinant (const cairo_matrix_t *matrix)
|
|||
return a*d - b*c;
|
||||
}
|
||||
|
||||
/* Compute the amount that each basis vector is scaled by. */
|
||||
/**
|
||||
* _cairo_matrix_compute_basis_scale_factors:
|
||||
* @matrix: a matrix
|
||||
* @basis_scale: the scale factor in the direction of basis
|
||||
* @normal_scale: the scale factor in the direction normal to the basis
|
||||
* @x_basis: basis to use. X basis if true, Y basis otherwise.
|
||||
*
|
||||
* Computes |Mv| and det(M)/|Mv| for v=[1,0] if x_basis is true, and v=[0,1]
|
||||
* otherwise, and M is @matrix.
|
||||
*
|
||||
* Return value: the scale factor of @matrix on the height of the font,
|
||||
* or 1.0 if @matrix is %NULL.
|
||||
**/
|
||||
cairo_status_t
|
||||
_cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
||||
double *sx, double *sy, int x_major)
|
||||
_cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
|
||||
double *basis_scale, double *normal_scale,
|
||||
cairo_bool_t x_basis)
|
||||
{
|
||||
double det;
|
||||
|
||||
|
|
@ -538,11 +551,11 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
|||
|
||||
if (det == 0)
|
||||
{
|
||||
*sx = *sy = 0;
|
||||
*basis_scale = *normal_scale = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double x = x_major != 0;
|
||||
double x = x_basis != 0;
|
||||
double y = x == 0;
|
||||
double major, minor;
|
||||
|
||||
|
|
@ -557,15 +570,15 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
|||
minor = det / major;
|
||||
else
|
||||
minor = 0.0;
|
||||
if (x_major)
|
||||
if (x_basis)
|
||||
{
|
||||
*sx = major;
|
||||
*sy = minor;
|
||||
*basis_scale = major;
|
||||
*normal_scale = minor;
|
||||
}
|
||||
else
|
||||
{
|
||||
*sx = minor;
|
||||
*sy = major;
|
||||
*basis_scale = minor;
|
||||
*normal_scale = major;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ _cairo_matrix_to_unit_quartz_matrix (const cairo_matrix_t *m, CGAffineTransform
|
|||
double xscale, yscale;
|
||||
cairo_status_t status;
|
||||
|
||||
status = _cairo_matrix_compute_scale_factors (m, &xscale, &yscale, 1);
|
||||
status = _cairo_matrix_compute_basis_scale_factors (m, &xscale, &yscale, 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ _cairo_quartz_init_glyph_metrics (cairo_quartz_scaled_font_t *font,
|
|||
!CGFontGetGlyphBBoxesPtr (font_face->cgFont, &glyph, 1, &bbox))
|
||||
goto FAIL;
|
||||
|
||||
status = _cairo_matrix_compute_scale_factors (&font->base.scale,
|
||||
status = _cairo_matrix_compute_basis_scale_factors (&font->base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
goto FAIL;
|
||||
|
|
@ -632,7 +632,7 @@ _cairo_quartz_init_glyph_surface (cairo_quartz_scaled_font_t *font,
|
|||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
status = _cairo_matrix_compute_scale_factors (&font->base.scale,
|
||||
status = _cairo_matrix_compute_basis_scale_factors (&font->base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ _cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
|
|||
cairo_status_t status;
|
||||
double font_scale_x, font_scale_y;
|
||||
|
||||
status = _cairo_matrix_compute_scale_factors (&scaled_font->font_matrix,
|
||||
status = _cairo_matrix_compute_basis_scale_factors (&scaled_font->font_matrix,
|
||||
&font_scale_x, &font_scale_y,
|
||||
1);
|
||||
if (status)
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ _cairo_user_font_face_scaled_font_create (void *abstract_
|
|||
double fixed_scale, x_scale, y_scale;
|
||||
|
||||
user_scaled_font->extent_scale = user_scaled_font->base.scale_inverse;
|
||||
status = _cairo_matrix_compute_scale_factors (&user_scaled_font->extent_scale,
|
||||
status = _cairo_matrix_compute_basis_scale_factors (&user_scaled_font->extent_scale,
|
||||
&x_scale, &y_scale,
|
||||
1);
|
||||
if (status == CAIRO_STATUS_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
|
|||
sc->xx, sc->yx, sc->xy, sc->yy, 0, 0);
|
||||
|
||||
if (!scaled_font->preserve_axes) {
|
||||
status = _cairo_matrix_compute_scale_factors (&scaled_font->logical_to_device,
|
||||
status = _cairo_matrix_compute_basis_scale_factors (&scaled_font->logical_to_device,
|
||||
&scaled_font->x_scale, &scaled_font->y_scale,
|
||||
TRUE); /* XXX: Handle vertical text */
|
||||
if (status)
|
||||
|
|
|
|||
|
|
@ -2137,7 +2137,7 @@ cairo_private double
|
|||
_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
||||
_cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
|
||||
double *sx, double *sy, int x_major);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue