diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2017-11-09 20:52:36 +1030 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2017-11-09 22:02:05 +1030 |
commit | 71746c37d48a08d56b18d4d82185896ada215194 (patch) | |
tree | fedf44349a2e15feb23f65d61e2615c37064a610 | |
parent | 5ffbaf9e2f7da103da8d015b5f928e25f9433b60 (diff) |
test: use CAIRO_MIME_TYPE_UNIQUE_ID with record-text-transform
The PS output from this test is > 100MB due to the duplicated images.
Using CAIRO_MIME_TYPE_UNIQUE_ID reduces the PS output to 650k, runs
considerably faster, and now produces correct output.
-rw-r--r-- | test/cairo-test.c | 5 | ||||
-rw-r--r-- | test/record.c | 11 | ||||
-rw-r--r-- | test/reference/record-text-transform.ps.argb32.ref.png | bin | 1216 -> 3995 bytes | |||
-rw-r--r-- | test/reference/record-text-transform.ps.rgb24.ref.png | bin | 1216 -> 3995 bytes |
4 files changed, 16 insertions, 0 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c index 6f8cb7917..d93468bdb 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -1668,6 +1668,7 @@ cairo_test_create_surface_from_png (const cairo_test_context_t *ctx, { cairo_surface_t *image; cairo_status_t status; + char *unique_id; image = cairo_image_surface_create_from_png (filename); status = cairo_surface_status (image); @@ -1683,6 +1684,10 @@ cairo_test_create_surface_from_png (const cairo_test_context_t *ctx, free (srcdir_filename); } } + unique_id = strdup(filename); + cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_UNIQUE_ID, + (unsigned char *)unique_id, strlen(unique_id), + free, unique_id); return image; } diff --git a/test/record.c b/test/record.c index b1baadace..774c13316 100644 --- a/test/record.c +++ b/test/record.c @@ -46,6 +46,8 @@ static uint32_t data[16] = { 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff }; +static const char *unique_id = "data"; + static const char *png_filename = "romedalen.png"; static cairo_t * @@ -70,6 +72,9 @@ paint_alpha (cairo_t *cr) surface = cairo_image_surface_create_for_data ((unsigned char *) data, CAIRO_FORMAT_RGB24, 4, 4, 16); + cairo_surface_set_mime_data (surface, CAIRO_MIME_TYPE_UNIQUE_ID, + (unsigned char *)unique_id, strlen(unique_id), + NULL, NULL); cairo_test_paint_checkered (cr); @@ -106,6 +111,9 @@ paint_alpha_clip (cairo_t *cr) surface = cairo_image_surface_create_for_data ((unsigned char *) data, CAIRO_FORMAT_RGB24, 4, 4, 16); + cairo_surface_set_mime_data (surface, CAIRO_MIME_TYPE_UNIQUE_ID, + (unsigned char *)unique_id, strlen(unique_id), + NULL, NULL); cairo_test_paint_checkered (cr); @@ -131,6 +139,9 @@ paint_alpha_clip_mask (cairo_t *cr) surface = cairo_image_surface_create_for_data ((unsigned char *) data, CAIRO_FORMAT_RGB24, 4, 4, 16); + cairo_surface_set_mime_data (surface, CAIRO_MIME_TYPE_UNIQUE_ID, + (unsigned char *)unique_id, strlen(unique_id), + NULL, NULL); cairo_test_paint_checkered (cr); diff --git a/test/reference/record-text-transform.ps.argb32.ref.png b/test/reference/record-text-transform.ps.argb32.ref.png Binary files differindex 1aaaea58a..be4ec5414 100644 --- a/test/reference/record-text-transform.ps.argb32.ref.png +++ b/test/reference/record-text-transform.ps.argb32.ref.png diff --git a/test/reference/record-text-transform.ps.rgb24.ref.png b/test/reference/record-text-transform.ps.rgb24.ref.png Binary files differindex 1aaaea58a..be4ec5414 100644 --- a/test/reference/record-text-transform.ps.rgb24.ref.png +++ b/test/reference/record-text-transform.ps.rgb24.ref.png |