From bd6e5cd809f4fa605f8505fa06712981b3443537 Mon Sep 17 00:00:00 2001 From: Matthias Kramm <kramm@quiss.org> Date: Mon, 5 Apr 2010 14:17:58 -0700 Subject: [PATCH] use 64 bit operations to update boolean bitmaps --- lib/pdf/BitmapOutputDev.cc | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index e1cb3d3..49f5e3c 100644 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@ -468,13 +468,35 @@ static void update_bitmap(SplashBitmap*bitmap, SplashBitmap*update, int x1, int u += width8; } } else { - int x,y; - for(y=0;y<yspan;y++) { - for(x=0;x<xspan;x++) { - b[x] |= u[x]; + if(((ptroff_t)b&7)==((ptroff_t)u&7)) { + int x,y; + for(y=0;y<yspan;y++) { + Guchar*e1 = b+xspan-8; + Guchar*e2 = b+xspan; + while(((ptroff_t)b&7) && b<e1) { + *b |= *u; + b++;u++; + } + while(b<e1) { + *(long long*)b |= *(long long*)u; + b+=8;u+=8; + } + while(b<e2) { + *b |= *u; + b++;u++; + } + b += width8-xspan; + u += width8-xspan; + } + } else { + int x,y; + for(y=0;y<yspan;y++) { + for(x=0;x<xspan;x++) { + b[x] |= u[x]; + } + b += width8; + u += width8; } - b += width8; - u += width8; } } } -- 1.7.10.4