avoid intermediate bitmap causing blurring

and use incoming device as background

Change-Id: I13eea4148527fa2c3552db12555ca1ca005d7799
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99232
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9765711..699c0628 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1134,15 +1134,38 @@ std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const
    return std::make_unique<SalInstanceContainer>(pParent, m_pBuilder, false);
}

namespace
{
    void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, OutputDevice& rOutput)
    {
        Size aSize = pWindow->GetSizePixel();

        VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
        xOutput->SetOutputSizePixel(aSize);
        xOutput->DrawOutDev(Point(), aSize, rPos, aSize, rOutput);

        pWindow->Paint(*xOutput, tools::Rectangle(Point(), aSize));

        rOutput.DrawOutDev(rPos, aSize, Point(), aSize, *xOutput);

        xOutput.disposeAndClear();

        for (vcl::Window *pChild = pWindow->GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
        {
            if (!pChild->IsVisible())
                continue;
            DoRecursivePaint(pChild, rPos + pChild->GetPosPixel(), rOutput);
        }
    }
}

void SalInstanceWidget::draw(OutputDevice& rOutput, const tools::Rectangle& rRect)
{
    Size aOrigSize(m_xWidget->GetSizePixel());
    Size aSize = rRect.GetSize();
    m_xWidget->SetSizePixel(aSize);
    rOutput.Push(PushFlags::CLIPREGION);
    rOutput.IntersectClipRegion(rRect);
    m_xWidget->PaintToDevice(&rOutput, rRect.TopLeft());
    rOutput.Pop();

    m_xWidget->SetSizePixel(rRect.GetSize());
    DoRecursivePaint(m_xWidget, rRect.TopLeft(), rOutput);

    m_xWidget->SetSizePixel(aOrigSize);
}

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index faa0793..8d6c2b1e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3079,6 +3079,8 @@ public:

        VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
        xOutput->SetOutputSizePixel(aSize);
        xOutput->DrawOutDev(Point(), aSize, rRect.TopLeft(), aSize, rOutput);

        cairo_surface_t* pSurface = get_underlying_cairo_surface(*xOutput);
        cairo_t* cr = cairo_create(pSurface);