summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-10-30 19:39:18 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-11-06 12:05:32 +0100
commit173c460c26eaec9d81dc9eae6d5a73116cb3ac41 (patch)
tree67023b7bde5c88322f17db0c22b4b671e87090d4 /vcl
parent7b8c97984b1c0d747621235288718f675a3778f6 (diff)
QT5 rotate generated bitmap
QImage stores the scanlines from top => bottom. Change-Id: I0a176066ab631179b8460b61a6c2b07ad2179d31
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Bitmap.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/vcl/qt5/Qt5Bitmap.cxx b/vcl/qt5/Qt5Bitmap.cxx
index 524eaf6048c2..6fcff9e05663 100644
--- a/vcl/qt5/Qt5Bitmap.cxx
+++ b/vcl/qt5/Qt5Bitmap.cxx
@@ -193,23 +193,23 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
switch( pBuffer->mnBitCount )
{
case 1:
- pBuffer->mnFormat = ScanlineFormat::N1BitLsbPal;
+ pBuffer->mnFormat = ScanlineFormat::N1BitLsbPal | ScanlineFormat::TopDown;
pBuffer->maPalette = m_aPalette;
break;
case 4:
- pBuffer->mnFormat = ScanlineFormat::N4BitMsnPal;
+ pBuffer->mnFormat = ScanlineFormat::N4BitMsnPal | ScanlineFormat::TopDown;
pBuffer->maPalette = m_aPalette;
break;
case 8:
- pBuffer->mnFormat = ScanlineFormat::N8BitPal;
+ pBuffer->mnFormat = ScanlineFormat::N8BitPal | ScanlineFormat::TopDown;
pBuffer->maPalette = m_aPalette;
break;
case 16:
{
#ifdef OSL_BIGENDIAN
- pBuffer->mnFormat= ScanlineFormat::N16BitTcMsbMask;
+ pBuffer->mnFormat= ScanlineFormat::N16BitTcMsbMask | ScanlineFormat::TopDown;
#else
- pBuffer->mnFormat= ScanlineFormat::N16BitTcLsbMask;
+ pBuffer->mnFormat= ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::TopDown;
#endif
ColorMaskElement aRedMask(0xf800); // 5
aRedMask.CalcMaskShift();
@@ -222,12 +222,12 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
break;
}
case 24:
- pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb;
+ pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown;
pBuffer->maPalette = aEmptyPalette;
break;
case 32:
{
- pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb;
+ pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown;
pBuffer->maPalette = aEmptyPalette;
break;
}
@@ -239,6 +239,15 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
void Qt5Bitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode )
{
m_aPalette = pBuffer->maPalette;
+ auto count = m_aPalette.GetEntryCount();
+ if( pBuffer->mnBitCount != 4 && count )
+ {
+ QVector<QRgb> aColorTable( count );
+ for ( unsigned i = 0; i < count; ++i )
+ aColorTable[ i ] = qRgb( m_aPalette[ i ].GetRed(),
+ m_aPalette[ i ].GetGreen(), m_aPalette[ i ].GetBlue() );
+ m_pImage->setColorTable( aColorTable );
+ }
delete pBuffer;
}