sd/source/core/sdpage.cxx                       |    3 +--
 sd/source/ui/animations/CustomAnimationList.cxx |    6 ++----
 sd/source/ui/dlg/animobjs.cxx                   |    4 +---
 sd/source/ui/dlg/headerfooterdlg.cxx            |    4 +---
 sd/source/ui/dlg/titledockwin.cxx               |    5 +----
 5 files changed, 6 insertions(+), 16 deletions(-)

New commits:
commit ea12ef9ce8a850fb36606391f108c7e5e9782c6d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Aug 16 23:32:14 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Aug 17 08:19:39 2025 +0200

    Use OutputDevice::ScopedPush in sd
    
    Change-Id: I865900980c9a222782eee22b2b434b059e6fad6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189800
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index d4d46a73f4c1..7ee15ddeb7b1 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -340,7 +340,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool 
bVertical, const ::t
             Bitmap aBmp(BMP_PRESOBJ_GRAPHIC);
             Graphic  aGraphic( aBmp );
             OutputDevice &aOutDev = *Application::GetDefaultDevice();
-            aOutDev.Push();
+            auto popIt = aOutDev.ScopedPush();
 
             aOutDev.SetMapMode( aGraphic.GetPrefMapMode() );
             Size aSizePix = aOutDev.LogicToPixel( aGraphic.GetPrefSize() );
@@ -350,7 +350,6 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool 
bVertical, const ::t
             Point aPnt (0, 0);
             ::tools::Rectangle aRect (aPnt, aSize);
             pSdrObj = new SdrGrafObj(getSdrModelFromSdrPage(), aGraphic, 
aRect);
-            aOutDev.Pop();
         }
         break;
 
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx 
b/sd/source/ui/animations/CustomAnimationList.cxx
index c1d1a9dddc99..c10f1421bfba 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -310,7 +310,7 @@ void 
CustomAnimationListEntryItem::PaintTrigger(vcl::RenderContext& rRenderConte
 
     ::tools::Rectangle aOutRect(rRect);
 
-    rRenderContext.Push();
+    auto popIt = rRenderContext.ScopedPush();
     
rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetDialogColor());
     rRenderContext.SetLineColor();
     // fill the background with the dialog bg color
@@ -336,12 +336,11 @@ void 
CustomAnimationListEntryItem::PaintTrigger(vcl::RenderContext& rRenderConte
     // Draw the text with the dialog text color
     
rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetDialogTextColor());
     rRenderContext.DrawText(aOutRect, 
rRenderContext.GetEllipsisString(msDescription, aOutRect.GetWidth()));
-    rRenderContext.Pop();
 }
 
 void CustomAnimationListEntryItem::PaintEffect(vcl::RenderContext& 
rRenderContext, const ::tools::Rectangle& rRect, bool bSelected)
 {
-    rRenderContext.Push(vcl::PushFlags::TEXTCOLOR);
+    auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::TEXTCOLOR);
     const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
     if (bSelected)
         rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor());
@@ -426,7 +425,6 @@ void 
CustomAnimationListEntryItem::PaintEffect(vcl::RenderContext& rRenderContex
     aPos.AdjustY(nItemHeight / 2);
 
     rRenderContext.DrawText(aPos, 
rRenderContext.GetEllipsisString(msEffectName, rRect.GetWidth()));
-    rRenderContext.Pop();
 }
 
 void CustomAnimationListEntryItem::Paint(vcl::RenderContext& rRenderContext, 
const ::tools::Rectangle& rRect, bool bSelected)
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index dc089dad27d1..6d906aa71d4f 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -79,7 +79,7 @@ void SdDisplay::SetBitmapEx( BitmapEx const * pBmpEx )
 
 void SdDisplay::Paint(vcl::RenderContext& rRenderContext, const 
::tools::Rectangle&)
 {
-    rRenderContext.Push(vcl::PushFlags::MAPMODE);
+    auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE);
 
     rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel));
     const StyleSettings& rStyles = 
Application::GetSettings().GetStyleSettings();
@@ -99,8 +99,6 @@ void SdDisplay::Paint(vcl::RenderContext& rRenderContext, 
const ::tools::Rectang
         aPt.setY( ( aSize.Height() - aBmpSize.Height() ) / 2 );
 
     aBitmapEx.Draw(&rRenderContext, aPt, aBmpSize);
-
-    rRenderContext.Pop();
 }
 
 void SdDisplay::SetScale( const Fraction& rFrac )
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index f25bdbbd970b..4ee751f37c24 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -703,7 +703,7 @@ void PresLayoutPreview::Paint(vcl::RenderContext& 
rRenderContext, SdrTextObj con
 
 void PresLayoutPreview::Paint(vcl::RenderContext& rRenderContext, const 
::tools::Rectangle&)
 {
-    rRenderContext.Push();
+    auto popIt = rRenderContext.ScopedPush();
 
     maOutRect = ::tools::Rectangle(Point(0,0), rRenderContext.GetOutputSize());
 
@@ -756,8 +756,6 @@ void PresLayoutPreview::Paint(vcl::RenderContext& 
rRenderContext, const ::tools:
         if (pNumber)
             Paint(rRenderContext, pNumber, maSettings.mbSlideNumberVisible);
     }
-
-    rRenderContext.Pop();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/titledockwin.cxx 
b/sd/source/ui/dlg/titledockwin.cxx
index c01a36252004..2b9ce41be675 100644
--- a/sd/source/ui/dlg/titledockwin.cxx
+++ b/sd/source/ui/dlg/titledockwin.cxx
@@ -140,7 +140,7 @@ namespace sd
 
         SfxDockingWindow::Paint(rRenderContext, i_rArea);
 
-        rRenderContext.Push(vcl::PushFlags::FONT | vcl::PushFlags::FILLCOLOR | 
vcl::PushFlags::LINECOLOR);
+        auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FONT | 
vcl::PushFlags::FILLCOLOR | vcl::PushFlags::LINECOLOR);
 
         rRenderContext.SetFillColor(rStyleSettings.GetDialogColor());
         rRenderContext.SetLineColor();
@@ -191,9 +191,6 @@ namespace sd
         rRenderContext.DrawText(aTitleBarBox,
                                 !m_sTitle.isEmpty() ? m_sTitle : GetText(),
                                 DrawTextFlags::Left | DrawTextFlags::VCenter | 
DrawTextFlags::MultiLine | DrawTextFlags::WordBreak);
-
-        // Restore original values of the output device.
-        rRenderContext.Pop();
     }
 
 

Reply via email to