+ Guchar*b = bitmap->getDataPtr() + y1*width8 + x1/8;
+ Guchar*u = update->getDataPtr() + y1*width8 + x1/8;
+ int yspan = y2-y1;
+ int xspan = (x2+7)/8 - x1/8;
+ int size = (y2-y1)*width8;
+
+ if(overwrite) {
+ int y;
+ for(y=0;y<yspan;y++) {
+ memcpy(b, u, xspan);
+ b += width8;
+ u += width8;
+ }
+ } else {
+ 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;
+ }
+ }
+ }
+}
+
+static void clearBooleanBitmap(SplashBitmap*btm, int x1, int y1, int x2, int y2)
+{
+ if(!fixBBox(&x1, &y1, &x2, &y2, btm->getWidth(), btm->getHeight()))
+ return;
+
+ if(btm->getMode()==splashModeMono1) {
+ int width8 = (btm->getWidth()+7)/8;
+ assert(width8 == btm->getRowSize());
+ int width = btm->getWidth();
+ int height = btm->getHeight();
+ Guchar*data = btm->getDataPtr();
+ memset(data+y1*width8, 0, width8*(y2-y1));
+ } else {
+ int width = btm->getAlphaRowSize();
+ int height = btm->getHeight();
+ memset(btm->getAlphaPtr(), 0, width*height);
+ }
+}
+
+void BitmapOutputDev::dbg_newdata(char*newdata)
+{