diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-02-13 16:08:01 +1100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-03-02 10:59:59 +0100 |
commit | 352daabd6f0ce5163a664e232585077d8edbbb2e (patch) | |
tree | b3935e362aeef31e6a5de3bc1fc7729add81a866 /include | |
parent | f5005d52389cb7519734b45d6268434ed3604679 (diff) |
tdf#85761 vcl: JPEG export does not save PPI values correctly
JPEG values are currently hardcoded to 96PPI when we export JPEGs. The
Graphic class doesn't have an easy way to get the PPI, but this can
actually be calculated from the pref size and pref map mode (no idea
why it is called "Pref").
Interestingly, you need to get a multiplier to work this out, relative
to units of 100th mm. The EPS filter code had a function that does
exactly this, but it's entirely based on MapMode units so it was really
implemented in the wrong class IMO. I have thus moved it out of PSWriter
and into MapMode.
This also fixes tdf#65695, which was partially fixed, but had the JPEG
PPI hardcoded to 96dpi.
Also fixes tdf#97481.
Change-Id: Iedb674141dd4e22fcbfb7be357dc777f732aa3aa
Reviewed-on: https://gerrit.libreoffice.org/22339
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/22380
Reviewed-on: https://gerrit.libreoffice.org/22454
(cherry picked from commit a8c2e437a38fcb0cda9f3e8569f32185597f893f)
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/graph.hxx | 3 | ||||
-rw-r--r-- | include/vcl/mapmod.hxx | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 929daf8ee1fb..0667bf5d9079 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -31,6 +31,7 @@ #include <vcl/gfxlink.hxx> #include <com/sun/star/uno/Reference.hxx> #include <vcl/svgdata.hxx> +#include <basegfx/vector/b2dsize.hxx> namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } } @@ -137,6 +138,8 @@ public: MapMode GetPrefMapMode() const; void SetPrefMapMode( const MapMode& rPrefMapMode ); + basegfx::B2DSize GetPPI() const; + Size GetSizePixel( const OutputDevice* pRefDevice = NULL ) const; sal_uLong GetSizeBytes() const; diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx index 2edd16f09923..76c5ad5b81ad 100644 --- a/include/vcl/mapmod.hxx +++ b/include/vcl/mapmod.hxx @@ -64,6 +64,9 @@ public: void SetScaleY( const Fraction& rScaleY ); const Fraction& GetScaleY() const; + /// Gets the multiplier, which is relative to 1/100 mm units + double GetUnitMultiplier() const; + MapMode& operator=( const MapMode& rMapMode ); bool operator==( const MapMode& rMapMode ) const; bool operator!=( const MapMode& rMapMode ) const |