[cairo-commit] 4 commits - src/cairo-image-compositor.c src/cairo-time.c src/cairo-wideint-private.h test/xcb-snapshot-assert.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun May 20 04:15:39 PDT 2012
src/cairo-image-compositor.c | 13 ++++---------
src/cairo-time.c | 21 ++++++++++++++++++++-
src/cairo-wideint-private.h | 4 ++--
test/xcb-snapshot-assert.c | 10 +++++++++-
4 files changed, 35 insertions(+), 13 deletions(-)
New commits:
commit a845ebe32d68a4701fd0645c576a2dc65c82ca8f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun May 20 12:11:27 2012 +0100
test: Fix leak from xcb-snapshort-assert
==12598== 1,344 (768 direct, 576 indirect) bytes in 2 blocks are
definitely lost in loss record 512 of 519
==12598== at 0x402894D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12598== by 0x4C76501: _cairo_image_surface_create_for_pixman_image (cairo-image-surface.c:176)
==12598== by 0x4C76953: _cairo_image_surface_create_with_pixman_format (cairo-image-surface.c:345)
==12598== by 0x44CFAC: draw (xcb-snapshot-assert.c:36)
==12598== by 0x40E14C: cairo_test_for_target (cairo-test.c:923)
==12598== by 0x40EEA7: _cairo_test_context_run_for_target (cairo-test.c:1545)
==12598== by 0x40BD53: main (cairo-test-runner.c:254)
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/test/xcb-snapshot-assert.c b/test/xcb-snapshot-assert.c
index e1ddb73..a674476 100644
--- a/test/xcb-snapshot-assert.c
+++ b/test/xcb-snapshot-assert.c
@@ -36,8 +36,12 @@ create_image (int width, int height)
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
/* Paint something random to the image */
cr = cairo_create (surface);
+ cairo_surface_destroy (surface);
+
cairo_set_source_rgb (cr, 0, 1, 1);
cairo_paint (cr);
+
+ surface = cairo_surface_reference (cairo_get_target (cr));
cairo_destroy (cr);
return surface;
@@ -46,8 +50,12 @@ create_image (int width, int height)
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
+ cairo_surface_t *image;
+
/* Image has to have same geometry as xcb surface to be added as a snapshot */
- cairo_set_source_surface (cr, create_image (width, height), 0, 0);
+ image = create_image (width, height);
+ cairo_set_source_surface (cr, image, 0, 0);
+ cairo_surface_destroy (image);
/* This attaches the tested xcb surface as a snapshot */
cairo_paint (cr);
commit 2879e656b9b9283308ed4eaf3ad820460ac1df8b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun May 20 10:24:06 2012 +0100
wideint: Fix compilation failure for bare use of uint64_t for !HAVE_UINT64_T
Reported-by: Hakki Dogusan <dogusanh at tr.net>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-wideint-private.h b/src/cairo-wideint-private.h
index 4051a1d..3f5491b 100644
--- a/src/cairo-wideint-private.h
+++ b/src/cairo-wideint-private.h
@@ -55,9 +55,9 @@ cairo_uquorem64_t I
_cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den);
cairo_uint64_t I _cairo_double_to_uint64 (double i);
-double I _cairo_uint64_to_double (uint64_t i);
+double I _cairo_uint64_to_double (cairo_uint64_t i);
cairo_int64_t I _cairo_double_to_int64 (double i);
-double I _cairo_int64_to_double (uint64_t i);
+double I _cairo_int64_to_double (cairo_uint64_t i);
cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i);
#define _cairo_uint64_to_uint32(a) ((a).lo)
commit dad69ce4d5568f94621ae60ccdcc683d5bbd0efd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun May 20 10:54:07 2012 +0100
win32: Fix return value for cairo_time_get
Without uint64_t we need to construct a cairo_int64_t from the struct of
smaller 32-bit types rather than just casting the larger 64-bit value.
Reported-by: Hakki Dogusan <dogusanh at tr.net>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-time.c b/src/cairo-time.c
index 9a594e8..a0003fb 100644
--- a/src/cairo-time.c
+++ b/src/cairo-time.c
@@ -103,6 +103,25 @@ _cairo_time_1s (void)
return freq.QuadPart;
}
+#ifndef HAVE_UINT64_T
+static cairo_always_inline cairo_time_t
+_cairo_time_from_large_integer (LARGE_INTEGER t)
+{
+ cairo_int64_t r;
+
+ r = _cairo_int64_lsl (_cairo_int32_to_int64 (t.HighPart), 32);
+ r = _cairo_int64_add (r, _cairo_int32_to_int64 (t.LowPart));
+
+ return r;
+}
+#else
+static cairo_always_inline cairo_time_t
+_cairo_time_from_large_integer (LARGE_INTEGER t)
+{
+ return t.QuadPart;
+}
+#endif
+
cairo_time_t
_cairo_time_get (void)
{
@@ -110,7 +129,7 @@ _cairo_time_get (void)
QueryPerformanceCounter (&t);
- return t.QuadPart;
+ return _cairo_time_from_large_integer(t);
}
#elif defined(CAIRO_CLOCK)
commit 5a7a9c93e7f807ae8ee7504ff308e9676dbe8d25
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun May 20 10:33:17 2012 +0100
image: Tidy lerp8x4
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 5a1ea4a..b0afc5d 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -1921,15 +1921,10 @@ mul8_8 (uint8_t a, uint8_t b)
static inline uint32_t
lerp8x4 (uint32_t src, uint8_t a, uint32_t dst)
{
- uint8_t ia = ~a;
- uint32_t r1, r2;
-
- r1 = add8x2_8x2 (mul8x2_8 (src, a),
- mul8x2_8 (dst, ia));
- r2 = add8x2_8x2 (mul8x2_8 (src >> G_SHIFT, a),
- mul8x2_8 (dst >> G_SHIFT, ia));
-
- return r1 | (r2 << G_SHIFT);
+ return (add8x2_8x2 (mul8x2_8 (src, a),
+ mul8x2_8 (dst, ~a)) |
+ add8x2_8x2 (mul8x2_8 (src >> G_SHIFT, a),
+ mul8x2_8 (dst >> G_SHIFT, ~a)) << G_SHIFT);
}
static cairo_status_t
More information about the cairo-commit
mailing list