SplashMono1P *mono1;
SplashMono8 *mono8;
SplashRGB8 *rgb8;
+ SplashRGB8P *rgb8pline, *rgb8p;
SplashBGR8P *bgr8line, *bgr8;
SplashMono1 data;
int n, i, x, y;
*rgb8 = color.rgb8;
}
break;
+ case splashModeRGB8Packed:
+ rgb8pline = bitmap->data.rgb8p;
+ for (y = 0; y < bitmap->height; ++y) {
+ rgb8p = rgb8pline;
+ for (x = 0; x < bitmap->width; ++x) {
+ rgb8p[0] = splashRGB8R(color.rgb8);
+ rgb8p[1] = splashRGB8G(color.rgb8);
+ rgb8p[2] = splashRGB8B(color.rgb8);
+ rgb8p += 3;
+ }
+ rgb8pline += bitmap->rowSize;
+ }
+ break;
case splashModeBGR8Packed:
bgr8line = bitmap->data.bgr8;
for (y = 0; y < bitmap->height; ++y) {
void Splash::drawPixel(int x, int y, SplashColor *color, GBool noClip) {
SplashMono1P *mono1;
+ SplashRGB8P *rgb8p;
SplashBGR8P *bgr8;
if (noClip || state->clip->test(x, y)) {
case splashModeRGB8:
bitmap->data.rgb8[y * bitmap->width + x] = color->rgb8;
break;
+ case splashModeRGB8Packed:
+ rgb8p = &bitmap->data.rgb8p[y * bitmap->rowSize + 3 * x];
+ rgb8p[0] = splashRGB8R(color->rgb8);
+ rgb8p[1] = splashRGB8G(color->rgb8);
+ rgb8p[2] = splashRGB8B(color->rgb8);
+ break;
case splashModeBGR8Packed:
bgr8 = &bitmap->data.bgr8[y * bitmap->rowSize + 3 * x];
bgr8[2] = splashBGR8R(color->bgr8);
void Splash::drawPixel(int x, int y, SplashPattern *pattern, GBool noClip) {
SplashColor color;
SplashMono1P *mono1;
+ SplashRGB8P *rgb8p;
SplashBGR8P *bgr8;
if (noClip || state->clip->test(x, y)) {
case splashModeRGB8:
bitmap->data.rgb8[y * bitmap->width + x] = color.rgb8;
break;
+ case splashModeRGB8Packed:
+ rgb8p = &bitmap->data.rgb8p[y * bitmap->rowSize + 3 * x];
+ rgb8p[0] = splashRGB8R(color.rgb8);
+ rgb8p[1] = splashRGB8G(color.rgb8);
+ rgb8p[2] = splashRGB8B(color.rgb8);
+ break;
case splashModeBGR8Packed:
bgr8 = &bitmap->data.bgr8[y * bitmap->rowSize + 3 * x];
bgr8[2] = splashBGR8R(color.bgr8);
SplashMono1P *mono1;
SplashMono8 *mono8;
SplashRGB8 *rgb8;
+ SplashRGB8P *rgb8p;
SplashBGR8P *bgr8;
SplashMono1 mask1;
int i, j, n;
}
break;
+ case splashModeRGB8Packed:
+ rgb8p = &bitmap->data.rgb8p[y * bitmap->rowSize + 3 * x0];
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ color = pattern->getColor(x0 + i, y);
+ rgb8p[0] = splashRGB8R(color.rgb8);
+ rgb8p[1] = splashRGB8G(color.rgb8);
+ rgb8p[2] = splashRGB8B(color.rgb8);
+ }
+ rgb8p += 3;
+ }
+ break;
+
case splashModeBGR8Packed:
bgr8 = &bitmap->data.bgr8[y * bitmap->rowSize + 3 * x0];
for (i = 0; i < n; ++i) {
SplashMono1P *mono1;
SplashMono8 *mono8;
SplashRGB8 *rgb8;
+ SplashRGB8P *rgb8p;
SplashBGR8P *bgr8;
SplashMono1 mask1;
int i, j, n;
}
break;
+ case splashModeRGB8Packed:
+ rgb8p = &bitmap->data.rgb8p[y * bitmap->rowSize + 3 * x0];
+ for (i = 0; i < n; ++i) {
+ if (noClip || state->clip->test(x0 + i, y)) {
+ color = pattern->getColor(x0 + i, y);
+ rgb8p[0] ^= splashRGB8R(color.rgb8);
+ rgb8p[1] ^= splashRGB8G(color.rgb8);
+ rgb8p[2] ^= splashRGB8B(color.rgb8);
+ }
+ rgb8p += 3;
+ }
+ break;
+
case splashModeBGR8Packed:
bgr8 = &bitmap->data.bgr8[y * bitmap->rowSize + 3 * x0];
for (i = 0; i < n; ++i) {
}
void Splash::getPixel(int x, int y, SplashColor *pixel) {
+ SplashRGB8P *rgb8p;
SplashBGR8P *bgr8;
if (y < 0 || y >= bitmap->height || x < 0 || x >= bitmap->width) {
case splashModeRGB8:
pixel->rgb8 = bitmap->data.rgb8[y * bitmap->width + x];
break;
+ case splashModeRGB8Packed:
+ rgb8p = &bitmap->data.rgb8p[y * bitmap->rowSize + 3 * x];
+ pixel->rgb8 = splashMakeRGB8(rgb8p[0], rgb8p[1], rgb8p[2]);
+ break;
case splashModeBGR8Packed:
bgr8 = &bitmap->data.bgr8[y * bitmap->rowSize + 3 * x];
pixel->bgr8 = splashMakeBGR8(bgr8[2], bgr8[1], bgr8[0]);
SplashMono1P *mono1Ptr;
SplashMono8 *mono8Ptr;
SplashRGB8 *rgb8Ptr;
+ SplashRGB8P *rgb8pPtr;
SplashBGR8P *bgr8Ptr;
SplashMono8 bgMono8;
int bgR, bgG, bgB;
(alpha * splashRGB8B(fg.rgb8) +
ialpha * bgB) >> 8);
break;
+ case splashModeRGB8Packed:
+ rgb8pPtr = &bitmap->data.rgb8p[y1 * bitmap->rowSize + 3 * x1];
+ rgb8pPtr[0] =
+ (alpha * splashRGB8R(fg.rgb8) + ialpha * rgb8pPtr[0]) >> 8;
+ rgb8pPtr[1] =
+ (alpha * splashRGB8G(fg.rgb8) + ialpha * rgb8pPtr[1]) >> 8;
+ rgb8pPtr[2] =
+ (alpha * splashRGB8B(fg.rgb8) + ialpha * rgb8pPtr[2]) >> 8;
+ break;
case splashModeBGR8Packed:
bgr8Ptr = &bitmap->data.bgr8[y1 * bitmap->rowSize + 3 * x1];
bgr8Ptr[2] =
case splashModeRGB8:
bitmap->data.rgb8[y1 * bitmap->width + x1] = fg.rgb8;
break;
+ case splashModeRGB8Packed:
+ rgb8pPtr = &bitmap->data.rgb8p[y1 * bitmap->rowSize + 3 * x1];
+ rgb8pPtr[0] = splashRGB8R(fg.rgb8);
+ rgb8pPtr[1] = splashRGB8G(fg.rgb8);
+ rgb8pPtr[2] = splashRGB8B(fg.rgb8);
+ break;
case splashModeBGR8Packed:
bgr8Ptr = &bitmap->data.bgr8[y1 * bitmap->rowSize + 3 * x1];
bgr8Ptr[2] = splashBGR8R(fg.bgr8);
(1 - alpha) * bg.mono8);
break;
case splashModeRGB8:
+ case splashModeRGB8Packed:
pix.rgb8 = splashMakeRGB8(
splashRound(alpha * splashRGB8R(fg.rgb8) +
(1 - alpha) * splashRGB8R(bg.rgb8)),
(1 - alpha) * splashRGB8G(bg.rgb8)),
splashRound(alpha * splashRGB8B(fg.rgb8) +
(1 - alpha) * splashRGB8B(bg.rgb8)));
+ break;
case splashModeBGR8Packed:
pix.bgr8 = splashMakeBGR8(
splashRound(alpha * splashBGR8R(fg.bgr8) +
case splashModeRGB8:
ok = srcMode == splashModeRGB8;
break;
+ case splashModeRGB8Packed:
+ ok = srcMode == splashModeRGB8Packed;
+ break;
case splashModeBGR8Packed:
ok = srcMode == splashModeBGR8Packed;
break;
pixAcc[0] += p->mono8;
break;
case splashModeRGB8:
+ case splashModeRGB8Packed:
pixAcc[0] += splashRGB8R(p->rgb8);
pixAcc[1] += splashRGB8G(p->rgb8);
pixAcc[2] += splashRGB8B(p->rgb8);
pix.mono8 = splashRound(pixAcc[0] * pixMul);
break;
case splashModeRGB8:
+ case splashModeRGB8Packed:
pix.rgb8 = splashMakeRGB8(splashRound(pixAcc[0] * pixMul),
splashRound(pixAcc[1] * pixMul),
splashRound(pixAcc[2] * pixMul));
GDKSplashOutputDev::GDKSplashOutputDev(GdkScreen *screen,
void (*redrawCbkA)(void *data),
void *redrawCbkDataA):
- SplashOutputDev(splashModeRGB8, gFalse, makeSplashColor (255,255,255)),
+ SplashOutputDev(splashModeRGB8Packed, gFalse, makeSplashColor (255,255,255)),
incrementalUpdate (1)
{
redrawCbk = redrawCbkA;
GdkDrawable *drawable,
int destX, int destY,
int width, int height) {
- SplashColorPtr dataPtr;
GdkGC *gc;
- guchar *gdk_buf;
int gdk_rowstride;
- int bw, x, y, r, g, b;
- gdk_rowstride = width * 3;
-
- /* better to draw nothing than crash on a huge image */
- gdk_buf = (guchar*) g_try_malloc (height * gdk_rowstride);
- if (gdk_buf == NULL)
- return;
-
- bw = getBitmap()->getWidth();
- dataPtr = getBitmap()->getDataPtr();
-
- for (y = 0; y < height; ++y)
- {
- SplashRGB8 *p;
- SplashRGB8 rgb;
- guchar *gdk_p;
-
- p = dataPtr.rgb8 + (y + srcY) * bw + srcX;
- gdk_p = gdk_buf + y * gdk_rowstride;
- for (x = 0; x < width; ++x)
- {
- rgb = *p++;
- r = splashRGB8R(rgb);
- g = splashRGB8G(rgb);
- b = splashRGB8B(rgb);
-
- *gdk_p++ = r;
- *gdk_p++ = g;
- *gdk_p++ = b;
- }
- }
-
+ gdk_rowstride = getBitmap()->getRowSize();
gc = gdk_gc_new (drawable);
gdk_draw_rgb_image (drawable, gc,
destX, destY,
width, height,
GDK_RGB_DITHER_NORMAL,
- gdk_buf,
+ getBitmap()->getDataPtr().rgb8p + srcY * gdk_rowstride + srcX,
gdk_rowstride);
g_object_unref (gc);
-
- g_free (gdk_buf);
}
void GDKSplashOutputDev::drawToPixbuf(GdkPixbuf *pixbuf, int pageNum) {