summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-06 18:14:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-07 10:19:32 +0000
commit00659bcdbbb167596e6fd18e283a54819dd6fe91 (patch)
tree65316f99002c5aa6851ee1770df557b789772f20 /vcl/source/gdi
parent545ddfbaa98cfeaa35c95d7db7b16cd241cedc89 (diff)
improve readability of VirtualDevice constructor
(a) It is not obvious what DeviceFormat::DEFAULT means (b) There are two parameters (each with two states), but only really 2 possible overall states So (1) use more useful names (2) combine the two parameters into one enum Change-Id: Ic0595b39e032cc9e019b88326389d055b977da00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/gdimtf.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rw-r--r--vcl/source/gdi/virdev.cxx21
3 files changed, 11 insertions, 14 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 05e4c0fb3a6b..6b1300e589d6 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -818,7 +818,7 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf,
const Gradient& rGrad )
{
// Generate comment, GradientEx and Gradient actions (within DrawGradient)
- ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, DeviceFormat::DEFAULT);
+ ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, DeviceFormat::WITHOUT_ALPHA);
aVDev->EnableOutput( false );
GDIMetaFile aGradMtf;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 8be74da9e1c5..e4807abfaae8 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1198,7 +1198,7 @@ double PDFPage::getHeight() const
PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
const css::uno::Reference< css::beans::XMaterialHolder >& xEnc,
PDFWriter& i_rOuterFace)
- : VirtualDevice(Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::NONE, OUTDEV_PDF),
+ : VirtualDevice(Application::GetDefaultDevice(), DeviceFormat::WITHOUT_ALPHA, OUTDEV_PDF),
m_aMapMode( MapUnit::MapPoint, Point(), Fraction( 1, pointToPixel(1) ), Fraction( 1, pointToPixel(1) ) ),
m_aWidgetStyleSettings(Application::GetSettings().GetStyleSettings()),
m_nCurrentStructElement( 0 ),
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index d0687faa76b2..4d10f317e93c 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -154,7 +154,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
(void)pOutDev->AcquireGraphics();
pGraphics = pOutDev->mpGraphics;
if ( pGraphics )
- mpVirDev = pSVData->mpDefInst->CreateVirtualDevice(*pGraphics, nDX, nDY, meFormat, pData);
+ mpVirDev = pSVData->mpDefInst->CreateVirtualDevice(*pGraphics, nDX, nDY, meFormatAndAlpha, pData);
else
mpVirDev = nullptr;
if ( !mpVirDev )
@@ -200,14 +200,12 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
pSVData->maGDIData.mpFirstVirDev = this;
}
-VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
- DeviceFormat eAlphaFormat, OutDevType eOutDevType)
+VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormatAndAlpha,
+ OutDevType eOutDevType)
: OutputDevice(eOutDevType)
- , meFormat(eFormat)
- , meAlphaFormat(eAlphaFormat)
+ , meFormatAndAlpha(eFormatAndAlpha)
{
- SAL_INFO( "vcl.virdev", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat)
- << ", " << static_cast<int>(eAlphaFormat)
+ SAL_INFO( "vcl.virdev", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormatAndAlpha)
<< ", " << static_cast<int>(eOutDevType) << " )" );
ImplInitVirDev(pCompDev ? pCompDev : Application::GetDefaultDevice(), 0, 0);
@@ -216,8 +214,7 @@ VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
VirtualDevice::VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
DeviceFormat eFormat)
: OutputDevice(OUTDEV_VIRDEV)
- , meFormat(eFormat)
- , meAlphaFormat(DeviceFormat::NONE)
+ , meFormatAndAlpha(eFormat)
{
SAL_INFO( "vcl.virdev", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << " )" );
@@ -303,7 +300,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
assert(mpGraphics);
- pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice(*mpGraphics, nNewWidth, nNewHeight, meFormat);
+ pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice(*mpGraphics, nNewWidth, nNewHeight, meFormatAndAlpha);
if ( pNewVirDev )
{
SalGraphics* pGraphics = pNewVirDev->AcquireGraphics();
@@ -359,7 +356,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
{
if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) )
{
- if (meAlphaFormat != DeviceFormat::NONE)
+ if (meFormatAndAlpha != DeviceFormat::WITHOUT_ALPHA)
{
// #110958# Setup alpha bitmap
if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize)
@@ -369,7 +366,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
if( !mpAlphaVDev )
{
- mpAlphaVDev = VclPtr<VirtualDevice>::Create(*this, meAlphaFormat);
+ mpAlphaVDev = VclPtr<VirtualDevice>::Create(*this, meFormatAndAlpha);
mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, nullptr);
}