[cairo-commit] 5 commits - perf/micro src/cairo-cff-subset.c src/cairo-directfb-surface.c src/cairo-quartz-surface.c src/cairo-script-surface.c src/cairo-xcb-shm.c src/cairo-xcb-surface.c src/cairo-xcb-surface-render.c
Andrea Canciani
ranma42 at kemper.freedesktop.org
Fri Jul 29 03:38:37 PDT 2011
perf/micro/dragon.c | 1
src/cairo-cff-subset.c | 8 +++---
src/cairo-directfb-surface.c | 9 +++----
src/cairo-quartz-surface.c | 50 +++++++++++++++++++----------------------
src/cairo-script-surface.c | 2 +
src/cairo-xcb-shm.c | 6 ++++
src/cairo-xcb-surface-render.c | 3 --
src/cairo-xcb-surface.c | 2 -
8 files changed, 41 insertions(+), 40 deletions(-)
New commits:
commit 81efbc1847c4b9c08440d76bbc1636b21cac16d8
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Jul 29 11:33:46 2011 +0200
quartz: Silence some clang warnings
Clang static analysis relies on the Core Foundation naming convention
for the object ownership tracking.
Functions that return an object whose ownership is given to the
caller, should contain "Create" or "Copy" in their name.
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index d5d8aaf..0f481a0 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -152,15 +152,15 @@ static void quartz_ensure_symbols (void)
}
CGImageRef
-_cairo_quartz_create_cgimage (cairo_format_t format,
- unsigned int width,
- unsigned int height,
- unsigned int stride,
- void *data,
- cairo_bool_t interpolate,
- CGColorSpaceRef colorSpaceOverride,
- CGDataProviderReleaseDataCallback releaseCallback,
- void *releaseInfo)
+CairoQuartzCreateCGImage (cairo_format_t format,
+ unsigned int width,
+ unsigned int height,
+ unsigned int stride,
+ void *data,
+ cairo_bool_t interpolate,
+ CGColorSpaceRef colorSpaceOverride,
+ CGDataProviderReleaseDataCallback releaseCallback,
+ void *releaseInfo)
{
CGImageRef image = NULL;
CGDataProviderRef dataProvider = NULL;
@@ -701,10 +701,10 @@ static const CGFunctionCallbacks gradient_callbacks = {
#define MAX_GRADIENT_RANGE 1024
static CGFunctionRef
-_cairo_quartz_create_gradient_function (const cairo_gradient_pattern_t *gradient,
- const cairo_rectangle_int_t *extents,
- cairo_circle_double_t *start,
- cairo_circle_double_t *end)
+CairoQuartzCreateGradientFunction (const cairo_gradient_pattern_t *gradient,
+ const cairo_rectangle_int_t *extents,
+ cairo_circle_double_t *start,
+ cairo_circle_double_t *end)
{
cairo_pattern_t *pat;
cairo_quartz_float_t input_value_range[2];
@@ -821,15 +821,15 @@ _cairo_surface_to_cgimage (cairo_surface_t *source,
source_img->image_out->data,
source_img->image_out->height * source_img->image_out->stride);
} else {
- *image_out = _cairo_quartz_create_cgimage (source_img->image_out->format,
- source_img->image_out->width,
- source_img->image_out->height,
- source_img->image_out->stride,
- source_img->image_out->data,
- TRUE,
- NULL,
- DataProviderReleaseCallback,
- source_img);
+ *image_out = CairoQuartzCreateCGImage (source_img->image_out->format,
+ source_img->image_out->width,
+ source_img->image_out->height,
+ source_img->image_out->stride,
+ source_img->image_out->data,
+ TRUE,
+ NULL,
+ DataProviderReleaseCallback,
+ source_img);
/* TODO: differentiate memory error and unsupported surface type */
if (unlikely (*image_out == NULL))
@@ -1044,10 +1044,8 @@ _cairo_quartz_setup_gradient_source (cairo_quartz_drawing_state_t *state,
cairo_matrix_invert (&mat);
_cairo_quartz_cairo_matrix_to_quartz (&mat, &state->transform);
- gradFunc = _cairo_quartz_create_gradient_function (gradient,
- extents,
- &start,
- &end);
+ gradFunc = CairoQuartzCreateGradientFunction (gradient, extents,
+ &start, &end);
if (unlikely (gradFunc == NULL))
return CAIRO_INT_STATUS_UNSUPPORTED;
commit 93c8b1090b887847c44780ea0e311a454e7978c1
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Jul 29 11:56:40 2011 +0200
cff-subset: Do not use garbage values
The code incorrectly initialized the fields of the data structure,
which are about to be overwritten, instead of the temporary variables
which are used to compute them.
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index 918a0b2..3dabc92 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -1078,10 +1078,10 @@ cairo_cff_font_read_font_metrics (cairo_cff_font_t *font, cairo_hash_table_t *t
double x_min, y_min, x_max, y_max;
double xx, yx, xy, yy;
- font->x_min = 0.0;
- font->y_min = 0.0;
- font->x_max = 0.0;
- font->y_max = 0.0;
+ x_min = 0.0;
+ y_min = 0.0;
+ x_max = 0.0;
+ y_max = 0.0;
p = cff_dict_get_operands (font->top_dict, FONTBBOX_OP, &size);
if (p) {
end = p + size;
commit ad3ef3a8fb560a2bd528ccd15469bbe9a1ddcee8
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Jul 29 10:46:42 2011 +0200
Silence Clang static analyzer reports
Clang static analysis triggers some reports in non-buggy code.
Silence them trying to follow better coding practices.
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index 3aa1f61..699b6c3 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -1343,7 +1343,9 @@ _emit_image_surface (cairo_script_surface_t *surface,
len = clone->width * 4;
break;
case CAIRO_FORMAT_INVALID:
+ default:
ASSERT_NOT_REACHED;
+ len = 0;
break;
}
len *= clone->height;
diff --git a/src/cairo-xcb-shm.c b/src/cairo-xcb-shm.c
index 7695279..1d630a7 100644
--- a/src/cairo-xcb-shm.c
+++ b/src/cairo-xcb-shm.c
@@ -271,7 +271,7 @@ merge_buddies (cairo_xcb_shm_mem_pool_t *pi,
cairo_xcb_shm_mem_block_t *block,
unsigned int max_bits)
{
- size_t block_offset = block_offset = block - pi->blocks;
+ size_t block_offset = block - pi->blocks;
unsigned int bits = block->bits;
while (bits < max_bits - 1) {
@@ -477,6 +477,10 @@ _cairo_xcb_shm_process_pending (cairo_xcb_connection_t *connection, shm_wait_typ
* larger sequence number and thus don't have to be checked. */
return;
break;
+ default:
+ /* silence Clang static analyzer warning */
+ ASSERT_NOT_REACHED;
+ reply = NULL;
}
free (reply);
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index a36bbf1..586b9fe 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -302,11 +302,10 @@ _cairo_xcb_surface_ensure_picture (cairo_xcb_surface_t *surface)
if (surface->picture == XCB_NONE) {
uint32_t values[1];
uint32_t flags = 0;
- int n = 0;
if (surface->precision != XCB_RENDER_POLY_MODE_PRECISE) {
flags |= XCB_RENDER_CP_POLY_MODE;
- values[n++] = surface->precision;
+ values[0] = surface->precision;
}
surface->picture = _cairo_xcb_connection_get_xid (surface->connection);
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 072f3e3..da35e75 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -163,10 +163,10 @@ _cairo_xcb_surface_create_similar_image (void *abstract_other,
int width,
int height)
{
+#if CAIRO_HAS_XCB_SHM_FUNCTIONS
cairo_xcb_surface_t *other = abstract_other;
cairo_xcb_connection_t *connection = other->connection;
-#if CAIRO_HAS_XCB_SHM_FUNCTIONS
cairo_surface_t *image;
cairo_xcb_shm_info_t *shm_info;
cairo_status_t status;
commit e8e765605c2ae69710affadd3f450aef17932258
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Jul 29 10:46:14 2011 +0200
Silence gcc warnings
diff --git a/perf/micro/dragon.c b/perf/micro/dragon.c
index 78da5b2..29057e9 100644
--- a/perf/micro/dragon.c
+++ b/perf/micro/dragon.c
@@ -167,7 +167,6 @@ do_dragon_solid (cairo_t *cr, int width, int height, int loops)
double cx, cy, r;
cx = cy = .5 * MAX (width, height);
- r = .5 * MIN (width, height);
cairo_perf_timer_start ();
commit 15b6b2832b373cd09986d2f9595f9930b256894d
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Jul 29 10:44:57 2011 +0200
directfb: Unbreak compilation
The recent changes to the clip code caused build failure in directfb.
diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c
index 4f9bbc4..c46f587 100644
--- a/src/cairo-directfb-surface.c
+++ b/src/cairo-directfb-surface.c
@@ -1724,7 +1724,7 @@ _cairo_directfb_surface_show_glyphs (void *abstract_dst,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font,
- cairo_clip_t *clip,
+ const cairo_clip_t *clip,
int *remaining_glyphs)
{
cairo_directfb_surface_t *dst = abstract_dst;
@@ -1751,10 +1751,9 @@ _cairo_directfb_surface_show_glyphs (void *abstract_dst,
/* Fallback if we need to emulate clip regions */
if (clip != NULL) {
- status = _cairo_clip_get_region (clip, &clip_region);
- assert (status != CAIRO_INT_STATUS_NOTHING_TO_DO);
- if (status)
- return status;
+ clip_region = _cairo_clip_get_region (clip);
+ if (unlikely (clip_region == NULL))
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
/* XXX Unbounded operators are not handled correctly */
More information about the cairo-commit
mailing list