svx/inc/galbrws2.hxx             |    1 -
 svx/source/gallery2/galbrws2.cxx |   14 ++++++--------
 2 files changed, 6 insertions(+), 9 deletions(-)

New commits:
commit f2b7b0efba1ffc22b987563a5df339282018bc7a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Nov 25 17:12:26 2021 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sat Nov 27 17:47:17 2021 +0100

    tdf#139102 Erase with COL_TRANSPARENT doesn't do what it should
    
    lets not fight that here, just provide a simple backportable fix to 7-2
    for now.
    
    Change-Id: I77ceb7ccace08041a42b51e1b028ebe2d6a03e51
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125828
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index 2640184846e3..7136a54284bf 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -85,7 +85,6 @@ private:
     std::unique_ptr<weld::ToggleButton> mxIconButton;
     std::unique_ptr<weld::ToggleButton> mxListButton;
     std::unique_ptr<weld::Label> mxInfoBar;
-    ScopedVclPtr<VirtualDevice> mxDev;
     Size maPreviewSize;
     rtl::Reference<GalleryTransferable> m_xHelper;
     sal_uInt32 mnCurActionPos;
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index b644a2d51422..452825679bdb 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -342,14 +342,11 @@ GalleryBrowser2::GalleryBrowser2(weld::Builder& rBuilder, 
Gallery* pGallery)
     , mxIconButton(rBuilder.weld_toggle_button("icon"))
     , mxListButton(rBuilder.weld_toggle_button("list"))
     , mxInfoBar(rBuilder.weld_label("label"))
-    , mxDev(mxListView->create_virtual_device())
     , maPreviewSize(28, 28)
     , mnCurActionPos      ( 0xffffffff )
     , meMode              ( GALLERYBROWSERMODE_NONE )
     , meLastMode          ( GALLERYBROWSERMODE_NONE )
 {
-    mxDev->SetOutputSizePixel(maPreviewSize);
-
     m_xContext.set( ::comphelper::getProcessComponentContext() );
 
     int nHeight = mxListView->get_height_rows(10);
@@ -860,6 +857,9 @@ void GalleryBrowser2::UpdateRows(bool bVisibleOnly)
             }
         }
 
+        ScopedVclPtr<VirtualDevice> xDev(mxListView->create_virtual_device());
+        xDev->SetOutputSizePixel(maPreviewSize);
+
         if (!aBitmapEx.IsEmpty())
         {
             const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
@@ -867,19 +867,17 @@ void GalleryBrowser2::UpdateRows(bool bVisibleOnly)
                 ((maPreviewSize.Width() - aBitmapExSizePixel.Width()) >> 1),
                 ((maPreviewSize.Height() - aBitmapExSizePixel.Height()) >> 1));
 
-            mxDev->Erase();
-
             if (aBitmapEx.IsAlpha())
             {
                 // draw checkered background
-                GalleryIconView::drawTransparenceBackground(*mxDev, aPos, 
aBitmapExSizePixel);
+                GalleryIconView::drawTransparenceBackground(*xDev, aPos, 
aBitmapExSizePixel);
             }
 
-            mxDev->DrawBitmapEx(aPos, aBitmapEx);
+            xDev->DrawBitmapEx(aPos, aBitmapEx);
         }
 
         mxListView->set_text(rEntry, sItemTextTitle);
-        mxListView->set_image(rEntry, *mxDev);
+        mxListView->set_image(rEntry, *xDev);
         mxListView->set_id(rEntry, OUString());
 
         return false;

Reply via email to