[cairo-commit] 3 commits - .gitlab-ci/ignore-script-argb32.txt src/cairo-surface.c test/reference
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Apr 24 12:26:22 UTC 2022
.gitlab-ci/ignore-script-argb32.txt | 1
dev/null |binary
src/cairo-surface.c | 39 ++++++++++++++++++++---
test/reference/ft-color-font.recording.ref.png |binary
test/reference/ft-color-font.script.xfail.png |binary
test/reference/user-font-color.recording.ref.png |binary
test/reference/user-font-color.script.xfail.png |binary
7 files changed, 34 insertions(+), 6 deletions(-)
New commits:
commit 083ff4b511436a2be5ce27a61a21feb387adc484
Merge: d9a5aa9d9 5018120af
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Sun Apr 24 12:26:20 2022 +0000
Merge branch 'color-font-vector-surface' into 'master'
Paint color glyphs in fallback resolution on vector surfaces
See merge request cairo/cairo!293
commit 5018120af05c4d043cdc2ac59d556865be51a049
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Mar 1 21:43:32 2022 +1030
Update ref images
diff --git a/.gitlab-ci/ignore-script-argb32.txt b/.gitlab-ci/ignore-script-argb32.txt
index 8ea8607c2..e78be546f 100644
--- a/.gitlab-ci/ignore-script-argb32.txt
+++ b/.gitlab-ci/ignore-script-argb32.txt
@@ -23,7 +23,6 @@ linear-gradient-reflect
map-all-to-image
map-bit-to-image
map-to-image-fill
-mesh-pattern
negative-stride-image
overlapping-glyphs
paint-source-alpha
diff --git a/test/reference/ft-color-font.recording.ref.png b/test/reference/ft-color-font.recording.ref.png
new file mode 100644
index 000000000..902a00c17
Binary files /dev/null and b/test/reference/ft-color-font.recording.ref.png differ
diff --git a/test/reference/ft-color-font.script.xfail.png b/test/reference/ft-color-font.script.xfail.png
index c818f36aa..f8b166180 100644
Binary files a/test/reference/ft-color-font.script.xfail.png and b/test/reference/ft-color-font.script.xfail.png differ
diff --git a/test/reference/user-font-color.recording.ref.png b/test/reference/user-font-color.recording.ref.png
new file mode 100644
index 000000000..0b4cb06f5
Binary files /dev/null and b/test/reference/user-font-color.recording.ref.png differ
diff --git a/test/reference/user-font-color.recording.xfail.png b/test/reference/user-font-color.recording.xfail.png
deleted file mode 100644
index 37b8aaa1e..000000000
Binary files a/test/reference/user-font-color.recording.xfail.png and /dev/null differ
diff --git a/test/reference/user-font-color.script.xfail.png b/test/reference/user-font-color.script.xfail.png
index 472a16e16..e268cdc03 100644
Binary files a/test/reference/user-font-color.script.xfail.png and b/test/reference/user-font-color.script.xfail.png differ
commit ddac44db5df944bf40a828afa90236289aca421b
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Mar 1 21:04:22 2022 +1030
On vector surfaces render color glyphs in the fallback resolution
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 46f39cb20..e380880d0 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2641,7 +2641,9 @@ composite_one_color_glyph (cairo_surface_t *surface,
const cairo_pattern_t *source,
const cairo_clip_t *clip,
cairo_glyph_t *glyph,
- cairo_scaled_glyph_t *scaled_glyph)
+ cairo_scaled_glyph_t *scaled_glyph,
+ double x_scale,
+ double y_scale)
{
cairo_int_status_t status;
cairo_image_surface_t *glyph_surface;
@@ -2661,11 +2663,12 @@ composite_one_color_glyph (cairo_surface_t *surface,
int x, y;
/* round glyph locations to the nearest pixels */
/* XXX: FRAGILE: We're ignoring device_transform scaling here. A bug? */
- x = _cairo_lround (glyph->x - glyph_surface->base.device_transform.x0);
- y = _cairo_lround (glyph->y - glyph_surface->base.device_transform.y0);
+ x = _cairo_lround (glyph->x * x_scale - glyph_surface->base.device_transform.x0);
+ y = _cairo_lround (glyph->y * y_scale - glyph_surface->base.device_transform.y0);
pattern = cairo_pattern_create_for_surface ((cairo_surface_t *)glyph_surface);
cairo_matrix_init_translate (&matrix, - x, - y);
+ cairo_matrix_scale (&matrix, x_scale, y_scale);
cairo_pattern_set_matrix (pattern, &matrix);
if (op == CAIRO_OPERATOR_SOURCE || op == CAIRO_OPERATOR_CLEAR || !has_color)
status = surface->backend->mask (surface, op, pattern, pattern, clip);
@@ -2702,6 +2705,27 @@ composite_color_glyphs (cairo_surface_t *surface,
int gp;
cairo_scaled_glyph_t *glyph_cache[GLYPH_CACHE_SIZE];
cairo_color_t *foreground_color = NULL;
+ double x_scale = 1.0;
+ double y_scale = 1.0;
+
+ if (surface->is_vector) {
+ cairo_font_face_t *font_face;
+ cairo_matrix_t font_matrix;
+ cairo_matrix_t ctm;
+ cairo_font_options_t font_options;
+
+ x_scale = surface->x_fallback_resolution / surface->x_resolution;
+ y_scale = surface->y_fallback_resolution / surface->y_resolution;
+ font_face = cairo_scaled_font_get_font_face (scaled_font);
+ cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix);
+ cairo_scaled_font_get_ctm (scaled_font, &ctm);
+ cairo_scaled_font_get_font_options (scaled_font, &font_options);
+ cairo_matrix_scale (&ctm, x_scale, y_scale);
+ scaled_font = cairo_scaled_font_create (font_face,
+ &font_matrix,
+ &ctm,
+ &font_options);
+ }
if (source->type == CAIRO_PATTERN_TYPE_SOLID)
foreground_color = &((cairo_solid_pattern_t *) source)->color;
@@ -2763,7 +2787,8 @@ composite_color_glyphs (cairo_surface_t *surface,
goto UNLOCK;
status = composite_one_color_glyph (surface, op, source, clip,
- &glyphs[gp], scaled_glyph);
+ &glyphs[gp], scaled_glyph,
+ x_scale, y_scale);
if (unlikely (status && status != CAIRO_INT_STATUS_NOTHING_TO_DO))
goto UNLOCK;
}
@@ -2799,7 +2824,8 @@ composite_color_glyphs (cairo_surface_t *surface,
}
status = composite_one_color_glyph (surface, op, source, clip,
- &glyphs[glyph_pos], scaled_glyph);
+ &glyphs[glyph_pos], scaled_glyph,
+ x_scale, y_scale);
if (unlikely (status && status != CAIRO_INT_STATUS_NOTHING_TO_DO))
goto UNLOCK;
}
@@ -2810,6 +2836,9 @@ composite_color_glyphs (cairo_surface_t *surface,
UNLOCK:
_cairo_scaled_font_thaw_cache (scaled_font);
+ if (surface->is_vector)
+ cairo_scaled_font_destroy (scaled_font);
+
return status;
}
More information about the cairo-commit
mailing list