From 7f70ef0b19d87fed262093adf9db8dc9b4a3c881 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Jul 2009 15:14:27 +0100 Subject: [PATCH] Optimised copyout from XImage for 24-deep 32bpp RGB LE XImages --- pctb/pages.c | 34 +++++++++++++++++++++++++++------- pctb/x.gdb | 4 ++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pctb/pages.c b/pctb/pages.c index fcee3d5..433ea36 100644 --- a/pctb/pages.c +++ b/pctb/pages.c @@ -225,6 +225,8 @@ static void compute_shift_mask(ShMask *sm, unsigned long ximage_mask) { } assert(sm->lshift < LONG_BIT); assert(sm->rshift < LONG_BIT); + debugf("SHIFTMASK %p={.lshift=%d, .rshift=%d} image_mask=%lx\n", + sm, sm->lshift, sm->rshift, ximage_mask); } static void rtimestamp(double *t, const char *wh) { @@ -273,13 +275,31 @@ static void snapshot(Snapshot **output) { int x,y,i; unsigned char *op= (*output)->data; for (y=0; y> shiftmasks[i].rshift) - & SAMPLEMASK; - *op++= sample; + if (im_use->xoffset == 0 && + im_use->format == ZPixmap && + im_use->byte_order == LSBFirst && + im_use->depth == 24 && + im_use->bits_per_pixel == 32 && + im_use->red_mask == 0x0000ffU && + im_use->green_mask == 0x00ff00U && + im_use->blue_mask == 0xff0000U) { + const char *p= im_use->data + y * im_use->bytes_per_line; +// debugf("optimised copy y=%d",y); + for (x=0; x> shiftmasks[i].rshift) + & SAMPLEMASK; + *op++= sample; + } } } } diff --git a/pctb/x.gdb b/pctb/x.gdb index 2088825..9c71346 100644 --- a/pctb/x.gdb +++ b/pctb/x.gdb @@ -1,4 +1,4 @@ file ypp-commodities -set args --same --test-servers --raw-tsv -break findchar +set args --screenshot-only --test-servers --single-page +break pages.c:277 run -- 2.30.2