summaryrefslogtreecommitdiff
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
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>
-rw-r--r--cui/source/dialogs/about.cxx12
-rw-r--r--cui/uiconfig/ui/aboutdialog.ui1
-rw-r--r--include/vcl/weld.hxx4
-rw-r--r--vcl/source/app/salvtables.cxx8
-rw-r--r--vcl/source/window/aboutdialog.cxx4
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx38
6 files changed, 21 insertions, 46 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index a10fd4ecba9b..a9617f7a8381 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -178,10 +178,8 @@ void AboutDialog::SetLogo()
m_xDialog->set_logo(nullptr);
else
{
- ScopedVclPtr<VirtualDevice> xDevice(m_xDialog->create_virtual_device());
- xDevice->SetOutputSize(aLogoBitmap.GetSizePixel());
- xDevice->DrawBitmapEx(Point(), aLogoBitmap);
- m_xDialog->set_logo(xDevice.get());
+ Graphic aGraphic(aLogoBitmap);
+ m_xDialog->set_logo(aGraphic.GetXGraphic());
}
}
@@ -193,10 +191,8 @@ IMPL_LINK(AboutDialog, SizeAllocHdl, const Size&, rSize, void)
if (!(Application::GetSettings().GetStyleSettings().GetHighContrastMode()))
{
SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, rSize.Width());
- ScopedVclPtr<VirtualDevice> xDevice(m_xDialog->create_virtual_device());
- xDevice->SetOutputSize(aBackgroundBitmap.GetSizePixel());
- xDevice->DrawBitmapEx(Point(), aBackgroundBitmap);
- m_xDialog->set_background(xDevice.get());
+ Graphic aGraphic(aBackgroundBitmap);
+ m_xDialog->set_background(aGraphic.GetXGraphic());
}
}
diff --git a/cui/uiconfig/ui/aboutdialog.ui b/cui/uiconfig/ui/aboutdialog.ui
index 07f2be7e3e06..b2ad949019c8 100644
--- a/cui/uiconfig/ui/aboutdialog.ui
+++ b/cui/uiconfig/ui/aboutdialog.ui
@@ -9,6 +9,7 @@
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<property name="title" translatable="yes" context="aboutdialog|AboutDialog">About %PRODUCTNAME</property>
+ <property name="resizable">False</property>
<property name="program_name">%PRODUCTNAME</property>
<property name="comments" translatable="yes" context="aboutdialog|description">%PRODUCTNAME is a modern, easy-to-use, open source productivity suite for word processing, spreadsheets, presentations and more.</property>
<property name="website">https://www.libreoffice.org/</property>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 9f781faf1c1c..198b7a72f0d6 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -453,8 +453,8 @@ public:
virtual void set_website(const OUString& rURL) = 0;
virtual void set_website_label(const OUString& rLabel) = 0;
virtual OUString get_website_label() const = 0;
- virtual void set_logo(VirtualDevice* pDevice) = 0;
- virtual void set_background(VirtualDevice* pDevice) = 0;
+ virtual void set_logo(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
+ virtual void set_background(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
};
struct VCL_DLLPUBLIC ComboBoxEntry
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() + "\"); }";