Commit 7d4bb053 authored by Albert Astals Cid's avatar Albert Astals Cid

fix all is blue issue on ppc machines

parent 655af1e0
2006-05-21 Albert Astals Cid <aacid@kde.org>
* qt4/src/poppler-page.cc:
* qt/src/poppler-page.cc: Swap byte order on bigendian machines.
Thanks a lot to Jonathan Riddell <jr@jriddell.org> for letting me use
his minimac for testing
2006-05-19 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-action.h:
......
......@@ -77,6 +77,23 @@ QImage Page::renderToImage(double xres, double yres) const
int bw = output_dev->getBitmap()->getWidth();
int bh = output_dev->getBitmap()->getHeight();
SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr();
if (QImage::BigEndian == QImage::systemByteOrder())
{
uchar c;
int count = bw * bh * 4;
for (int k = 0; k < count; k += 4)
{
c = dataPtr[k];
dataPtr[k] = dataPtr[k+3];
dataPtr[k+3] = c;
c = dataPtr[k+1];
dataPtr[k+1] = dataPtr[k+2];
dataPtr[k+2] = c;
}
}
// construct a qimage SHARING the raw bitmap data in memory
QImage img( dataPtr, bw, bh, 32, 0, 0, QImage::IgnoreEndian );
img = img.copy();
......
......@@ -69,6 +69,23 @@ QImage Page::splashRenderToImage(double xres, double yres, int x, int y, int w,
int bh = bitmap->getHeight();
SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr();
if (QSysInfo::BigEndian == QSysInfo::ByteOrder)
{
uchar c;
int count = bw * bh * 4;
for (int k = 0; k < count; k += 4)
{
c = dataPtr[k];
dataPtr[k] = dataPtr[k+3];
dataPtr[k+3] = c;
c = dataPtr[k+1];
dataPtr[k+1] = dataPtr[k+2];
dataPtr[k+2] = c;
}
}
// construct a qimage SHARING the raw bitmap data in memory
QImage img( dataPtr, bw, bh, QImage::Format_ARGB32 );
img = img.copy();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment