diff options
-rw-r--r-- | image/xcb_image.c | 53 | ||||
-rw-r--r-- | image/xcb_image.h | 11 |
2 files changed, 9 insertions, 55 deletions
diff --git a/image/xcb_image.c b/image/xcb_image.c index f8e1bde..4c646bc 100644 --- a/image/xcb_image.c +++ b/image/xcb_image.c @@ -1008,40 +1008,15 @@ xcb_image_subimage(xcb_image_t * image, uint32_t height, void * base, uint32_t bytes, - uint8_t * data, - uint32_t * left_pad) + uint8_t * data) { - int i, j; - xcb_image_t * result; - uint8_t * imagep; - uint8_t * resultp; - uint32_t left_x; - uint8_t planes = 1; - uint32_t realign = 0; + int i, j; + xcb_image_t * result; if (x + width > image->width) return 0; if (y + height > image->height) return 0; - switch (image->format) { - case XCB_IMAGE_FORMAT_Z_PIXMAP: - if (image->bpp == 4) { - realign = (x & 1) << 2; - break; - } - if (image->bpp != 1) - break; - /* fall through */ - case XCB_IMAGE_FORMAT_XY_BITMAP: - case XCB_IMAGE_FORMAT_XY_PIXMAP: - planes = image->bpp; - left_x = xcb_rounddown_2(x, image->unit); - width += x - left_x; - if (left_pad) - *left_pad = x - left_x; - else - realign = x - left_x; - } result = xcb_image_create(width, height, image->format, image->scanline_pad, image->depth, image->bpp, image->unit, image->byte_order, @@ -1049,23 +1024,11 @@ xcb_image_subimage(xcb_image_t * image, base, bytes, data); if (!result) return 0; - resultp = result->data; - imagep = image->data; - if (realign > 0) { - /* XXX FIXME For now, lose on performance. Sorry. */ - for (j = 0; j < height; j++) { - for (i = 0; i < width; i++) { - uint32_t pixel = xcb_image_get_pixel(image, x + i, y + j); - xcb_image_put_pixel(result, i, j, pixel); - } - } - return result; - } - for (j = 0; j < planes; j++) { - for (i = 0; i < height; i++) { - memcpy(resultp, imagep, result->stride); - resultp += result->stride; - imagep += image->stride; + /* XXX FIXME For now, lose on performance. Sorry. */ + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + uint32_t pixel = xcb_image_get_pixel(image, x + i, y + j); + xcb_image_put_pixel(result, i, j, pixel); } } return result; diff --git a/image/xcb_image.h b/image/xcb_image.h index 16ac154..3b54da3 100644 --- a/image/xcb_image.h +++ b/image/xcb_image.h @@ -453,7 +453,6 @@ xcb_image_convert (xcb_image_t * src, * @param base Base of memory allocation. * @param bytes Size of base allocation. * @param data Memory allocation. - * @param left_pad If non-null, any left-shift will be put here---otherwise, the resulting image will be properly justified. * @return The subimage, or null on error. * * Given an image, this function extracts the subimage at the @@ -463,13 +462,6 @@ xcb_image_convert (xcb_image_t * src, * and @p data arguments are passed to @ref xcb_create_image() unaltered * to create the destination image---see its documentation for details. * - * Normally, extracting a subimage of a bitmap when the @p x coordinate - * of the subimage is not aligned to an @p image scanline unit boundary - * will require rotation of each scanline unit during the copy. To - * avoid this, pass an integer pointer as the @p left_pad argument, and - * this routine will create a slightly-larger image to retain alignment, - * and report the left pad through the supplied pointer. For images - * stored in Z format, any left_pad parameter is ignored. * @ingroup xcb__image_t */ xcb_image_t * @@ -480,8 +472,7 @@ xcb_image_subimage(xcb_image_t * image, uint32_t height, void * base, uint32_t bytes, - uint8_t * data, - uint32_t * left_pad); + uint8_t * data); /* |