diff options
Diffstat (limited to 'pixman/pixman-bits-image.c')
-rw-r--r-- | pixman/pixman-bits-image.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index 5d5738a..e804efc 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -963,13 +963,29 @@ pixman_image_create_bits (pixman_format_code_t format, num_planes = pixman_format_num_planes (format); if (!bits && width && height) { + /* backwards compat */ + if (format == PIXMAN_yv12) + format = PIXMAN_y420; + free_me = bits = _pixman_format_alloc_bits (format, width, height, planes, rowstrides); if (!bits) return NULL; } else { - return_val_if_fail (num_planes == 1, NULL); + /* backwards compat */ + if (format == PIXMAN_yv12) + { + format = PIXMAN_y420; + planes[1] = bits + rowstride_bytes * ROUND_UP_2 (height); + planes[2] = planes[1] + ROUND_UP_8 (rowstride_bytes) * ROUND_UP_2 (height) / 4; + rowstrides[1] = ROUND_UP_8 (rowstride_bytes) / 2; + rowstrides[2] = ROUND_UP_8 (rowstride_bytes) / 2; + } + else + { + return_val_if_fail (num_planes == 1, NULL); + } planes[0] = bits; rowstrides[0] = rowstride_bytes; } @@ -1016,6 +1032,8 @@ pixman_image_create_planar (pixman_format_code_t format, return_val_if_fail (bits != NULL && rowstrides_bytes != NULL, NULL); return_val_if_fail (num_planes == pixman_format_num_planes (format), NULL); + return_val_if_fail (format != PIXMAN_yv12, NULL); + if (width && height) { for (plane = 0; plane < num_planes; plane++) { |