diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-24 13:39:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-24 18:49:04 +0000 |
commit | 9b52b8999be86e5c6e5f5901b2640b16f08a2323 (patch) | |
tree | 218897a0bf04cb0cca2e0840d53378db16dda8db /vcl | |
parent | f9588062dd22771395ed8e076f009deb23a0092f (diff) |
Resolves: tdf#95962 incorrect scanline stride
we were reusing the stride of the surface we were cloning,
but the new surface has a different underlying size.
remove the custom stride argument and just change our stride
calculation to use the same scheme that cairo and GDI uses, which
remove another platform/drawing-system variable
Change-Id: I257dac9757b121642e9ccfde7db0911edc9f3fb1
Reviewed-on: https://gerrit.libreoffice.org/20149
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpbmp.cxx | 6 | ||||
-rw-r--r-- | vcl/headless/svpframe.cxx | 3 | ||||
-rw-r--r-- | vcl/headless/svpgdi.cxx | 5 | ||||
-rw-r--r-- | vcl/headless/svpvd.cxx | 7 | ||||
-rw-r--r-- | vcl/qa/cppunit/BitmapTest.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/gtk/gtksalframe.cxx | 6 |
6 files changed, 17 insertions, 25 deletions
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx index 685463c894dc..02f1453ede59 100644 --- a/vcl/headless/svpbmp.cxx +++ b/vcl/headless/svpbmp.cxx @@ -50,9 +50,8 @@ bool SvpSalBitmap::Create( const Size& rSize, aSize.setX( 1 ); if( aSize.getY() == 0 ) aSize.setY( 1 ); - sal_Int32 nStride = getBitmapDeviceStrideForWidth(nFormat, aSize.getX()); if( nBitCount > 8 ) - m_aBitmap = createBitmapDevice( aSize, true, nFormat, nStride ); + m_aBitmap = createBitmapDevice( aSize, true, nFormat ); else { // prepare palette @@ -65,7 +64,7 @@ bool SvpSalBitmap::Create( const Size& rSize, const BitmapColor& rCol = rPalette[i]; (*pPalette)[i] = basebmp::Color( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() ); } - m_aBitmap = createBitmapDevice( aSize, true, nFormat, nStride, + m_aBitmap = createBitmapDevice( aSize, true, nFormat, basebmp::RawMemorySharedArray(), basebmp::PaletteMemorySharedVector( pPalette ) ); @@ -407,7 +406,6 @@ void SvpSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode m_aBitmap = basebmp::createBitmapDevice( m_aBitmap->getSize(), m_aBitmap->isTopDown(), m_aBitmap->getScanlineFormat(), - m_aBitmap->getScanlineStride(), m_aBitmap->getBuffer(), pPal ); } diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 39f12506cda4..4a48abbe6915 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -291,8 +291,7 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u aFrameSize.setX( 1 ); if( aFrameSize.getY() == 0 ) aFrameSize.setY( 1 ); - sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(m_nScanlineFormat, aFrameSize.getX()); - m_aFrame = createBitmapDevice( aFrameSize, true, m_nScanlineFormat, nStride ); + m_aFrame = createBitmapDevice( aFrameSize, true, m_nScanlineFormat ); if (m_bDamageTracking) m_aFrame->setDamageTracker( basebmp::IBitmapDeviceDamageTrackerSharedPtr( new DamageTracker ) ); diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 7075bf56aa58..f5d45d7e1739 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -877,11 +877,12 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh { SvpSalBitmap* pBitmap = new SvpSalBitmap(); - if (m_aDevice) + if (m_aOrigDevice) { basebmp::BitmapDeviceSharedPtr aCopy; aCopy = cloneBitmapDevice(basegfx::B2IVector(nWidth, nHeight), - m_aDevice); + m_aOrigDevice); + basegfx::B2IVector size = aCopy->getSize(); basegfx::B2IBox aSrcRect( nX, nY, nX+nWidth, nY+nHeight ); basegfx::B2IBox aDestRect( 0, 0, nWidth, nHeight ); diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index 026da6b2935c..6eb0a114ca32 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -66,21 +66,20 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, if( ! m_aDevice.get() || m_aDevice->getSize() != aDevSize ) { basebmp::Format nFormat = SvpSalInstance::getBaseBmpFormatForDeviceFormat(m_eFormat); - sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(nFormat, aDevSize.getX()); if (m_eFormat == DeviceFormat::BITMASK) { std::vector< basebmp::Color > aDevPal(2); aDevPal[0] = basebmp::Color( 0, 0, 0 ); aDevPal[1] = basebmp::Color( 0xff, 0xff, 0xff ); - m_aDevice = createBitmapDevice( aDevSize, true, nFormat, nStride, + m_aDevice = createBitmapDevice( aDevSize, true, nFormat, PaletteMemorySharedVector( new std::vector< basebmp::Color >(aDevPal) ) ); } else { m_aDevice = pBuffer ? - createBitmapDevice( aDevSize, true, nFormat, nStride, pBuffer, PaletteMemorySharedVector() ) - : createBitmapDevice( aDevSize, true, nFormat, nStride ); + createBitmapDevice( aDevSize, true, nFormat, pBuffer, PaletteMemorySharedVector() ) + : createBitmapDevice( aDevSize, true, nFormat ); } // update device in existing graphics diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx index c20c12b9926b..33820e467c3b 100644 --- a/vcl/qa/cppunit/BitmapTest.cxx +++ b/vcl/qa/cppunit/BitmapTest.cxx @@ -51,17 +51,12 @@ void BitmapTest::testConvert() { Bitmap::ScopedReadAccess pReadAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(8), pReadAccess->GetBitCount()); -#if defined WNT - if (!OpenGLHelper::isVCLOpenGLEnabled()) - { - // GDI Scanlines padded to DWORD multiples, it seems - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(12), pReadAccess->GetScanlineSize()); - } - else +#if defined MACOSX || defined IOS + //it would be nice to find and change the stride for quartz to be the same as everyone else + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(10), pReadAccess->GetScanlineSize()); +#else + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(12), pReadAccess->GetScanlineSize()); #endif - { - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(10), pReadAccess->GetScanlineSize()); - } CPPUNIT_ASSERT(pReadAccess->HasPalette()); const BitmapColor& rColor = pReadAccess->GetPaletteColor(pReadAccess->GetPixelIndex(1, 1)); CPPUNIT_ASSERT_EQUAL(sal_Int32(204), sal_Int32(rColor.GetRed())); diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 39c34534ebd9..923581d0fbee 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -1967,9 +1967,9 @@ void GtkSalFrame::AllocateFrame() aFrameSize.setX( 1 ); if( aFrameSize.getY() == 0 ) aFrameSize.setY( 1 ); - int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, aFrameSize.getX()); - m_aFrame = basebmp::createBitmapDevice(aFrameSize, true, - SVP_CAIRO_FORMAT, cairo_stride); + m_aFrame = basebmp::createBitmapDevice(aFrameSize, true, SVP_CAIRO_FORMAT); + assert(cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, aFrameSize.getX()) == + m_aFrame->getScanlineStride()); m_aFrame->setDamageTracker( basebmp::IBitmapDeviceDamageTrackerSharedPtr(new DamageTracker(*this)) ); SAL_INFO("vcl.gtk3", "allocated m_aFrame size of " << maGeometry.nWidth << " x " << maGeometry.nHeight); |