[poppler] poppler/splash: Splash.cc, 1.6, 1.7 SplashBitmap.cc, 1.3,
1.4 SplashTypes.h, 1.4, 1.5
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue May 23 13:49:18 PDT 2006
Update of /cvs/poppler/poppler/splash
In directory kemper:/tmp/cvs-serv10254/splash
Modified Files:
Splash.cc SplashBitmap.cc SplashTypes.h
Log Message:
* poppler/SplashOutputDev.cc:
* qt4/src/poppler-private.h:
* splash/Splash.cc:
* splash/SplashBitmap.cc:
* splash/SplashTypes.h: bring splashModeRGB8 back to the old code
(before Frank's patch), create splashModeRGB8Qt that has Frank's
codepath and is used by Qt frontends. Fixes corruption on
other programs expecting the old behaviour.
Remember dude we are now a lib! you can not change behaviour from one day to another!
/me hits himself
Index: Splash.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/Splash.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Splash.cc 4 Apr 2006 21:01:01 -0000 1.6
+++ Splash.cc 23 May 2006 20:49:16 -0000 1.7
@@ -319,6 +319,27 @@
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
+ *p++ = color[0];
+ *p++ = color[1];
+ *p++ = color[2];
+ }
+ row += bitmap->rowSize;
+ }
+ }
+ break;
+ case splashModeRGB8Qt:
+ if (color[0] == color[1] && color[1] == color[2]) {
+ if (bitmap->rowSize < 0) {
+ memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
+ color[0], -bitmap->rowSize * bitmap->height);
+ } else {
+ memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
+ }
+ } else {
+ row = bitmap->data;
+ for (y = 0; y < bitmap->height; ++y) {
+ p = row;
+ for (x = 0; x < bitmap->width; ++x) {
*p++ = color[2];
*p++ = color[1];
*p++ = color[0];
@@ -964,6 +985,13 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x];
+ (*blendFunc)(color, p, blend, bitmap->mode);
+ p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
+ p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ break;
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x];
(*blendFunc)(color, p, blend, bitmap->mode);
p[0] = (alpha2 * blend[2] + ialpha2 * p[0]) >> 8;
@@ -1015,6 +1043,12 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x];
+ p[0] = color[0];
+ p[1] = color[1];
+ p[2] = color[2];
+ break;
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x];
p[0] = color[2];
p[1] = color[1];
@@ -1093,6 +1127,13 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x];
+ (*blendFunc)(color, p, blend, bitmap->mode);
+ p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
+ p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ break;
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x];
(*blendFunc)(color, p, blend, bitmap->mode);
p[0] = (alpha2 * blend[2] + ialpha2 * p[0]) >> 8;
@@ -1145,6 +1186,12 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x];
+ p[0] = color[0];
+ p[1] = color[1];
+ p[2] = color[2];
+ break;
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x];
p[0] = color[2];
p[1] = color[1];
@@ -1406,6 +1453,51 @@
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x0];
+ if (pattern->isStatic()) {
+ pattern->getColor(0, 0, color);
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ if (softMask) {
+ alpha2 = (int)(alpha *
+ softMask->data[y * softMask->rowSize + x0 + i]);
+ ialpha2 = 255 - alpha2;
+ }
+ (*blendFunc)(color, p, blend, bitmap->mode);
+ p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
+ p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ if (!noClip) {
+ updateModX(x0 + i);
+ updateModY(y);
+ }
+ }
+ p += 3;
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ pattern->getColor(x0 + i, y, color);
+ if (softMask) {
+ alpha2 = (int)(alpha *
+ softMask->data[y * softMask->rowSize + x0 + i]);
+ ialpha2 = 255 - alpha2;
+ }
+ (*blendFunc)(color, p, blend, bitmap->mode);
+ p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
+ p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ if (!noClip) {
+ updateModX(x0 + i);
+ updateModY(y);
+ }
+ }
+ p += 3;
+ }
+ }
+ break;
+
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x0];
if (pattern->isStatic()) {
pattern->getColor(0, 0, color);
@@ -1699,6 +1791,39 @@
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x0];
+ if (pattern->isStatic()) {
+ pattern->getColor(0, 0, color);
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ p[0] = color[0];
+ p[1] = color[1];
+ p[2] = color[2];
+ if (!noClip) {
+ updateModX(x0 + i);
+ updateModY(y);
+ }
+ }
+ p += 3;
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ pattern->getColor(x0 + i, y, color);
+ p[0] = color[0];
+ p[1] = color[1];
+ p[2] = color[2];
+ if (!noClip) {
+ updateModX(x0 + i);
+ updateModY(y);
+ }
+ }
+ p += 3;
+ }
+ }
+ break;
+
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x0];
if (pattern->isStatic()) {
pattern->getColor(0, 0, color);
@@ -1899,6 +2024,23 @@
case splashModeRGB8:
case splashModeBGR8:
+ p = &bitmap->data[y * bitmap->rowSize + 3 * x0];
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ pattern->getColor(x0 + i, y, color);
+ p[0] ^= color[0];
+ p[1] ^= color[1];
+ p[2] ^= color[2];
+ if (!noClip) {
+ updateModX(x0 + i);
+ updateModY(y);
+ }
+ }
+ p += 3;
+ }
+ break;
+
+ case splashModeRGB8Qt:
p = &bitmap->data[y * bitmap->rowSize + 4 * x0];
for (i = 0; i < n; ++i) {
if (noClip || state->clip->test(x0 + i, y)) {
@@ -2056,6 +2198,13 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
+ (*blendFunc)(fg, pix, blend, bitmap->mode);
+ pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8;
+ pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8;
+ pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8;
+ break;
+ case splashModeRGB8Qt:
pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
(*blendFunc)(fg, pix, blend, bitmap->mode);
pix[0] = (alpha * blend[2] + ialpha * pix[0]) >> 8;
@@ -2137,6 +2286,13 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
+ (*blendFunc)(fg, pix, blend, bitmap->mode);
+ pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8;
+ pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8;
+ pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8;
+ break;
+ case splashModeRGB8Qt:
pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
(*blendFunc)(fg, pix, blend, bitmap->mode);
pix[0] = (alpha * blend[2] + ialpha * pix[0]) >> 8;
@@ -2212,6 +2368,12 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
+ pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8;
+ pix[1] = (alpha * fg[1] + ialpha * pix[1]) >> 8;
+ pix[2] = (alpha * fg[2] + ialpha * pix[2]) >> 8;
+ break;
+ case splashModeRGB8Qt:
pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
pix[0] = (alpha * fg[2] + ialpha * pix[0]) >> 8;
pix[1] = (alpha * fg[1] + ialpha * pix[1]) >> 8;
@@ -2277,6 +2439,12 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
+ pix[0] = fg[0];
+ pix[1] = fg[1];
+ pix[2] = fg[2];
+ break;
+ case splashModeRGB8Qt:
pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
pix[0] = fg[2];
pix[1] = fg[1];
@@ -2634,6 +2802,7 @@
ok = gFalse;
nComps = 2;
break;
+ case splashModeRGB8Qt:
case splashModeRGB8:
ok = srcMode == splashModeRGB8 || srcMode == splashModeARGB8;
srcAlpha = srcMode == splashModeARGB8;
Index: SplashBitmap.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashBitmap.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- SplashBitmap.cc 4 Apr 2006 21:01:01 -0000 1.3
+++ SplashBitmap.cc 23 May 2006 20:49:16 -0000 1.4
@@ -36,8 +36,9 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- rowSize = width * 4;
+ rowSize = width * 3;
break;
+ case splashModeRGB8Qt:
case splashModeARGB8:
case splashModeBGRA8:
#if SPLASH_CMYK
@@ -128,7 +129,7 @@
fputc(splashRGB8R(p), f);
fputc(splashRGB8G(p), f);
fputc(splashRGB8B(p), f);
- p += 4;
+ p += 3;
}
row += rowSize;
}
@@ -149,6 +150,21 @@
}
break;
+ case splashModeRGB8Qt:
+ fprintf(f, "P6\n%d %d\n255\n", width, height);
+ row = data;
+ for (y = 0; y < height; ++y) {
+ p = row;
+ for (x = 0; x < width; ++x) {
+ fputc(splashRGB8R(p), f);
+ fputc(splashRGB8G(p), f);
+ fputc(splashRGB8B(p), f);
+ p += 4;
+ }
+ row += rowSize;
+ }
+ break;
+
case splashModeARGB8:
fprintf(f, "P6\n%d %d\n255\n", width, height);
row = data;
@@ -213,6 +229,12 @@
break;
case splashModeRGB8:
case splashModeBGR8:
+ p = &data[y * rowSize + 3 * x];
+ pixel[0] = p[0];
+ pixel[1] = p[1];
+ pixel[2] = p[2];
+ break;
+ case splashModeRGB8Qt:
p = &data[y * rowSize + 4 * x];
pixel[0] = p[2];
pixel[1] = p[1];
Index: SplashTypes.h
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashTypes.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- SplashTypes.h 6 Feb 2006 20:49:21 -0000 1.4
+++ SplashTypes.h 23 May 2006 20:49:16 -0000 1.5
@@ -36,6 +36,8 @@
// BGRBGR...
splashModeARGB8, // 1 byte per component, 4 bytes per pixel:
// ARGBARGB...
+ splashModeRGB8Qt, // 1 byte per component, 4 bytes per pixel:
+ // Specially hacked to use in Qt frontends
splashModeBGRA8 // 1 byte per component, 4 bytes per pixel:
// BGRABGRA...
#if SPLASH_CMYK
More information about the poppler
mailing list