summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2010-02-20 10:08:33 +0000
committerAlbert Astals Cid <aacid@kde.org>2010-02-20 10:08:33 +0000
commitd074485aa9d9fac6b715382002f53e3303bbc519 (patch)
tree9223cd1265ed9e282fa2daadc3a7477124e50bd2
parentd4cafe357bd86feb4b56e5dfbf5b7822e237a2ee (diff)
Do not call getPixel if we know how to access the data
Gives a 20% speed increase in some pdf
-rw-r--r--splash/Splash.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 202fe45c..8b115839 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -3163,7 +3163,7 @@ void Splash::compositeBackground(SplashColorPtr color) {
SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
int xDest, int yDest, int w, int h) {
SplashColor pixel;
- SplashColorPtr p;
+ SplashColorPtr p, sp;
Guchar *q;
int x, y, mask;
@@ -3203,23 +3203,24 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
case splashModeBGR8:
for (y = 0; y < h; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 3 * xDest];
+ sp = &src->data[(ySrc + y) * src->rowSize + 3 * xSrc];
for (x = 0; x < w; ++x) {
- src->getPixel(xSrc + x, ySrc + y, pixel);
- *p++ = pixel[0];
- *p++ = pixel[1];
- *p++ = pixel[2];
+ *p++ = *sp++;
+ *p++ = *sp++;
+ *p++ = *sp++;
}
}
break;
case splashModeXBGR8:
for (y = 0; y < h; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
+ sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc];
for (x = 0; x < w; ++x) {
- src->getPixel(xSrc + x, ySrc + y, pixel);
- *p++ = pixel[0];
- *p++ = pixel[1];
- *p++ = pixel[2];
+ *p++ = *sp++;
+ *p++ = *sp++;
+ *p++ = *sp++;
*p++ = 255;
+ *sp++;
}
}
break;