vcl: no need to cast away rImage constness

Image::Draw() is a const function, but wasn't marked as such. I have now
made it const, so this means I can remove the const_cast.

Change-Id: Ie2a8746affd56e0d80e50d3f9edd372cdb3ff491
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189419
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Christopher Sherlock
2025-08-12 16:15:27 +02:00
committed by Noel Grandin
parent 89f6382266
commit 26ab75625a
3 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ public:
const OUString & GetStock() const;
void Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = nullptr);
void Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = nullptr) const;
private:
+1 -1
View File
@@ -128,7 +128,7 @@ bool Image::operator==(const Image& rImage) const
return bRet;
}
void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize)
void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize) const
{
if (!mpImplData || (!pOutDev->IsDeviceOutputNecessary() && pOutDev->GetConnectMetaFile() == nullptr))
return;
+2 -3
View File
@@ -572,11 +572,10 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
if (!ImplIsRecordLayout())
{
Image& rNonConstImage = const_cast<Image&>(rImage);
if (bIsSizeValid)
rNonConstImage.Draw(this, rPos, nStyle, &rSize);
rImage.Draw(this, rPos, nStyle, &rSize);
else
rNonConstImage.Draw(this, rPos, nStyle);
rImage.Draw(this, rPos, nStyle);
}
}