Related: tdf#127529 make it harder to misunderstand this VirtualDevice ctor

Change-Id: I250bc68da118a994a2e0ff8ab9eb11112827756d
Reviewed-on: https://gerrit.libreoffice.org/80158
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2019-10-03 17:11:46 +01:00
parent a7411c2ee5
commit 66df5e5bb0
8 changed files with 13 additions and 11 deletions

View file

@ -80,7 +80,7 @@ namespace dxcanvas
SystemGraphicsData aSystemGraphicsData;
aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(hdc);
ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
// disable font antialiasing - GDI does not handle alpha
// surfaces properly.
@ -241,7 +241,7 @@ namespace dxcanvas
SystemGraphicsData aSystemGraphicsData;
aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( nullptr ));
ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
// create the font
const css::rendering::FontRequest& rFontRequest = rCanvasFont->getFontRequest();

View file

@ -1773,7 +1773,7 @@ void paintTileToCGContext(ITiledRenderable* pDocument,
SystemGraphicsData aData;
aData.rCGContext = reinterpret_cast<CGContextRef>(rCGContext);
ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
ScopedVclPtrInstance<VirtualDevice> pDevice(aData, Size(1, 1), DeviceFormat::DEFAULT);
pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
pDevice->SetOutputSizePixel(nCanvasSize);
pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(),
@ -4732,7 +4732,7 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKW
SystemGraphicsData aData;
aData.rCGContext = cgc;
ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
ScopedVclPtrInstance<VirtualDevice> pDevice(aData, Size(1, 1), DeviceFormat::DEFAULT);
pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
pDevice->SetOutputSizePixel(Size(nWidth, nHeight));

View file

@ -145,7 +145,7 @@ public:
Any rendering will happen directly on the context and not on any intermediate bitmap.
Note: This might not be supported on all platforms !
*/
explicit VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
explicit VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
DeviceFormat eFormat);
virtual ~VirtualDevice() override;

View file

@ -3628,7 +3628,7 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
sal_Int64 nWindowHandle;
Parent >>= nWindowHandle;
aData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
ScopedVclPtrInstance<VirtualDevice> xDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
ScopedVclPtrInstance<VirtualDevice> xDevice(aData, Size(1, 1), DeviceFormat::DEFAULT);
paintTile(*xDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#else
// TODO: support other platforms

View file

@ -65,7 +65,8 @@ void Qt5SvpSurface::flush() const
VclPtr<VirtualDevice> Qt5SvpSurface::createVirtualDevice() const
{
return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
//TODO allow creating a VirtualDevice to draw to the current surface
return VclPtrInstance<VirtualDevice>(DeviceFormat::DEFAULT);
}
} // namespace cairo

View file

@ -210,7 +210,7 @@ VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
ImplInitVirDev(pCompDev ? pCompDev : Application::GetDefaultDevice(), 0, 0);
}
VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
VirtualDevice::VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
DeviceFormat eFormat)
: OutputDevice(OUTDEV_VIRDEV)
, meFormat(eFormat)
@ -218,7 +218,7 @@ VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
{
SAL_INFO( "vcl.virdev", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << " )" );
ImplInitVirDev(Application::GetDefaultDevice(), rSize.Width(), rSize.Height(), pData);
ImplInitVirDev(Application::GetDefaultDevice(), rSize.Width(), rSize.Height(), &rData);
}
VirtualDevice::~VirtualDevice()

View file

@ -255,7 +255,7 @@ namespace cairo
int width = cairo_xlib_surface_get_width(mpSurface.get());
int height = cairo_xlib_surface_get_height(mpSurface.get());
return VclPtr<VirtualDevice>::Create(&aSystemGraphicsData,
return VclPtr<VirtualDevice>::Create(aSystemGraphicsData,
Size(width, height),
getFormat());
}

View file

@ -108,7 +108,8 @@ namespace cairo
VclPtr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
{
return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
//TODO allow creating a VirtualDevice to draw to the current surface
return VclPtrInstance<VirtualDevice>(DeviceFormat::DEFAULT);
}
}