diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 60c0592d7..2be0b01a0 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -59,6 +59,7 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format) case PIXMAN_a4: case PIXMAN_r1g2b1: case PIXMAN_b1g2r1: case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4: case PIXMAN_g4: case PIXMAN_g1: + case PIXMAN_yuy2: case PIXMAN_yv12: default: return CAIRO_FORMAT_INVALID; } @@ -100,6 +101,8 @@ _cairo_content_from_pixman_format (pixman_format_code_t pixman_format) case PIXMAN_c4: case PIXMAN_g4: case PIXMAN_g1: + case PIXMAN_yuy2: + case PIXMAN_yv12: return CAIRO_CONTENT_COLOR; case PIXMAN_a8: case PIXMAN_a1: @@ -289,7 +292,7 @@ _cairo_image_surface_create_with_masks (unsigned char *data, int stride) { pixman_format_code_t pixman_format; - + pixman_format = _pixman_format_from_masks (masks); return _cairo_image_surface_create_with_pixman_format (data, @@ -299,7 +302,7 @@ _cairo_image_surface_create_with_masks (unsigned char *data, stride); } -static pixman_format_code_t +static pixman_format_code_t _cairo_format_to_pixman_format_code (cairo_format_t format) { pixman_format_code_t ret; @@ -484,7 +487,7 @@ cairo_image_surface_create_for_data (unsigned char *data, pixman_format_code_t pixman_format; if (! CAIRO_FORMAT_VALID (format)) - return _cairo_surface_create_in_error (_cairo_error(CAIRO_STATUS_INVALID_FORMAT)); + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT)); if ((stride & (STRIDE_ALIGNMENT-1)) != 0) return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE)); @@ -528,7 +531,7 @@ cairo_image_surface_get_data (cairo_surface_t *surface) { cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface; - if (!_cairo_surface_is_image (surface)) { + if (! _cairo_surface_is_image (surface)) { _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); return NULL; } @@ -551,7 +554,7 @@ cairo_image_surface_get_format (cairo_surface_t *surface) { cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface; - if (!_cairo_surface_is_image (surface)) { + if (! _cairo_surface_is_image (surface)) { _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); return 0; } @@ -574,7 +577,7 @@ cairo_image_surface_get_width (cairo_surface_t *surface) { cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface; - if (!_cairo_surface_is_image (surface)) { + if (! _cairo_surface_is_image (surface)) { _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); return 0; } @@ -596,7 +599,7 @@ cairo_image_surface_get_height (cairo_surface_t *surface) { cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface; - if (!_cairo_surface_is_image (surface)) { + if (! _cairo_surface_is_image (surface)) { _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); return 0; } @@ -624,7 +627,7 @@ cairo_image_surface_get_stride (cairo_surface_t *surface) cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface; - if (!_cairo_surface_is_image (surface)) { + if (! _cairo_surface_is_image (surface)) { _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); return 0; } @@ -794,7 +797,7 @@ _cairo_image_surface_set_matrix (cairo_image_surface_t *surface, _cairo_matrix_to_pixman_matrix (matrix, &pixman_transform); - if (!pixman_image_set_transform (surface->pixman_image, &pixman_transform)) + if (! pixman_image_set_transform (surface->pixman_image, &pixman_transform)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); return CAIRO_STATUS_SUCCESS; @@ -974,7 +977,7 @@ _cairo_image_surface_composite (cairo_operator_t op, width, height); } - if (!_cairo_operator_bounded_by_source (op)) + if (! _cairo_operator_bounded_by_source (op)) status = _cairo_surface_composite_fixup_unbounded (&dst->base, &src_attr, src->width, src->height, mask ? &mask_attr : NULL, @@ -1014,11 +1017,11 @@ _cairo_image_surface_fill_rectangles (void *abstract_surface, pixman_color.blue = color->blue_short; pixman_color.alpha = color->alpha_short; - if (num_rects > ARRAY_LENGTH(stack_rects)) { - pixman_rects = _cairo_malloc_ab (num_rects, sizeof(pixman_rectangle16_t)); + if (num_rects > ARRAY_LENGTH (stack_rects)) { + pixman_rects = _cairo_malloc_ab (num_rects, sizeof (pixman_rectangle16_t)); if (pixman_rects == NULL) return _cairo_error (CAIRO_STATUS_NO_MEMORY); - } + } for (i = 0; i < num_rects; i++) { pixman_rects[i].x = rects[i].x; @@ -1028,7 +1031,7 @@ _cairo_image_surface_fill_rectangles (void *abstract_surface, } /* XXX: pixman_fill_rectangles() should be implemented */ - if (!pixman_image_fill_rectangles (_pixman_operator(op), + if (! pixman_image_fill_rectangles (_pixman_operator (op), surface->pixman_image, &pixman_color, num_rects, @@ -1073,8 +1076,8 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, return CAIRO_STATUS_SUCCESS; /* Convert traps to pixman traps */ - if (num_traps > ARRAY_LENGTH(stack_traps)) { - pixman_traps = _cairo_malloc_ab (num_traps, sizeof(pixman_trapezoid_t)); + if (num_traps > ARRAY_LENGTH (stack_traps)) { + pixman_traps = _cairo_malloc_ab (num_traps, sizeof (pixman_trapezoid_t)); if (pixman_traps == NULL) return _cairo_error (CAIRO_STATUS_NO_MEMORY); } @@ -1108,7 +1111,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, if (op == CAIRO_OPERATOR_ADD && _cairo_pattern_is_opaque_solid (pattern) && dst->base.content == CAIRO_CONTENT_ALPHA && - !dst->has_clip && + ! dst->has_clip && antialias != CAIRO_ANTIALIAS_NONE) { pixman_add_trapezoids (dst->pixman_image, 0, 0, @@ -1134,7 +1137,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, ret = 1; mask_stride = ((width + 31) / 8) & ~0x03; mask_bpp = 1; - break; + break; case CAIRO_ANTIALIAS_GRAY: case CAIRO_ANTIALIAS_SUBPIXEL: case CAIRO_ANTIALIAS_DEFAULT: @@ -1143,7 +1146,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, ret = 1; mask_stride = (width + 3) & ~3; mask_bpp = 8; - break; + break; } /* The image must be initially transparent */ @@ -1173,7 +1176,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, dst_x, dst_y, width, height); - if (!_cairo_operator_bounded_by_mask (op)) + if (! _cairo_operator_bounded_by_mask (op)) status = _cairo_surface_composite_shape_fixup_unbounded (&dst->base, &attributes, src->width, src->height, width, height, @@ -1201,7 +1204,7 @@ _cairo_image_surface_set_clip_region (void *abstract_surface, { cairo_image_surface_t *surface = (cairo_image_surface_t *) abstract_surface; - if (!pixman_image_set_clip_region (surface->pixman_image, ®ion->rgn)) + if (! pixman_image_set_clip_region (surface->pixman_image, ®ion->rgn)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); surface->has_clip = region != NULL;