From: Søren Sandmann Pedersen Date: Sat, 18 Jul 2009 02:40:41 +0000 (-0400) Subject: Move read and write functions to the bits_image_t struct. X-Git-Tag: pixman-0.15.18~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=934f4f4604ccf06db5d5aec07e58f0a0fbe7d283;p=platform%2Fupstream%2Fpixman.git Move read and write functions to the bits_image_t struct. Those fields were duplicated between image_common and bits_image_t before. --- diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c index 64f3b7f..19f70d7 100644 --- a/pixman/pixman-access.c +++ b/pixman/pixman-access.c @@ -3444,7 +3444,7 @@ _pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image); void _pixman_bits_image_setup_raw_accessors (bits_image_t *image) { - if (image->common.read_func || image->common.write_func) + if (image->read_func || image->write_func) _pixman_bits_image_setup_raw_accessors_accessors (image); else setup_accessors (image); diff --git a/pixman/pixman-accessor.h b/pixman/pixman-accessor.h index a72c52a..90c8ea7 100644 --- a/pixman/pixman-accessor.h +++ b/pixman/pixman-accessor.h @@ -3,9 +3,9 @@ #define ACCESS(sym) sym##_accessors #define READ(img, ptr) \ - ((img)->common.read_func ((ptr), sizeof(*(ptr)))) + (((bits_image_t *)(img))->read_func ((ptr), sizeof(*(ptr)))) #define WRITE(img, ptr,val) \ - ((img)->common.write_func ((ptr), (val), sizeof (*(ptr)))) + (((bits_image_t *)(img))->write_func ((ptr), (val), sizeof (*(ptr)))) #define MEMCPY_WRAPPED(img, dst, src, size) \ do { \ diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index e366c85..75c5d3a 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -954,6 +954,8 @@ pixman_image_create_bits (pixman_format_code_t format, image->bits.height = height; image->bits.bits = bits; image->bits.free_me = free_me; + image->bits.read_func = NULL; + image->bits.write_func = NULL; /* The rowstride is stored in number of uint32_t */ image->bits.rowstride = rowstride_bytes / (int) sizeof (uint32_t); diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c index 80e1e5c..81a2e96 100644 --- a/pixman/pixman-edge.c +++ b/pixman/pixman-edge.c @@ -370,7 +370,9 @@ pixman_rasterize_edges (pixman_image_t *image, pixman_fixed_t t, pixman_fixed_t b) { - if (image->common.read_func || image->common.write_func) + return_if_fail (image->type == BITS); + + if (image->bits.read_func || image->bits.write_func) pixman_rasterize_edges_accessors (image, l, r, t, b); else pixman_rasterize_edges_no_accessors (image, l, r, t, b); diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c index e27bd8c..8de922f 100644 --- a/pixman/pixman-fast-path.c +++ b/pixman/pixman-fast-path.c @@ -1217,8 +1217,8 @@ fast_path_composite (pixman_implementation_t *imp, && (src->common.filter == PIXMAN_FILTER_NEAREST) && PIXMAN_FORMAT_BPP (dest->bits.format) == 32 && src->bits.format == dest->bits.format - && !src->common.read_func && !src->common.write_func - && !dest->common.read_func && !dest->common.write_func) + && !src->bits.read_func && !src->bits.write_func + && !dest->bits.read_func && !dest->bits.write_func) { /* ensure that the transform matrix only has a scale */ if (src->common.transform->matrix[0][1] == 0 && diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c index df98b98..898474f 100644 --- a/pixman/pixman-general.c +++ b/pixman/pixman-general.c @@ -134,7 +134,7 @@ general_composite_rect (pixman_implementation_t *imp, */ if (!wide && !dest->common.alpha_map && - !dest->common.write_func && + !dest->bits.write_func && (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) && (dest->bits.format == PIXMAN_a8r8g8b8 || dest->bits.format == PIXMAN_x8r8g8b8)) diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index f6bda58..8b4fb64 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -115,8 +115,6 @@ _pixman_image_allocate (void) common->alpha_map = NULL; common->component_alpha = FALSE; common->ref_count = 1; - common->read_func = NULL; - common->write_func = NULL; common->classify = NULL; common->client_clip = FALSE; common->destroy_func = NULL; @@ -450,10 +448,13 @@ pixman_image_set_accessors (pixman_image_t * image, { return_if_fail (image != NULL); - image->common.read_func = read_func; - image->common.write_func = write_func; + if (image->type == BITS) + { + image->bits.read_func = read_func; + image->bits.write_func = write_func; - image_property_changed (image); + image_property_changed (image); + } } PIXMAN_EXPORT uint32_t * diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 07259a0..052f3a9 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -88,8 +88,6 @@ struct image_common int alpha_origin_x; int alpha_origin_y; pixman_bool_t component_alpha; - pixman_read_memory_func_t read_func; - pixman_write_memory_func_t write_func; classify_func_t classify; property_changed_func_t property_changed; fetch_scanline_t get_scanline_32; diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index b011601..3dfacde 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -678,11 +678,11 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths, && (!mask || (mask->common.filter != PIXMAN_FILTER_CONVOLUTION && mask->common.repeat != PIXMAN_REPEAT_PAD && mask->common.repeat != PIXMAN_REPEAT_REFLECT)) - && !src->common.read_func && !src->common.write_func - && !(mask && mask->common.read_func) - && !(mask && mask->common.write_func) - && !dest->common.read_func - && !dest->common.write_func) + && !src->bits.read_func && !src->bits.write_func + && !(mask && mask->bits.read_func) + && !(mask && mask->bits.write_func) + && !dest->bits.read_func + && !dest->bits.write_func) { const pixman_fast_path_t *info; pixman_bool_t pixbuf;