[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kuickshow/src
From: Carsten Pfeiffer <carpdjih () mailbox ! tu-berlin ! de>
Date: 2004-12-29 11:59:32
Message-ID: 20041229115932.46BC01C39E () office ! kde ! org
[Download RAW message or body]
CVS commit by pfeiffer:
fix the colors
M +11 -6 imlibwidget.cpp 1.17
--- kdegraphics/kuickshow/src/imlibwidget.cpp #1.16:1.17
@@ -802,14 +802,19 @@ ImlibImage * ImageCache::loadImageWithQt
// convert to 24 bpp (discard alpha)
int numPixels = image.width() * image.height();
- const int NUM_BYTES_ORIG = 4; // 32 bpp
const int NUM_BYTES_NEW = 3; // 24 bpp
uchar *newImageData = new uchar[numPixels * NUM_BYTES_NEW];
uchar *newData = newImageData;
- uchar *origData = image.bits();
- for (int i = 0; i < numPixels; i++) {
- memcpy( newData, origData , NUM_BYTES_NEW);
- newData += NUM_BYTES_NEW;
- origData += NUM_BYTES_ORIG;
+ int w = image.width();
+ int h = image.height();
+
+ for (int y = 0; y < h; y++) {
+ QRgb *scanLine = reinterpret_cast<QRgb *>( image.scanLine(y) );
+ for (int x = 0; x < w; x++) {
+ const QRgb& pixel = scanLine[x];
+ *(newData++) = qRed(pixel);
+ *(newData++) = qGreen(pixel);
+ *(newData++) = qBlue(pixel);
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic