summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-16 14:56:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-16 17:42:41 +0200
commita94f95d173e531fe7df0e8caebd6763253798b39 (patch)
tree0ea825a86c4a2cbbf54c45d8498b4e6424e0eaa5 /vcl
parentfe70fa98ef53e5dc054d86c7cb857e41d6c3e6d6 (diff)
tdf#126254 Help - About is black with Linux gen and gtk2
Change-Id: If18693e1cb8a92a7a152dd9decc892fc5f2b7ab5 Reviewed-on: https://gerrit.libreoffice.org/77591 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx8
-rw-r--r--vcl/source/window/aboutdialog.cxx4
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx38
3 files changed, 14 insertions, 36 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 0ca121c0e8ac..90481eaf0c7e 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1438,13 +1438,13 @@ public:
{
return m_xAboutDialog->GetWebsiteLabel();
}
- virtual void set_logo(VirtualDevice* pDevice) override
+ virtual void set_logo(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
{
- m_xAboutDialog->SetLogo(createImage(*pDevice));
+ m_xAboutDialog->SetLogo(Image(rImage));
}
- virtual void set_background(VirtualDevice* pDevice) override
+ virtual void set_background(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
{
- m_xAboutDialog->SetBackground(createImage(*pDevice));
+ m_xAboutDialog->SetBackground(Image(rImage));
}
};
diff --git a/vcl/source/window/aboutdialog.cxx b/vcl/source/window/aboutdialog.cxx
index 10074a1a3eac..483aec85017e 100644
--- a/vcl/source/window/aboutdialog.cxx
+++ b/vcl/source/window/aboutdialog.cxx
@@ -129,10 +129,8 @@ void AboutDialog::SetBackground(const Image& rBackgroundBitmap)
Invalidate();
}
-void AboutDialog::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect)
+void AboutDialog::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
{
- rRenderContext.SetClipRegion(vcl::Region(rRect));
-
Size aSize(GetOutputSizePixel());
Point aPos(aSize.Width() - m_aBackgroundBitmap.GetSizePixel().Width(),
aSize.Height() - m_aBackgroundBitmap.GetSizePixel().Height());
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index b015248a4acb..aa831c1bfbb9 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3514,9 +3514,9 @@ public:
return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8);
}
- virtual void set_logo(VirtualDevice* pDevice) override
+ virtual void set_logo(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
{
- GdkPixbuf* pixbuf = pDevice ? getPixbuf(*pDevice) : nullptr;
+ GdkPixbuf* pixbuf = rImage.is() ? getPixbuf(rImage) : nullptr;
if (!pixbuf)
gtk_about_dialog_set_logo(m_pAboutDialog, nullptr);
else
@@ -3526,7 +3526,7 @@ public:
}
}
- virtual void set_background(VirtualDevice* pDevice) override
+ virtual void set_background(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
{
GtkStyleContext *pStyleContext = gtk_widget_get_style_context(GTK_WIDGET(m_pAboutDialog));
if (m_pCssProvider)
@@ -3537,37 +3537,17 @@ public:
mxBackgroundImage.reset();
- if (pDevice)
+ if (rImage.is())
{
mxBackgroundImage.reset(new utl::TempFile());
mxBackgroundImage->EnableKillingFile(true);
- OString sOutput = mxBackgroundImage->GetFileName().toUtf8();
-
- cairo_surface_t* orig_surface = get_underlying_cairo_surface(*pDevice);
- double m_fXScale, m_fYScale;
- dl_cairo_surface_get_device_scale(orig_surface, &m_fXScale, &m_fYScale);
-
- cairo_surface_t* surface;
- if (m_fXScale != 1.0 || m_fYScale != -1)
- {
- Size aSize(pDevice->GetOutputSizePixel());
- surface = cairo_surface_create_similar_image(orig_surface,
- CAIRO_FORMAT_ARGB32,
- aSize.Width(),
- aSize.Height());
- cairo_t* cr = cairo_create(surface);
- cairo_set_source_surface(cr, orig_surface, 0, 0);
- cairo_paint(cr);
- cairo_destroy(cr);
- }
- else
- surface = orig_surface;
-
- cairo_surface_write_to_png(surface, sOutput.getStr());
+ Image aImage(rImage);
- if (surface != orig_surface)
- cairo_surface_destroy(surface);
+ vcl::PNGWriter aPNGWriter(aImage.GetBitmapEx());
+ SvStream* pStream = mxBackgroundImage->GetStream(StreamMode::WRITE);
+ aPNGWriter.Write(*pStream);
+ mxBackgroundImage->CloseStream();
m_pCssProvider = gtk_css_provider_new();
OUString aBuffer = "* { background-image: url(\"" + mxBackgroundImage->GetURL() + "\"); }";