[gtk/wip/otte/no-clip-on-draw: 1/10] testsuite: Don't destroy surfaces that are still used
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/no-clip-on-draw: 1/10] testsuite: Don't destroy surfaces that are still used
- Date: Thu, 13 Feb 2020 05:31:57 +0000 (UTC)
commit 9d8ceb0cb2f331ec79305ec2022192714a89d783
Author: Benjamin Otte <otte redhat com>
Date: Thu Feb 13 03:23:51 2020 +0100
testsuite: Don't destroy surfaces that are still used
Coercing the surfaces must not unref the old surface, because the old
surface is going to be saved to a file.
testsuite/gsk/reftest-compare.c | 18 ++++++++++--------
testsuite/reftests/reftest-compare.c | 18 ++++++++++--------
2 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/testsuite/gsk/reftest-compare.c b/testsuite/gsk/reftest-compare.c
index 84c560cabc..f63af72419 100644
--- a/testsuite/gsk/reftest-compare.c
+++ b/testsuite/gsk/reftest-compare.c
@@ -61,7 +61,6 @@ coerce_surface_for_comparison (cairo_surface_t *surface,
cairo_paint (cr);
cairo_destroy (cr);
- cairo_surface_destroy (surface);
g_assert (cairo_surface_status (coerced) == CAIRO_STATUS_SUCCESS);
@@ -152,21 +151,24 @@ reftest_compare_surfaces (cairo_surface_t *surface1,
cairo_surface_t *surface2)
{
int w1, h1, w2, h2, w, h;
- cairo_surface_t *diff;
+ cairo_surface_t *coerced1, *coerced2, *diff;
get_surface_size (surface1, &w1, &h1);
get_surface_size (surface2, &w2, &h2);
w = MAX (w1, w2);
h = MAX (h1, h2);
- surface1 = coerce_surface_for_comparison (surface1, w, h);
- surface2 = coerce_surface_for_comparison (surface2, w, h);
+ coerced1 = coerce_surface_for_comparison (surface1, w, h);
+ coerced2 = coerce_surface_for_comparison (surface2, w, h);
- diff = buffer_diff_core (cairo_image_surface_get_data (surface1),
- cairo_image_surface_get_stride (surface1),
- cairo_image_surface_get_data (surface2),
- cairo_image_surface_get_stride (surface2),
+ diff = buffer_diff_core (cairo_image_surface_get_data (coerced1),
+ cairo_image_surface_get_stride (coerced1),
+ cairo_image_surface_get_data (coerced2),
+ cairo_image_surface_get_stride (coerced2),
w, h);
+ cairo_surface_destroy (coerced1);
+ cairo_surface_destroy (coerced2);
+
return diff;
}
diff --git a/testsuite/reftests/reftest-compare.c b/testsuite/reftests/reftest-compare.c
index 84c560cabc..f63af72419 100644
--- a/testsuite/reftests/reftest-compare.c
+++ b/testsuite/reftests/reftest-compare.c
@@ -61,7 +61,6 @@ coerce_surface_for_comparison (cairo_surface_t *surface,
cairo_paint (cr);
cairo_destroy (cr);
- cairo_surface_destroy (surface);
g_assert (cairo_surface_status (coerced) == CAIRO_STATUS_SUCCESS);
@@ -152,21 +151,24 @@ reftest_compare_surfaces (cairo_surface_t *surface1,
cairo_surface_t *surface2)
{
int w1, h1, w2, h2, w, h;
- cairo_surface_t *diff;
+ cairo_surface_t *coerced1, *coerced2, *diff;
get_surface_size (surface1, &w1, &h1);
get_surface_size (surface2, &w2, &h2);
w = MAX (w1, w2);
h = MAX (h1, h2);
- surface1 = coerce_surface_for_comparison (surface1, w, h);
- surface2 = coerce_surface_for_comparison (surface2, w, h);
+ coerced1 = coerce_surface_for_comparison (surface1, w, h);
+ coerced2 = coerce_surface_for_comparison (surface2, w, h);
- diff = buffer_diff_core (cairo_image_surface_get_data (surface1),
- cairo_image_surface_get_stride (surface1),
- cairo_image_surface_get_data (surface2),
- cairo_image_surface_get_stride (surface2),
+ diff = buffer_diff_core (cairo_image_surface_get_data (coerced1),
+ cairo_image_surface_get_stride (coerced1),
+ cairo_image_surface_get_data (coerced2),
+ cairo_image_surface_get_stride (coerced2),
w, h);
+ cairo_surface_destroy (coerced1);
+ cairo_surface_destroy (coerced2);
+
return diff;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]