summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-01-26 12:54:19 +0100
committerJan Holesovsky <kendy@collabora.com>2016-05-16 14:56:58 +0200
commita0595f39049eaa8281836a2b8d50c11490fe888c (patch)
treebc10c302061fa2770c3ddafe1e98a20b432af87b
parent9d0efc3a19d896363f55652e11331c5bc956c1da (diff)
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
-rw-r--r--desktop/source/lib/init.cxx31
-rw-r--r--include/vcl/virdev.hxx8
-rw-r--r--vcl/inc/salvd.hxx3
-rw-r--r--vcl/source/gdi/virdev.cxx12
4 files changed, 12 insertions, 42 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9241051ba2ee..7b2fe93c2dc3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -115,17 +115,6 @@ typedef struct
const char *filterName;
} ExtensionMap;
-// We need a shared_array for passing into the BitmapDevice (via
-// VirtualDevice.SetOutputSizePixelScaleOffsetAndBuffer which goes via the
-// SvpVirtualDevice, ending up in the basebmp BitmapDevice. 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.
-template<typename T>
-struct NoDelete
-{
- void operator()(T* /* p */) {}
-};
-
static const ExtensionMap aWriterExtensionMap[] =
{
{ "doc", "MS Word 97" },
@@ -1029,21 +1018,9 @@ void doc_paintTile(LibreOfficeKitDocument* pThis,
memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4);
pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
- boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
-
- // Allocate a separate buffer for the alpha device.
- std::vector<sal_uInt8> aAlpha(nCanvasWidth * nCanvasHeight);
- memset(aAlpha.data(), 0, nCanvasWidth * nCanvasHeight);
- boost::shared_array<sal_uInt8> aAlphaBuffer;
-
- // No alpha buffer for Calc: it would result in misrendered hyperlinks with
- // pre-cairo headless codepath.
- if (doc_getDocumentType(pThis) != LOK_DOCTYPE_SPREADSHEET)
- aAlphaBuffer.reset(aAlpha.data(), NoDelete<sal_uInt8>());
-
pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
- aBuffer, aAlphaBuffer);
+ pBuffer);
pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
@@ -1757,14 +1734,12 @@ 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 >());
- boost::shared_array<sal_uInt8> aAlphaBuffer;
aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
Size(nFontWidth, nFontHeight), Fraction(1.0), Point(),
- aBuffer, aAlphaBuffer);
- aDevice.DrawText(Point(0,0), aFontName);
+ pBuffer);
+ aDevice->DrawText(Point(0,0), aFontName);
return pBuffer;
}
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 8429339a919e..51c2607ce608 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -46,10 +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 basebmp::RawMemorySharedArray &pBuffer );
+ sal_uInt8* pBuffer );
SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
- const basebmp::RawMemorySharedArray &pBuffer,
- const basebmp::RawMemorySharedArray &pAlphaBuffer );
+ sal_uInt8* pBuffer );
VirtualDevice (const VirtualDevice &) SAL_DELETED_FUNCTION;
VirtualDevice & operator= (const VirtualDevice &) SAL_DELETED_FUNCTION;
@@ -127,8 +126,7 @@ public:
bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize,
const Fraction& rScale,
const Point& rNewOffset,
- const basebmp::RawMemorySharedArray &pBuffer,
- const basebmp::RawMemorySharedArray &pAlphaBuffer );
+ sal_uInt8* pBuffer);
bool SetOutputSize( const Size& rNewSize, bool bErase = true )
{ return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); }
diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx
index e4ee3a23a02e..9a72d8776601 100644
--- a/vcl/inc/salvd.hxx
+++ b/vcl/inc/salvd.hxx
@@ -46,8 +46,7 @@ public:
// Set new size using a buffer at the given address
virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY,
- 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 2eaf7b77df3b..6ed89e7e83fe 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -289,7 +289,7 @@ void VirtualDevice::dispose()
}
bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
- const basebmp::RawMemorySharedArray &pBuffer )
+ sal_uInt8 *const pBuffer)
{
SAL_INFO( "vcl.gdi",
"VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", "
@@ -395,8 +395,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
}
bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
- const basebmp::RawMemorySharedArray &pBuffer,
- const basebmp::RawMemorySharedArray &pAlphaBuffer )
+ sal_uInt8 *const pBuffer)
{
if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) )
{
@@ -411,8 +410,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
if( !mpAlphaVDev )
{
mpAlphaVDev = VclPtr<VirtualDevice>::Create(*this, meAlphaFormat);
- mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase,
- pAlphaBuffer);
+ mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, nullptr);
}
// TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev
@@ -445,12 +443,12 @@ void VirtualDevice::EnableRTL( bool bEnable )
bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase )
{
- return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), basebmp::RawMemorySharedArray());
+ return ImplSetOutputSizePixel(rNewSize, bErase, nullptr);
}
bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(
const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset,
- const basebmp::RawMemorySharedArray &pBuffer, const basebmp::RawMemorySharedArray &pAlphaBuffer )
+ sal_uInt8 *const pBuffer)
{
if (pAlphaBuffer)
meAlphaFormat = DeviceFormat::GRAYSCALE;