parent
fbdda849d9
commit
ab4c6ab356
@ -0,0 +1,73 @@
|
|||||||
|
From 633003965a4be0c535b43cc3072c5c4a95109d34 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tor Lillqvist <tml@collabora.com>
|
||||||
|
Date: Fri, 16 May 2014 16:43:25 +0300
|
||||||
|
Subject: [PATCH] Use SVM (metafile) instead of PNG for diagrams (SmartArt)
|
||||||
|
|
||||||
|
It seemed a bit pointless to waste CPU cycles on PNG-compressing a
|
||||||
|
bitmap image only to later then uncompress it anyway. vcl's PNG
|
||||||
|
writing code showed up as 13% on the time profile of TiledLibreOffice
|
||||||
|
when displaying a document full of SmartArts.
|
||||||
|
|
||||||
|
Miklos suggested I try using SVM (which I guess means "StarView
|
||||||
|
Metafile") instead. When using SVM, no rendering of diagrams to
|
||||||
|
bitmaps during loading is done, but the diagram stays stored in a
|
||||||
|
resolution-independent (vector-ish) form. Which means it will be
|
||||||
|
rendered nicely and crisply regardless of the zoom level.
|
||||||
|
|
||||||
|
At least, that is my understanding, and experimentation (on OS X and Linux)
|
||||||
|
seems to confirm.
|
||||||
|
|
||||||
|
ce8c0ff07559ddcc729bffd7a68f4c6f281882e3
|
||||||
|
|
||||||
|
Change-Id: Ice8c0ff07559ddcc729bffd7a68f4c6f281882e3
|
||||||
|
---
|
||||||
|
oox/source/drawingml/shape.cxx | 26 ++++++++++----------------
|
||||||
|
1 file changed, 10 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
|
||||||
|
index b319c38..33c846c 100644
|
||||||
|
--- a/oox/source/drawingml/shape.cxx
|
||||||
|
+++ b/oox/source/drawingml/shape.cxx
|
||||||
|
@@ -1088,7 +1088,7 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
|
||||||
|
Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
|
||||||
|
|
||||||
|
// Rendering format
|
||||||
|
- OUString sFormat( "PNG" );
|
||||||
|
+ OUString sFormat( "SVM" );
|
||||||
|
|
||||||
|
// Size of the rendering
|
||||||
|
awt::Size aActualSize = mxShape->getSize();
|
||||||
|
@@ -1097,21 +1097,15 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
|
||||||
|
awt::Size aSize = awt::Size( static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Width ) + 0.5 ),
|
||||||
|
static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Height ) + 0.5 ) );
|
||||||
|
|
||||||
|
- Sequence< PropertyValue > aFilterData( 7 );
|
||||||
|
- aFilterData[ 0 ].Name = "Compression";
|
||||||
|
- aFilterData[ 0 ].Value <<= static_cast < sal_Int32 > ( 9 );
|
||||||
|
- aFilterData[ 1 ].Name = "Interlaced";
|
||||||
|
- aFilterData[ 1 ].Value <<= static_cast < sal_Int32 > ( 1 );
|
||||||
|
- aFilterData[ 2 ].Name = "Translucent";
|
||||||
|
- aFilterData[ 2 ].Value <<= static_cast < sal_Int32 > ( 1 );
|
||||||
|
- aFilterData[ 3 ].Name = "PixelWidth";
|
||||||
|
- aFilterData[ 3 ].Value <<= aSize.Width;
|
||||||
|
- aFilterData[ 4 ].Name = "PixelHeight";
|
||||||
|
- aFilterData[ 4 ].Value <<= aSize.Height;
|
||||||
|
- aFilterData[ 5 ].Name = "LogicalWidth";
|
||||||
|
- aFilterData[ 5 ].Value <<= aActualSize.Width;
|
||||||
|
- aFilterData[ 6 ].Name = "LogicalHeight";
|
||||||
|
- aFilterData[ 6 ].Value <<= aActualSize.Height;
|
||||||
|
+ Sequence< PropertyValue > aFilterData( 4 );
|
||||||
|
+ aFilterData[ 0 ].Name = "PixelWidth";
|
||||||
|
+ aFilterData[ 0 ].Value <<= aSize.Width;
|
||||||
|
+ aFilterData[ 1 ].Name = "PixelHeight";
|
||||||
|
+ aFilterData[ 1 ].Value <<= aSize.Height;
|
||||||
|
+ aFilterData[ 2 ].Name = "LogicalWidth";
|
||||||
|
+ aFilterData[ 2 ].Value <<= aActualSize.Width;
|
||||||
|
+ aFilterData[ 3 ].Name = "LogicalHeight";
|
||||||
|
+ aFilterData[ 3 ].Value <<= aActualSize.Height;
|
||||||
|
|
||||||
|
Sequence < PropertyValue > aDescriptor( 3 );
|
||||||
|
aDescriptor[ 0 ].Name = "OutputStream";
|
||||||
|
--
|
||||||
|
1.9.0
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
From 8057b2448edfa653911fa4d42870a2d1aa7694d7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@collabora.com>
|
|
||||||
Date: Mon, 24 Mar 2014 16:21:44 +0100
|
|
||||||
Subject: [PATCH] fix libetonyek build
|
|
||||||
|
|
||||||
KEY2StyleParser.cpp:65:10: error: no matching function for call to 'readNumber'
|
|
||||||
KEY2StyleParser.cpp:34:13: note: candidate template ignored: couldn't infer template argument 'C'
|
|
||||||
|
|
||||||
I took the patch from Fridrich's openSUSE rpms.
|
|
||||||
|
|
||||||
Change-Id: Iba3c682539c5c978dddb0040f24f23c7299af0d9
|
|
||||||
---
|
|
||||||
external/libetonyek/UnpackedTarball_libetonyek.mk | 1 +
|
|
||||||
.../libetonyek/libetonyek-0.0.3-lexical_cast.patch | 56 ++++++++++++++++++++++
|
|
||||||
2 files changed, 57 insertions(+)
|
|
||||||
create mode 100644 external/libetonyek/libetonyek-0.0.3-lexical_cast.patch
|
|
||||||
|
|
||||||
diff --git a/external/libetonyek/UnpackedTarball_libetonyek.mk b/external/libetonyek/UnpackedTarball_libetonyek.mk
|
|
||||||
index d452574..0db9596 100644
|
|
||||||
--- a/external/libetonyek/UnpackedTarball_libetonyek.mk
|
|
||||||
+++ b/external/libetonyek/UnpackedTarball_libetonyek.mk
|
|
||||||
@@ -13,6 +13,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libetonyek,$(ETONYEK_TARBALL)))
|
|
||||||
|
|
||||||
$(eval $(call gb_UnpackedTarball_add_patches,libetonyek,\
|
|
||||||
external/libetonyek/0001-Comma-at-the-end-of-emum-list.patch.1 \
|
|
||||||
+ external/libetonyek/libetonyek-0.0.3-lexical_cast.patch \
|
|
||||||
))
|
|
||||||
|
|
||||||
# vim: set noet sw=4 ts=4:
|
|
||||||
diff --git a/external/libetonyek/libetonyek-0.0.3-lexical_cast.patch b/external/libetonyek/libetonyek-0.0.3-lexical_cast.patch
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..fbd8bf6
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/external/libetonyek/libetonyek-0.0.3-lexical_cast.patch
|
|
||||||
@@ -0,0 +1,56 @@
|
|
||||||
+--- a/libetonyek-0.0.3/src/lib/KEY2ParserUtils.cpp 2013-12-01 21:44:51.000000000 +0100
|
|
||||||
++++ b/libetonyek-0.0.3/src/lib/KEY2ParserUtils.cpp 2013-12-15 06:53:07.474721349 +0100
|
|
||||||
+@@ -125,7 +125,7 @@
|
|
||||||
+ return KEYSize(size.second, size.first);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+-bool KEY2ParserUtils::bool_cast(const char *const value)
|
|
||||||
++bool KEY2ParserUtils::bool_cast(const char *value)
|
|
||||||
+ {
|
|
||||||
+ KEY2Tokenizer tok;
|
|
||||||
+ switch (tok(value))
|
|
||||||
+@@ -142,6 +142,16 @@
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
++double KEY2ParserUtils::double_cast(const char *value)
|
|
||||||
++{
|
|
||||||
++ return lexical_cast<double, const char *>(value);
|
|
||||||
++}
|
|
||||||
++
|
|
||||||
++int KEY2ParserUtils::int_cast(const char *value)
|
|
||||||
++{
|
|
||||||
++ return lexical_cast<int, const char *>(value);
|
|
||||||
++}
|
|
||||||
++
|
|
||||||
+ double KEY2ParserUtils::deg2rad(double value)
|
|
||||||
+ {
|
|
||||||
+ // normalize range
|
|
||||||
+--- a/libetonyek-0.0.3/src/lib/KEY2ParserUtils.h 2013-10-30 22:04:38.000000000 +0100
|
|
||||||
++++ b/libetonyek-0.0.3/src/lib/KEY2ParserUtils.h 2013-12-15 06:50:40.296884951 +0100
|
|
||||||
+@@ -81,6 +81,8 @@
|
|
||||||
+ * @returns the boolean value of the string
|
|
||||||
+ */
|
|
||||||
+ static bool bool_cast(const char *value);
|
|
||||||
++ static double double_cast(const char *value);
|
|
||||||
++ static int int_cast(const char *value);
|
|
||||||
+
|
|
||||||
+ static double deg2rad(double value);
|
|
||||||
+
|
|
||||||
+--- a/libetonyek-0.0.3/src/lib/KEY2StyleParser.cpp 2013-12-06 10:36:13.000000000 +0100
|
|
||||||
++++ b/libetonyek-0.0.3/src/lib/KEY2StyleParser.cpp 2013-12-15 06:53:45.353451061 +0100
|
|
||||||
+@@ -62,12 +62,12 @@
|
|
||||||
+
|
|
||||||
+ optional<double> readDouble(const KEYXMLReader &reader)
|
|
||||||
+ {
|
|
||||||
+- return readNumber<double>(reader, KEY2Token::f, &lexical_cast<double, const char *>);
|
|
||||||
++ return readNumber<double>(reader, KEY2Token::f, &KEY2ParserUtils::double_cast);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ optional<int> readInt(const KEYXMLReader &reader)
|
|
||||||
+ {
|
|
||||||
+- return readNumber<int>(reader, KEY2Token::i, &lexical_cast<int, const char *>);
|
|
||||||
++ return readNumber<int>(reader, KEY2Token::i, &KEY2ParserUtils::double_cast);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ optional<KEYColor> readColor(const KEYXMLReader &reader)
|
|
||||||
--
|
|
||||||
1.9.0
|
|
||||||
|
|
Loading…
Reference in new issue