desktop/source/lib/init.cxx | 18 +---------------- include/o3tl/make_shared.hxx | 33 ++++++++++++++++++++++++++++++++ include/vcl/virdev.hxx | 8 +++---- vcl/headless/svpvd.cxx | 6 ++--- vcl/inc/headless/svpvd.hxx | 2 - vcl/inc/opengl/salbmp.hxx | 4 +-- vcl/inc/salvd.hxx | 5 ++-- vcl/opengl/salbmp.cxx | 44 ++++++++++++++++++++++--------------------- vcl/opengl/scale.cxx | 2 - vcl/source/gdi/virdev.cxx | 11 ++++------ 10 files changed, 77 insertions(+), 56 deletions(-)
New commits: commit bde86f8074842585e2964b3157e97672fb25e63d Author: Michael Stahl <mst...@redhat.com> Date: Tue Jan 26 14:12:21 2016 +0100 vcl: replace boost::shared_array with std::shared_ptr Add o3tl::make_shared_array() to create the shared_ptr with the right deleter. The main difference then is that shared_array has operator[], but this code didn't even use it. Change-Id: I500ffc2f92b99c2a3924c0cdcdaa101956b69add diff --git a/include/o3tl/make_shared.hxx b/include/o3tl/make_shared.hxx new file mode 100644 index 0000000..d42783c --- /dev/null +++ b/include/o3tl/make_shared.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_O3TL_MAKE_SHARED_HXX +#define INCLUDED_O3TL_MAKE_SHARED_HXX + +#include <memory> +#include <type_traits> + +namespace o3tl { + +/** Allocate an array stored in a shared_ptr, calling operator delete[]. + Note that this is only allowed for arithmetic types because shared_ptr + implicitly converts to sub-types. + */ +template<typename T> +std::shared_ptr<T> make_shared_array(size_t const size) +{ + static_assert(std::is_arithmetic<T>::value, "only arrays of arithmetic types allowed"); + return std::shared_ptr<T>(new T[size], std::default_delete<T[]>()); +} + +} // namespace o3tl + +#endif // INCLUDED_O3TL_MAKE_SHARED_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx index f5a618a..98e09b3 100644 --- a/vcl/inc/opengl/salbmp.hxx +++ b/vcl/inc/opengl/salbmp.hxx @@ -29,7 +29,7 @@ #include <salbmp.hxx> #include <deque> -#include <boost/shared_array.hpp> +#include <memory> struct BitmapBuffer; class BitmapPalette; @@ -40,7 +40,7 @@ private: OpenGLTexture maTexture; bool mbDirtyTexture; BitmapPalette maPalette; - boost::shared_array<sal_uInt8> maUserBuffer; + std::shared_ptr<sal_uInt8> mpUserBuffer; sal_uInt16 mnBits; sal_uInt16 mnBytesPerRow; int mnWidth; diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index e8cbc31..703aedc 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -30,6 +30,8 @@ #include "vcleventlisteners.hxx" #include "vcl/lazydelete.hxx" +#include <o3tl/make_shared.hxx> + #include "opengl/zone.hxx" #include "opengl/program.hxx" #include "opengl/salbmp.hxx" @@ -202,12 +204,12 @@ bool OpenGLSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount mbDirtyTexture = false; // be careful here, we are share & reference-count the - // maUserBuffer, BUT this Create() is called from + // mpUserBuffer, BUT this Create() is called from // Bitmap::ImplMakeUnique(). // Consequently, there might be cases when this needs to be made // unique later (when we don't do that right away here), like when // using the BitmapWriteAccess. - maUserBuffer = rSourceBitmap.maUserBuffer; + mpUserBuffer = rSourceBitmap.mpUserBuffer; return true; } @@ -238,7 +240,7 @@ void OpenGLSalBitmap::Destroy() VCL_GL_INFO("Destroy OpenGLSalBitmap texture:" << maTexture.Id()); maPendingOps.clear(); maTexture = OpenGLTexture(); - maUserBuffer.reset(); + mpUserBuffer.reset(); } bool OpenGLSalBitmap::AllocateUserData() @@ -256,7 +258,7 @@ bool OpenGLSalBitmap::AllocateUserData() { try { - maUserBuffer.reset( new sal_uInt8[static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight] ); + mpUserBuffer = o3tl::make_shared_array<sal_uInt8>(static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight); alloc = true; } catch (const std::bad_alloc &) {} @@ -264,18 +266,18 @@ bool OpenGLSalBitmap::AllocateUserData() if (!alloc) { SAL_WARN("vcl.opengl", "bad alloc " << mnBytesPerRow << "x" << mnHeight); - maUserBuffer.reset( static_cast<sal_uInt8*>(nullptr) ); + mpUserBuffer.reset(); mnBytesPerRow = 0; } #ifdef DBG_UTIL else { for (size_t i = 0; i < size_t(mnBytesPerRow * mnHeight); i++) - maUserBuffer.get()[i] = (i & 0xFF); + mpUserBuffer.get()[i] = (i & 0xFF); } #endif - return maUserBuffer.get() != nullptr; + return mpUserBuffer.get() != nullptr; } namespace { @@ -436,19 +438,19 @@ GLuint OpenGLSalBitmap::CreateTexture() sal_uInt8* pData( nullptr ); bool bAllocated( false ); - if( maUserBuffer.get() != nullptr ) + if (mpUserBuffer.get() != nullptr) { if( mnBits == 16 || mnBits == 24 || mnBits == 32 ) { // no conversion needed for truecolor - pData = maUserBuffer.get(); + pData = mpUserBuffer.get(); determineTextureFormat(mnBits, nFormat, nType); } else if( mnBits == 8 && maPalette.IsGreyPalette() ) { // no conversion needed for grayscale - pData = maUserBuffer.get(); + pData = mpUserBuffer.get(); nFormat = GL_LUMINANCE; nType = GL_UNSIGNED_BYTE; } @@ -463,7 +465,7 @@ GLuint OpenGLSalBitmap::CreateTexture() std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(mnBits, maPalette)); - sal_uInt8* pSrcData = maUserBuffer.get(); + sal_uInt8* pSrcData = mpUserBuffer.get(); sal_uInt8* pDstData = pData; sal_uInt32 nY = mnBufHeight; @@ -516,7 +518,7 @@ GLuint OpenGLSalBitmap::CreateTexture() bool OpenGLSalBitmap::ReadTexture() { - sal_uInt8* pData = maUserBuffer.get(); + sal_uInt8* pData = mpUserBuffer.get(); GLenum nFormat = GL_RGBA; GLenum nType = GL_UNSIGNED_BYTE; @@ -707,7 +709,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) if( nMode != BITMAP_INFO_ACCESS ) { - if( !maUserBuffer.get() ) + if (!mpUserBuffer.get()) { if( !AllocateUserData() ) return nullptr; @@ -723,14 +725,14 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) } } - // maUserBuffer must be unique when we are doing the write access - if (nMode == BITMAP_WRITE_ACCESS && maUserBuffer && !maUserBuffer.unique()) + // mpUserBuffer must be unique when we are doing the write access + if (nMode == BITMAP_WRITE_ACCESS && mpUserBuffer && !mpUserBuffer.unique()) { - boost::shared_array<sal_uInt8> aBuffer(maUserBuffer); + std::shared_ptr<sal_uInt8> aBuffer(mpUserBuffer); - maUserBuffer.reset(); + mpUserBuffer.reset(); AllocateUserData(); - memcpy(maUserBuffer.get(), aBuffer.get(), static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight); + memcpy(mpUserBuffer.get(), aBuffer.get(), static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight); } BitmapBuffer* pBuffer = new BitmapBuffer; @@ -738,7 +740,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) pBuffer->mnHeight = mnHeight; pBuffer->maPalette = maPalette; pBuffer->mnScanlineSize = mnBytesPerRow; - pBuffer->mpBits = maUserBuffer.get(); + pBuffer->mpBits = mpUserBuffer.get(); pBuffer->mnBitCount = mnBits; switch (mnBits) @@ -847,7 +849,7 @@ bool OpenGLSalBitmap::GetSystemData( BitmapSystemData& /*rData*/ ) if( pBuffer == NULL ) return false; - if( !maUserBuffer.get() ) + if (!mpUserBuffer.get()) { if( !AllocateUserData() || !ReadTexture() ) { @@ -858,7 +860,7 @@ bool OpenGLSalBitmap::GetSystemData( BitmapSystemData& /*rData*/ ) // TODO Might be more efficient to add a static method to SalBitmap // to get system data from a buffer - memcpy( pBuffer->mpBits, maUserBuffer.get(), mnBytesPerRow * mnHeight ); + memcpy( pBuffer->mpBits, mpUserBuffer.get(), mnBytesPerRow * mnHeight ); rBitmap.ReleaseBuffer( pBuffer, false ); return rBitmap.GetSystemData( rData ); diff --git a/vcl/opengl/scale.cxx b/vcl/opengl/scale.cxx index 80bbdd6..9ba7432 100644 --- a/vcl/opengl/scale.cxx +++ b/vcl/opengl/scale.cxx @@ -265,7 +265,7 @@ bool OpenGLSalBitmap::ImplScale( const double& rScaleX, const double& rScaleY, B { VCL_GL_INFO( "::ImplScale" ); - maUserBuffer.reset(); + mpUserBuffer.reset(); OpenGLVCLContextZone aContextZone; rtl::Reference<OpenGLContext> xContext = OpenGLContext::getVCLContext(); commit eb63ac518167601896afe0c336e2562efa0f43f2 Author: Michael Stahl <mst...@redhat.com> Date: Tue Jan 26 12:54:19 2016 +0100 vcl: actually that shared_array was a scam The only things passed as buffers there were null pointers and shared_arrays that had the deletion explicitly disabled with a struct NoDelete, so it's sufficient to just pass a pointer. Change-Id: I68d618782aa654242048516d2e910b8136b16e2d diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 53d84f7..88b5d1f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -101,17 +101,6 @@ typedef struct const char *filterName; } ExtensionMap; -// We need a shared_ptr for passing into the BitmapDevice (via -// VirtualDevice.SetOutputSizePixelScaleOffsetAndBuffer which goes via the -// SvpVirtualDevice, ending up in the cairo surface. However as we're -// given the array externally we can't delete it, and hence need to override -// shared_ptr's default of deleting its pointer. -template<typename T> -struct NoDelete -{ - void operator()(T* /* p */) {} -}; - static const ExtensionMap aWriterExtensionMap[] = { { "doc", "MS Word 97" }, @@ -924,11 +913,9 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); #endif - std::shared_ptr<sal_uInt8> aBuffer( pBuffer, NoDelete<sal_uInt8>() ); - pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), - aBuffer); + pBuffer); pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); @@ -1569,12 +1556,11 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, unsigned char* pBuffer = static_cast<unsigned char*>(malloc(4 * nFontWidth * nFontHeight)); memset(pBuffer, 0, nFontWidth * nFontHeight * 4); - std::shared_ptr<sal_uInt8> aBuffer(pBuffer, NoDelete<sal_uInt8>()); aDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); aDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nFontWidth, nFontHeight), Fraction(1.0), Point(), - aBuffer); + pBuffer); aDevice->DrawText(Point(0,0), aFontName); return pBuffer; diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index e56a9a1..b9b5bba 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -24,7 +24,6 @@ #include <vcl/salgtype.hxx> #include <vcl/outdev.hxx> -#include <memory> class SalVirtualDevice; struct SystemGraphicsData; @@ -47,9 +46,9 @@ private: SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ); SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const std::shared_ptr<sal_uInt8> &pBuffer ); + sal_uInt8* pBuffer ); SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const std::shared_ptr<sal_uInt8> &pBuffer ); + sal_uInt8* pBuffer ); VirtualDevice (const VirtualDevice &) = delete; VirtualDevice & operator= (const VirtualDevice &) = delete; @@ -127,7 +126,7 @@ public: bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, - const std::shared_ptr<sal_uInt8> &pBuffer ); + sal_uInt8* pBuffer); bool SetOutputSize( const Size& rNewSize, bool bErase = true ) { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); } diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index 1711f39..7840aec 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -51,11 +51,11 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY ) { - return SetSizeUsingBuffer(nNewDX, nNewDY, std::shared_ptr<sal_uInt8>()); + return SetSizeUsingBuffer(nNewDX, nNewDY, nullptr); } bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, - const std::shared_ptr<sal_uInt8> &pBuffer ) + sal_uInt8 *const pBuffer) { B2IVector aDevSize( nNewDX, nNewDY ); if( aDevSize.getX() == 0 ) @@ -75,7 +75,7 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, else { m_pSurface = pBuffer ? - cairo_image_surface_create_for_data(pBuffer.get(), CAIRO_FORMAT_ARGB32, + cairo_image_surface_create_for_data(pBuffer, CAIRO_FORMAT_ARGB32, aDevSize.getX(), aDevSize.getY(), cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, aDevSize.getX())) diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index 9807c78..9256768 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -47,7 +47,7 @@ public: virtual bool SetSize( long nNewDX, long nNewDY ) override; virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - const std::shared_ptr<sal_uInt8> &pBuffer + sal_uInt8 * pBuffer ) override; // SalGeometryProvider diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index d3874c1..95b4068 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -48,7 +48,7 @@ public: // Set new size using a buffer at the given address virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - const std::shared_ptr<sal_uInt8> & /* pBuffer */ ) + sal_uInt8 * /* pBuffer */) { // Only the headless virtual device has an implementation that uses // pBuffer (and bTopDown). diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index bd7adff..016bf03 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -280,7 +280,7 @@ void VirtualDevice::dispose() } bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const std::shared_ptr<sal_uInt8> &pBuffer ) + sal_uInt8 *const pBuffer) { SAL_INFO( "vcl.gdi", "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", " @@ -386,7 +386,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect ) } bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const std::shared_ptr<sal_uInt8> &pBuffer ) + sal_uInt8 *const pBuffer) { if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) ) { @@ -401,8 +401,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, if( !mpAlphaVDev ) { mpAlphaVDev = VclPtr<VirtualDevice>::Create(*this, meAlphaFormat); - mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, - std::shared_ptr<sal_uInt8>()); + mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, nullptr); } // TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev @@ -435,12 +434,12 @@ void VirtualDevice::EnableRTL( bool bEnable ) bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase ) { - return ImplSetOutputSizePixel(rNewSize, bErase, std::shared_ptr<sal_uInt8>()); + return ImplSetOutputSizePixel(rNewSize, bErase, nullptr); } bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, - const std::shared_ptr<sal_uInt8> &pBuffer ) + sal_uInt8 *const pBuffer) { if (pBuffer) { MapMode mm = GetMapMode(); commit 39963be8679ceef5d08eda9e04e97b6fbb079b71 Author: Michael Stahl <mst...@redhat.com> Date: Tue Jan 26 12:37:20 2016 +0100 vcl: convert boost::shared_array to std::shared_ptr Change-Id: I9d0ad886c4c6e1c8496eb6129b22d327ca0968eb diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d022f6f..53d84f7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -101,11 +101,11 @@ typedef struct const char *filterName; } ExtensionMap; -// We need a shared_array for passing into the BitmapDevice (via +// We need a shared_ptr for passing into the BitmapDevice (via // VirtualDevice.SetOutputSizePixelScaleOffsetAndBuffer which goes via the // SvpVirtualDevice, ending up in the cairo surface. However as we're // given the array externally we can't delete it, and hence need to override -// shared_array's default of deleting its pointer. +// shared_ptr's default of deleting its pointer. template<typename T> struct NoDelete { @@ -924,7 +924,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); #endif - boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); + std::shared_ptr<sal_uInt8> aBuffer( pBuffer, NoDelete<sal_uInt8>() ); pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), @@ -1569,7 +1569,7 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, unsigned char* pBuffer = static_cast<unsigned char*>(malloc(4 * nFontWidth * nFontHeight)); memset(pBuffer, 0, nFontWidth * nFontHeight * 4); - boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >()); + std::shared_ptr<sal_uInt8> aBuffer(pBuffer, NoDelete<sal_uInt8>()); aDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); aDevice->SetOutputSizePixelScaleOffsetAndBuffer( diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index b0b960e..e56a9a1 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -23,7 +23,8 @@ #include <vcl/dllapi.h> #include <vcl/salgtype.hxx> #include <vcl/outdev.hxx> -#include <boost/shared_array.hpp> + +#include <memory> class SalVirtualDevice; struct SystemGraphicsData; @@ -46,9 +47,9 @@ private: SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ); SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const boost::shared_array<sal_uInt8> &pBuffer ); + const std::shared_ptr<sal_uInt8> &pBuffer ); SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const boost::shared_array<sal_uInt8> &pBuffer ); + const std::shared_ptr<sal_uInt8> &pBuffer ); VirtualDevice (const VirtualDevice &) = delete; VirtualDevice & operator= (const VirtualDevice &) = delete; @@ -126,7 +127,7 @@ public: bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, - const boost::shared_array<sal_uInt8> &pBuffer ); + const std::shared_ptr<sal_uInt8> &pBuffer ); bool SetOutputSize( const Size& rNewSize, bool bErase = true ) { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); } diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index c2dbbb7..1711f39 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -51,11 +51,11 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY ) { - return SetSizeUsingBuffer(nNewDX, nNewDY, boost::shared_array<sal_uInt8>()); + return SetSizeUsingBuffer(nNewDX, nNewDY, std::shared_ptr<sal_uInt8>()); } bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, - const boost::shared_array<sal_uInt8> &pBuffer ) + const std::shared_ptr<sal_uInt8> &pBuffer ) { B2IVector aDevSize( nNewDX, nNewDY ); if( aDevSize.getX() == 0 ) diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index 967dc0f..9807c78 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -47,7 +47,7 @@ public: virtual bool SetSize( long nNewDX, long nNewDY ) override; virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - const boost::shared_array<sal_uInt8> &pBuffer + const std::shared_ptr<sal_uInt8> &pBuffer ) override; // SalGeometryProvider diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index 4500cd9..d3874c1 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -22,7 +22,8 @@ #include <vcl/dllapi.h> #include <salgeom.hxx> -#include <boost/shared_array.hpp> + +#include <memory> class SalGraphics; @@ -47,7 +48,7 @@ public: // Set new size using a buffer at the given address virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - const boost::shared_array<sal_uInt8> & /* pBuffer */ ) + const std::shared_ptr<sal_uInt8> & /* pBuffer */ ) { // Only the headless virtual device has an implementation that uses // pBuffer (and bTopDown). diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 0b00b4c..bd7adff 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -280,7 +280,7 @@ void VirtualDevice::dispose() } bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const boost::shared_array<sal_uInt8> &pBuffer ) + const std::shared_ptr<sal_uInt8> &pBuffer ) { SAL_INFO( "vcl.gdi", "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", " @@ -386,7 +386,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect ) } bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const boost::shared_array<sal_uInt8> &pBuffer ) + const std::shared_ptr<sal_uInt8> &pBuffer ) { if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) ) { @@ -402,7 +402,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, { mpAlphaVDev = VclPtr<VirtualDevice>::Create(*this, meAlphaFormat); mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, - boost::shared_array<sal_uInt8>()); + std::shared_ptr<sal_uInt8>()); } // TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev @@ -435,12 +435,12 @@ void VirtualDevice::EnableRTL( bool bEnable ) bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase ) { - return ImplSetOutputSizePixel(rNewSize, bErase, boost::shared_array<sal_uInt8>()); + return ImplSetOutputSizePixel(rNewSize, bErase, std::shared_ptr<sal_uInt8>()); } bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, - const boost::shared_array<sal_uInt8> &pBuffer ) + const std::shared_ptr<sal_uInt8> &pBuffer ) { if (pBuffer) { MapMode mm = GetMapMode(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits