--- poppler-git-13may11-negative-fill/splash/Splash.cc- 2011-05-13 20:35:56.925576893 -0300 +++ poppler-git-13may11-negative-fill/splash/Splash.cc 2011-05-13 22:04:31.291643444 -0300 @@ -1759,17 +1759,23 @@ int yStart = y0 - glyph->y; int xxLimit = glyph->w; int yyLimit = glyph->h; + int xShift = 0; if (yStart < 0) { - p += glyph->w * -yStart; // move p to the beginning of the first painted row + p += (glyph->aa? glyph->w: splashCeil(glyph->w / 8.0)) * -yStart; // move p to the beginning of the first painted row yyLimit += yStart; yStart = 0; } if (xStart < 0) { - p += -xStart; // move p to the first painted pixel + if (glyph->aa) { + p += -xStart; + } else { + p += (-xStart) / 8; + xShift = (-xStart) % 8; + } xxLimit += xStart; xStart = 0; } @@ -1804,7 +1810,7 @@ for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { pipeSetXY(&pipe, xStart, y1); for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { - alpha0 = p[xx / 8]; + alpha0 = (xShift > 0? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)): p[xx / 8]); for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) { if (alpha0 & 0x80) { pipeRun(&pipe); @@ -1850,7 +1856,7 @@ for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { pipeSetXY(&pipe, xStart, y1); for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { - alpha0 = p[xx / 8]; + alpha0 = (xShift > 0? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)): p[xx / 8]); for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) { if (state->clip->test(x1, y1)) { if (alpha0 & 0x80) {