summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Bitmap.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-11-08 11:28:04 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-11-08 15:35:18 +0100
commitb536e10390c171e96b6477c04d66023a1da543c4 (patch)
tree4c04275831cea51f0a343d00e382f519a08bcd90 /vcl/qt5/Qt5Bitmap.cxx
parent958c09acc1058a4a0eba28ac94f2883fff64d600 (diff)
Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-format
...even if that can cause reformatting of already formatted code. The problem I came across is that without this something like > namespace { > > void f1(); > > void f2(); > > } (which is quite a common style in the current code base) would be changed to > namespace > { > > void f1(); > > void f2(); > } instead of > namespace > { > void f1(); > > void f2(); > } and I found no other clang-format style option that would result in the presence or absence of an empty line be identical at the start and end of the namespace block. vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the same time, so this commit includes that. Some of those new files had not been formatted at all, so this commit includes their full reformatting changes. Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c Reviewed-on: https://gerrit.libreoffice.org/44450 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/qt5/Qt5Bitmap.cxx')
-rw-r--r--vcl/qt5/Qt5Bitmap.cxx157
1 files changed, 65 insertions, 92 deletions
diff --git a/vcl/qt5/Qt5Bitmap.cxx b/vcl/qt5/Qt5Bitmap.cxx
index 6fcff9e05663..0f312e0057e2 100644
--- a/vcl/qt5/Qt5Bitmap.cxx
+++ b/vcl/qt5/Qt5Bitmap.cxx
@@ -25,117 +25,96 @@
#include <QtCore/QVector>
#include <QtGui/QColor>
-Qt5Bitmap::Qt5Bitmap()
-{
-}
+Qt5Bitmap::Qt5Bitmap() {}
-Qt5Bitmap::Qt5Bitmap( const QImage &rImage )
-{
- m_pImage.reset( new QImage( rImage ) );
-}
+Qt5Bitmap::Qt5Bitmap(const QImage& rImage) { m_pImage.reset(new QImage(rImage)); }
-Qt5Bitmap::~Qt5Bitmap()
-{
-}
+Qt5Bitmap::~Qt5Bitmap() {}
-bool Qt5Bitmap::Create( const Size& rSize, sal_uInt16 nBitCount,
- const BitmapPalette& rPal )
+bool Qt5Bitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal)
{
- assert(
- (nBitCount == 1
- || nBitCount == 4
- || nBitCount == 8
- || nBitCount == 16
- || nBitCount == 24
- || nBitCount == 32)
- && "Unsupported BitCount!");
+ assert((nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24
+ || nBitCount == 32)
+ && "Unsupported BitCount!");
- if ( nBitCount == 1 )
- assert( 2 == rPal.GetEntryCount() );
- if ( nBitCount == 4 )
- assert( 16 == rPal.GetEntryCount() );
- if ( nBitCount == 8 )
- assert( 256 == rPal.GetEntryCount() );
+ if (nBitCount == 1)
+ assert(2 == rPal.GetEntryCount());
+ if (nBitCount == 4)
+ assert(16 == rPal.GetEntryCount());
+ if (nBitCount == 8)
+ assert(256 == rPal.GetEntryCount());
- if ( nBitCount == 4 )
+ if (nBitCount == 4)
{
m_pImage.reset();
m_aSize = rSize;
m_nScanline = rSize.Width() / 2 + (rSize.Width() % 2) ? 0 : 1;
- m_pBuffer.reset( new sal_uInt8[ m_nScanline * rSize.Height() ] );
+ m_pBuffer.reset(new sal_uInt8[m_nScanline * rSize.Height()]);
}
else
{
- m_pImage.reset( new QImage( toQSize( rSize ), getBitFormat( nBitCount ) ) );
+ m_pImage.reset(new QImage(toQSize(rSize), getBitFormat(nBitCount)));
m_pBuffer.reset();
}
m_aPalette = rPal;
auto count = rPal.GetEntryCount();
- if( nBitCount != 4 && count )
+ if (nBitCount != 4 && count)
{
- QVector<QRgb> aColorTable( count );
- for ( unsigned i = 0; i < count; ++i )
- aColorTable[ i ] = qRgb( rPal[ i ].GetRed(),
- rPal[ i ].GetGreen(), rPal[ i ].GetBlue() );
- m_pImage->setColorTable( aColorTable );
+ QVector<QRgb> aColorTable(count);
+ for (unsigned i = 0; i < count; ++i)
+ aColorTable[i] = qRgb(rPal[i].GetRed(), rPal[i].GetGreen(), rPal[i].GetBlue());
+ m_pImage->setColorTable(aColorTable);
}
return true;
}
-bool Qt5Bitmap::Create( const SalBitmap& rSalBmp )
+bool Qt5Bitmap::Create(const SalBitmap& rSalBmp)
{
- const Qt5Bitmap *pBitmap = static_cast< const Qt5Bitmap*>( &rSalBmp );
- if ( pBitmap->m_pImage.get() )
+ const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp);
+ if (pBitmap->m_pImage.get())
{
- m_pImage.reset( new QImage( *pBitmap->m_pImage.get() ) );
+ m_pImage.reset(new QImage(*pBitmap->m_pImage.get()));
m_pBuffer.reset();
}
else
{
m_aSize = pBitmap->m_aSize;
m_nScanline = pBitmap->m_nScanline;
- m_pBuffer.reset( new sal_uInt8[ m_nScanline * m_aSize.Height() ] );
- memcpy( m_pBuffer.get(), pBitmap->m_pBuffer.get(), m_nScanline );
+ m_pBuffer.reset(new sal_uInt8[m_nScanline * m_aSize.Height()]);
+ memcpy(m_pBuffer.get(), pBitmap->m_pBuffer.get(), m_nScanline);
m_pImage.reset();
}
m_aPalette = pBitmap->m_aPalette;
return true;
}
-bool Qt5Bitmap::Create( const SalBitmap& rSalBmp,
- SalGraphics* pSalGraphics )
+bool Qt5Bitmap::Create(const SalBitmap& rSalBmp, SalGraphics* pSalGraphics)
{
- const Qt5Bitmap *pBitmap = static_cast< const Qt5Bitmap *>( &rSalBmp );
- Qt5Graphics *pGraphics = static_cast< Qt5Graphics* >( pSalGraphics );
- QImage *pImage = pGraphics->m_pQImage;
- m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( pImage->format() ) ) );
+ const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp);
+ Qt5Graphics* pGraphics = static_cast<Qt5Graphics*>(pSalGraphics);
+ QImage* pImage = pGraphics->m_pQImage;
+ m_pImage.reset(new QImage(pBitmap->m_pImage->convertToFormat(pImage->format())));
m_pBuffer.reset();
return true;
}
-bool Qt5Bitmap::Create( const SalBitmap& rSalBmp,
- sal_uInt16 nNewBitCount )
+bool Qt5Bitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount)
{
- assert(
- (nNewBitCount == 1
- || nNewBitCount == 4
- || nNewBitCount == 8
- || nNewBitCount == 16
- || nNewBitCount == 24
- || nNewBitCount == 32)
- && "Unsupported BitCount!");
+ assert((nNewBitCount == 1 || nNewBitCount == 4 || nNewBitCount == 8 || nNewBitCount == 16
+ || nNewBitCount == 24 || nNewBitCount == 32)
+ && "Unsupported BitCount!");
- const Qt5Bitmap *pBitmap = static_cast< const Qt5Bitmap *>( &rSalBmp );
- if ( pBitmap->m_pBuffer.get() )
+ const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp);
+ if (pBitmap->m_pBuffer.get())
return false;
- m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( getBitFormat( nNewBitCount ) ) ) );
+ m_pImage.reset(new QImage(pBitmap->m_pImage->convertToFormat(getBitFormat(nNewBitCount))));
return true;
}
-bool Qt5Bitmap::Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
- Size& rSize, bool bMask )
+bool Qt5Bitmap::Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
+ Size& rSize, bool bMask)
{
return false;
}
@@ -148,32 +127,32 @@ void Qt5Bitmap::Destroy()
Size Qt5Bitmap::GetSize() const
{
- if ( m_pBuffer.get() )
+ if (m_pBuffer.get())
return m_aSize;
- else if ( m_pImage.get() )
- return toSize( m_pImage->size() );
+ else if (m_pImage.get())
+ return toSize(m_pImage->size());
return Size();
}
sal_uInt16 Qt5Bitmap::GetBitCount() const
{
- if ( m_pBuffer.get() )
+ if (m_pBuffer.get())
return 4;
- else if ( m_pImage.get() )
- return getFormatBits( m_pImage->format() );
+ else if (m_pImage.get())
+ return getFormatBits(m_pImage->format());
return 0;
}
-BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
+BitmapBuffer* Qt5Bitmap::AcquireBuffer(BitmapAccessMode nMode)
{
static const BitmapPalette aEmptyPalette;
- if ( !(m_pImage.get() || m_pBuffer.get()) )
+ if (!(m_pImage.get() || m_pBuffer.get()))
return nullptr;
BitmapBuffer* pBuffer = new BitmapBuffer;
- if ( m_pBuffer.get() )
+ if (m_pBuffer.get())
{
pBuffer->mnWidth = m_aSize.Width();
pBuffer->mnHeight = m_aSize.Height();
@@ -185,12 +164,12 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
{
pBuffer->mnWidth = m_pImage->width();
pBuffer->mnHeight = m_pImage->height();
- pBuffer->mnBitCount = getFormatBits( m_pImage->format() );
+ pBuffer->mnBitCount = getFormatBits(m_pImage->format());
pBuffer->mpBits = m_pImage->bits();
pBuffer->mnScanlineSize = m_pImage->bytesPerLine();
}
- switch( pBuffer->mnBitCount )
+ switch (pBuffer->mnBitCount)
{
case 1:
pBuffer->mnFormat = ScanlineFormat::N1BitLsbPal | ScanlineFormat::TopDown;
@@ -207,9 +186,9 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
case 16:
{
#ifdef OSL_BIGENDIAN
- pBuffer->mnFormat= ScanlineFormat::N16BitTcMsbMask | ScanlineFormat::TopDown;
+ pBuffer->mnFormat = ScanlineFormat::N16BitTcMsbMask | ScanlineFormat::TopDown;
#else
- pBuffer->mnFormat= ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::TopDown;
+ pBuffer->mnFormat = ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::TopDown;
#endif
ColorMaskElement aRedMask(0xf800); // 5
aRedMask.CalcMaskShift();
@@ -236,37 +215,31 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
return pBuffer;
}
-void Qt5Bitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode )
+void Qt5Bitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode)
{
m_aPalette = pBuffer->maPalette;
auto count = m_aPalette.GetEntryCount();
- if( pBuffer->mnBitCount != 4 && count )
+ 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 );
+ 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;
}
-bool Qt5Bitmap::GetSystemData( BitmapSystemData& rData )
-{
- return false;
-}
+bool Qt5Bitmap::GetSystemData(BitmapSystemData& rData) { return false; }
-bool Qt5Bitmap::ScalingSupported() const
-{
- return false;
-}
+bool Qt5Bitmap::ScalingSupported() const { return false; }
-bool Qt5Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag )
+bool Qt5Bitmap::Scale(const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag)
{
return false;
}
-bool Qt5Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol )
+bool Qt5Bitmap::Replace(const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol)
{
return false;
}