include/vcl/image.hxx        |    2 +-
 vcl/source/image/Image.cxx   |    2 +-
 vcl/source/outdev/bitmap.cxx |    5 ++---
 3 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 26ab75625abfb9f614ca2d90686845d38b04a07e
Author:     Christopher Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Tue Aug 12 20:15:58 2025 +1000
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 12 16:15:27 2025 +0200

    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.gran...@collabora.co.uk>

diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx
index 515f7eae5f28..0c5e56ce7f2e 100644
--- a/include/vcl/image.hxx
+++ b/include/vcl/image.hxx
@@ -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:
 
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index 9c93feab2139..62571e56ce8c 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -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;
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 141d0c012c64..1f915c1df72c 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -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);
     }
 }
 

Reply via email to