summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-10-27 17:42:36 +0200
committerTomaž Vajngerl <quikee@gmail.com>2016-10-29 18:14:01 +0000
commit5bb5463efefc4d65e3434b37618cb74a1fe2a598 (patch)
treec55623858d6691778c8b046b5fc6600e5f55ed77 /vcl/source/bitmap
parentc857e5ef42266485619587198dcf4599cf995935 (diff)
tdf#51733 support SVG icon theme, disk cache and scaling / darken
Also resolves tdf#92248 This extends icon name resolving so that is in addition tries to find an icon with the "svg" extension and load that instead of stated (mostly "png") extension. If the filename extension is "svg" we load the icon with the SVG filter instead. This also adds icon scaling and conversion for HiDPI or when a dark theme is wanted. If the SVG icon is available, we render it at a higher resolution instead of scaling As loading of SVG icons can be computatunally expensive, a icon disk cache was added. This saves the rendered SVG as a PNG image into the "cache" folder. The same caching is also used for HiDPI and dark theme converted icons so we don't always scale or convert the icons. In addition some style changes and DRY fixes were made to the ImplImageTree source code. Change-Id: I9e421395a342ffe8da9facea7ea06e5db2778b26 Reviewed-on: https://gerrit.libreoffice.org/30339 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/bitmap')
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index f50cca876ee9..fe4736326036 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -29,7 +29,10 @@ using drawinglayer::primitive2d::Primitive2DReference;
namespace vcl
{
-void BitmapTools::loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScalingFactor)
+namespace bitmap
+{
+
+void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScalingFactor)
{
uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
const uno::Reference<graphic::XSvgParser> xSvgParser = graphic::SvgTools::create(xContext);
@@ -67,7 +70,7 @@ void BitmapTools::loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx
aRealRect.X2 = aRange.getMaxX() - aRange.getMinX();
aRealRect.Y2 = aRange.getMaxY() - aRange.getMinY();
- double nDPI = 90 * fScalingFactor;
+ double nDPI = 96 * fScalingFactor;
const css::uno::Reference<css::graphic::XPrimitive2DRenderer> xPrimitive2DRenderer = css::graphic::Primitive2DTools::create(xContext);
const css::uno::Reference<css::rendering::XBitmap> xBitmap(
@@ -85,6 +88,6 @@ void BitmapTools::loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx
}
}
-}
+}} // end vcl::bitmap
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */