- 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;
- }
- }
-