diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-06 18:14:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-07 10:19:32 +0000 |
commit | 00659bcdbbb167596e6fd18e283a54819dd6fe91 (patch) | |
tree | 65316f99002c5aa6851ee1770df557b789772f20 /canvas | |
parent | 545ddfbaa98cfeaa35c95d7db7b16cd241cedc89 (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 'canvas')
-rw-r--r-- | canvas/qa/cppunit/canvastest.cxx | 5 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout_drawhelper.cxx | 4 | ||||
-rw-r--r-- | canvas/source/vcl/backbuffer.cxx | 2 | ||||
-rw-r--r-- | canvas/source/vcl/bitmapbackbuffer.cxx | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/canvas/qa/cppunit/canvastest.cxx b/canvas/qa/cppunit/canvastest.cxx index 7927f07c0723..d4cba860db43 100644 --- a/canvas/qa/cppunit/canvastest.cxx +++ b/canvas/qa/cppunit/canvastest.cxx @@ -76,9 +76,8 @@ public: void setupCanvas(const Size& size, Color backgroundColor = COL_WHITE, bool alpha = false) { - mVclDevice - = alpha ? VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT, DeviceFormat::DEFAULT) - : VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT); + mVclDevice = alpha ? VclPtr<VirtualDevice>::Create(DeviceFormat::WITH_ALPHA) + : VclPtr<VirtualDevice>::Create(DeviceFormat::WITHOUT_ALPHA); mVclDevice->SetOutputSizePixel(size); mVclDevice->SetBackground(Wallpaper(backgroundColor)); mVclDevice->Erase(); diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 9a8771428d93..4b223d1cad0f 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -83,7 +83,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::WITHOUT_ALPHA); // disable font antialiasing - GDI does not handle alpha // surfaces properly. @@ -246,7 +246,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::WITHOUT_ALPHA); // create the font const css::rendering::FontRequest& rFontRequest = rCanvasFont->getFontRequest(); diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx index 684a02c8bd55..aa45a56e7ab6 100644 --- a/canvas/source/vcl/backbuffer.cxx +++ b/canvas/source/vcl/backbuffer.cxx @@ -28,7 +28,7 @@ namespace vclcanvas { BackBuffer::BackBuffer( const OutputDevice& rRefDevice ) : - maVDev( VclPtr<VirtualDevice>::Create( rRefDevice, DeviceFormat::DEFAULT ) ) + maVDev( VclPtr<VirtualDevice>::Create( rRefDevice, DeviceFormat::WITHOUT_ALPHA ) ) { tools::SetDefaultDeviceAntiAliasing( maVDev ); } diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx index d6f87e3c0e00..3766276f3b53 100644 --- a/canvas/source/vcl/bitmapbackbuffer.cxx +++ b/canvas/source/vcl/bitmapbackbuffer.cxx @@ -112,7 +112,7 @@ namespace vclcanvas // VDev not yet created, do it now. Create an alpha-VDev, // if bitmap has transparency. mpVDev = maBitmap->IsAlpha() ? - VclPtr<VirtualDevice>::Create( mrRefDevice, DeviceFormat::DEFAULT, DeviceFormat::DEFAULT ) : + VclPtr<VirtualDevice>::Create( mrRefDevice, DeviceFormat::WITH_ALPHA ) : VclPtr<VirtualDevice>::Create( mrRefDevice ); OSL_ENSURE( mpVDev, |