[poppler] poppler/splash: Splash.cc, 1.5, 1.6 SplashBitmap.cc, 1.2,
1.3
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue Apr 4 14:01:03 PDT 2006
Update of /cvs/poppler/poppler/splash
In directory kemper:/tmp/cvs-serv26801/splash
Modified Files:
Splash.cc SplashBitmap.cc
Log Message:
* splash/Splash.cc:
* splash/SplashBitmap.cc: Make Splashbitmap RGB8 use 32bits internally
* qt/poppler-page.cc:
* qt4/src/poppler-page.cc: Adapt to splashbitmap change so copying to
QImage is faster.
Patch by Frank Meerkötter slightly modified by Albert Astals Cid
I'll leave adapting the glib frontend for you guys, i tried to adapt it but i got lost at gdk_pixbuf_get_n_channels (pixbuf);
Index: Splash.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/Splash.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Splash.cc 6 Feb 2006 20:49:21 -0000 1.5
+++ Splash.cc 4 Apr 2006 21:01:01 -0000 1.6
@@ -319,9 +319,10 @@
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];
+ *p++ = color[1];
+ *p++ = color[0];
+ *p++ = 255;
}
row += bitmap->rowSize;
}
@@ -963,11 +964,11 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * x];
(*blendFunc)(color, p, blend, bitmap->mode);
- p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[0] = (alpha2 * blend[2] + ialpha2 * p[0]) >> 8;
p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
- p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ p[2] = (alpha2 * blend[0] + ialpha2 * p[2]) >> 8;
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -1014,10 +1015,10 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x];
- p[0] = color[0];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * x];
+ p[0] = color[2];
p[1] = color[1];
- p[2] = color[2];
+ p[2] = color[0];
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -1092,11 +1093,11 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * x];
(*blendFunc)(color, p, blend, bitmap->mode);
- p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[0] = (alpha2 * blend[2] + ialpha2 * p[0]) >> 8;
p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
- p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ p[2] = (alpha2 * blend[0] + ialpha2 * p[2]) >> 8;
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -1144,10 +1145,10 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x];
- p[0] = color[0];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * x];
+ p[0] = color[2];
p[1] = color[1];
- p[2] = color[2];
+ p[2] = color[0];
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -1405,7 +1406,7 @@
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x0];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * x0];
if (pattern->isStatic()) {
pattern->getColor(0, 0, color);
for (i = 0; i < n; ++i) {
@@ -1416,15 +1417,15 @@
ialpha2 = 255 - alpha2;
}
(*blendFunc)(color, p, blend, bitmap->mode);
- p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8;
+ p[0] = (alpha2 * blend[2] + ialpha2 * p[0]) >> 8;
p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8;
- p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8;
+ p[2] = (alpha2 * blend[0] + ialpha2 * p[2]) >> 8;
if (!noClip) {
updateModX(x0 + i);
updateModY(y);
}
}
- p += 3;
+ p += 4;
}
} else {
for (i = 0; i < n; ++i) {
@@ -1444,7 +1445,7 @@
updateModY(y);
}
}
- p += 3;
+ p += 4;
}
}
break;
@@ -1698,20 +1699,20 @@
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x0];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * 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[0] = color[2];
p[1] = color[1];
- p[2] = color[2];
+ p[2] = color[0];
if (!noClip) {
updateModX(x0 + i);
updateModY(y);
}
}
- p += 3;
+ p += 4;
}
} else {
for (i = 0; i < n; ++i) {
@@ -1725,7 +1726,7 @@
updateModY(y);
}
}
- p += 3;
+ p += 4;
}
}
break;
@@ -1898,19 +1899,19 @@
case splashModeRGB8:
case splashModeBGR8:
- p = &bitmap->data[y * bitmap->rowSize + 3 * x0];
+ p = &bitmap->data[y * bitmap->rowSize + 4 * 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[0] ^= color[2];
p[1] ^= color[1];
- p[2] ^= color[2];
+ p[2] ^= color[0];
if (!noClip) {
updateModX(x0 + i);
updateModY(y);
}
}
- p += 3;
+ p += 4;
}
break;
@@ -2055,11 +2056,11 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
+ pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
(*blendFunc)(fg, pix, blend, bitmap->mode);
- pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8;
+ pix[0] = (alpha * blend[2] + ialpha * pix[0]) >> 8;
pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8;
- pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8;
+ pix[2] = (alpha * blend[0] + ialpha * pix[2]) >> 8;
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -2136,11 +2137,11 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
+ pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
(*blendFunc)(fg, pix, blend, bitmap->mode);
- pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8;
+ pix[0] = (alpha * blend[2] + ialpha * pix[0]) >> 8;
pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8;
- pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8;
+ pix[2] = (alpha * blend[0] + ialpha * pix[2]) >> 8;
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -2211,10 +2212,10 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
- pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8;
+ 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;
- pix[2] = (alpha * fg[2] + ialpha * pix[2]) >> 8;
+ pix[2] = (alpha * fg[0] + ialpha * pix[2]) >> 8;
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -2276,10 +2277,10 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1];
- pix[0] = fg[0];
+ pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1];
+ pix[0] = fg[2];
pix[1] = fg[1];
- pix[2] = fg[2];
+ pix[2] = fg[0];
break;
case splashModeARGB8:
case splashModeBGRA8:
Index: SplashBitmap.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashBitmap.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SplashBitmap.cc 30 Oct 2005 20:29:05 -0000 1.2
+++ SplashBitmap.cc 4 Apr 2006 21:01:01 -0000 1.3
@@ -36,7 +36,7 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- rowSize = width * 3;
+ rowSize = width * 4;
break;
case splashModeARGB8:
case splashModeBGRA8:
@@ -128,7 +128,7 @@
fputc(splashRGB8R(p), f);
fputc(splashRGB8G(p), f);
fputc(splashRGB8B(p), f);
- p += 3;
+ p += 4;
}
row += rowSize;
}
@@ -213,10 +213,10 @@
break;
case splashModeRGB8:
case splashModeBGR8:
- p = &data[y * rowSize + 3 * x];
- pixel[0] = p[0];
+ p = &data[y * rowSize + 4 * x];
+ pixel[0] = p[2];
pixel[1] = p[1];
- pixel[2] = p[2];
+ pixel[2] = p[0];
break;
case splashModeARGB8:
case splashModeBGRA8:
More information about the poppler
mailing list