mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-06-19 08:58:29 +02:00
test: Rework buffer_diff interface as new compare_surfaces
This is a slightly kinder interface that accepts cairo_image_surface_t pointers rather than pointers to the raw image data and width, height, stride. This brings us closer to hooking up the pdiff code.
This commit is contained in:
parent
0d7870b6bf
commit
55f776876d
2 changed files with 19 additions and 24 deletions
|
|
@ -117,17 +117,19 @@ buffer_diff_core (unsigned char *_buf_a,
|
|||
}
|
||||
|
||||
void
|
||||
buffer_diff (unsigned char *buf_a,
|
||||
unsigned char *buf_b,
|
||||
unsigned char *buf_diff,
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
buffer_diff_result_t *result)
|
||||
compare_surfaces (cairo_surface_t *surface_a,
|
||||
cairo_surface_t *surface_b,
|
||||
cairo_surface_t *surface_diff,
|
||||
buffer_diff_result_t *result)
|
||||
{
|
||||
buffer_diff_core(buf_a, buf_b, buf_diff,
|
||||
width, height, stride, 0xffffffff,
|
||||
result);
|
||||
buffer_diff_core (cairo_image_surface_get_data (surface_a),
|
||||
cairo_image_surface_get_data (surface_b),
|
||||
cairo_image_surface_get_data (surface_diff),
|
||||
cairo_image_surface_get_width (surface_a),
|
||||
cairo_image_surface_get_height (surface_a),
|
||||
cairo_image_surface_get_stride (surface_a),
|
||||
0xffffffff,
|
||||
result);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -304,11 +306,7 @@ image_diff_core (const char *filename_a,
|
|||
surface_diff = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
width_a, height_a);
|
||||
|
||||
buffer_diff (cairo_image_surface_get_data (surface_a),
|
||||
cairo_image_surface_get_data (surface_b),
|
||||
cairo_image_surface_get_data (surface_diff),
|
||||
width_a, height_a, stride_a,
|
||||
result);
|
||||
compare_surfaces (surface_a, surface_b, surface_diff, result);
|
||||
|
||||
if (result->pixels_changed) {
|
||||
FILE *png_file;
|
||||
|
|
|
|||
|
|
@ -36,22 +36,19 @@ typedef struct _buffer_diff_result {
|
|||
unsigned int max_diff;
|
||||
} buffer_diff_result_t;
|
||||
|
||||
/* Compares two image buffers.
|
||||
/* Compares two image surfaces
|
||||
*
|
||||
* Provides number of pixels changed and maximum single-channel
|
||||
* difference in result.
|
||||
*
|
||||
* Also fills in a "diff" buffer intended to visually show where the
|
||||
* Also fills in a "diff" surface intended to visually show where the
|
||||
* images differ.
|
||||
*/
|
||||
void
|
||||
buffer_diff (unsigned char *buf_a,
|
||||
unsigned char *buf_b,
|
||||
unsigned char *buf_diff,
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
buffer_diff_result_t *result);
|
||||
compare_surfaces (cairo_surface_t *surface_a,
|
||||
cairo_surface_t *surface_b,
|
||||
cairo_surface_t *surface_diff,
|
||||
buffer_diff_result_t *result);
|
||||
|
||||
/* Compares two image buffers ignoring the alpha channel.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue