From: devilhorns Date: Sat, 20 Aug 2011 10:59:53 +0000 (+0000) Subject: Evas: Iterating the pixmap formats from xcb_setup can be expensive, X-Git-Tag: 2.0_alpha~240^2~114 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=814988bc4b14288ea0c86b88565475f8fa9d5c1a;p=framework%2Fuifw%2Fevas.git Evas: Iterating the pixmap formats from xcb_setup can be expensive, so cache the found format for reuse so we don't have to keep iterating. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@62626 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/modules/engines/software_x11/evas_xcb_buffer.c b/src/modules/engines/software_x11/evas_xcb_buffer.c index 03f2386..6b7e18a 100644 --- a/src/modules/engines/software_x11/evas_xcb_buffer.c +++ b/src/modules/engines/software_x11/evas_xcb_buffer.c @@ -418,8 +418,9 @@ _xcbob_sync(xcb_connection_t *conn) static xcb_image_t * _xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data) { + static uint8_t dpth = 0; + static xcb_format_t *fmt = NULL; const xcb_setup_t *setup; - xcb_format_t *fmt = NULL; xcb_image_format_t xif; /* NB: We cannot use xcb_image_create_native as it only creates images @@ -431,21 +432,18 @@ _xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t fo if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1)) xif = XCB_IMAGE_FORMAT_XY_PIXMAP; - fmt = _xcbob_find_format(setup, depth); - if (!fmt) return 0; + if (dpth != depth) + { + dpth = depth; + fmt = _xcbob_find_format(setup, depth); + if (!fmt) return 0; + } switch (xif) { case XCB_IMAGE_FORMAT_XY_BITMAP: if (depth != 1) return 0; case XCB_IMAGE_FORMAT_XY_PIXMAP: - /* return xcb_image_create(w, h, xif, */ - /* fmt->scanline_pad, */ - /* fmt->depth, fmt->bits_per_pixel, */ - /* setup->bitmap_format_scanline_unit, */ - /* setup->image_byte_order, */ - /* setup->bitmap_format_bit_order, */ - /* base, bytes, data); */ case XCB_IMAGE_FORMAT_Z_PIXMAP: return xcb_image_create(w, h, xif, fmt->scanline_pad,