summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-08-09 15:01:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-08-09 22:09:15 +0200
commit622347b913dd0aedaec1d0a4658e5dc7801f6bde (patch)
treeb6d582523a4d0db32d1a762de35b5aed5b63cee5
parent8d3a4fa775a23371aed58bbbab1d5a7537df5110 (diff)
send this MapMode scale thing back to where it came from
Change-Id: Ic33f4b4bf7a0df35f04778e474f5a136f06be4a6 Reviewed-on: https://gerrit.libreoffice.org/40926 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx49
-rw-r--r--include/vcl/mapmod.hxx3
-rw-r--r--vcl/CppunitTest_vcl_mapmode.mk49
-rw-r--r--vcl/Module_vcl.mk1
-rw-r--r--vcl/qa/cppunit/mapmode.cxx65
-rw-r--r--vcl/source/gdi/mapmod.cxx46
6 files changed, 48 insertions, 165 deletions
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 51577eb31393..7f4dd74e9982 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -213,6 +213,7 @@ private:
inline void ImplWriteTextColor( sal_uLong nMode );
void ImplWriteColor( sal_uLong nMode );
+ static double ImplGetScaling( const MapMode& );
void ImplGetMapMode( const MapMode& );
static bool ImplGetBoundingBox( double* nNumb, sal_uInt8* pSource, sal_uLong nSize );
static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uLong nComp, sal_uLong nSize );
@@ -2173,7 +2174,7 @@ void PSWriter::ImplWriteColor( sal_uLong nMode )
void PSWriter::ImplGetMapMode( const MapMode& rMapMode )
{
ImplWriteLine( "tm setmatrix" );
- double fMul = rMapMode.GetUnitMultiplier();
+ double fMul = ImplGetScaling(rMapMode);
double fScaleX = (double)rMapMode.GetScaleX() * fMul;
double fScaleY = (double)rMapMode.GetScaleY() * fMul;
ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY );
@@ -2214,6 +2215,52 @@ inline void PSWriter::ImplWriteLine( const char* pString, sal_uLong nMode )
ImplExecMode( nMode );
}
+double PSWriter::ImplGetScaling( const MapMode& rMapMode )
+{
+ double nMul;
+ switch (rMapMode.GetMapUnit())
+ {
+ case MapUnit::MapPixel :
+ case MapUnit::MapSysFont :
+ case MapUnit::MapAppFont :
+
+ case MapUnit::Map100thMM :
+ nMul = 1;
+ break;
+ case MapUnit::Map10thMM :
+ nMul = 10;
+ break;
+ case MapUnit::MapMM :
+ nMul = 100;
+ break;
+ case MapUnit::MapCM :
+ nMul = 1000;
+ break;
+ case MapUnit::Map1000thInch :
+ nMul = 2.54;
+ break;
+ case MapUnit::Map100thInch :
+ nMul = 25.4;
+ break;
+ case MapUnit::Map10thInch :
+ nMul = 254;
+ break;
+ case MapUnit::MapInch :
+ nMul = 2540;
+ break;
+ case MapUnit::MapTwip :
+ nMul = 1.76388889;
+ break;
+ case MapUnit::MapPoint :
+ nMul = 35.27777778;
+ break;
+ default:
+ nMul = 1.0;
+ break;
+ }
+ return nMul;
+}
+
void PSWriter::ImplWriteLineInfo( double fLWidth, double fMLimit,
SvtGraphicStroke::CapType eLCap,
diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx
index 6908833ec49c..b426326ac485 100644
--- a/include/vcl/mapmod.hxx
+++ b/include/vcl/mapmod.hxx
@@ -55,9 +55,6 @@ 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 );
MapMode& operator=( MapMode&& rMapMode );
bool operator==( const MapMode& rMapMode ) const;
diff --git a/vcl/CppunitTest_vcl_mapmode.mk b/vcl/CppunitTest_vcl_mapmode.mk
deleted file mode 100644
index e29a16af4e0f..000000000000
--- a/vcl/CppunitTest_vcl_mapmode.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_CppunitTest_CppunitTest,vcl_mapmode))
-
-$(eval $(call gb_CppunitTest_set_include,vcl_mapmode,\
- $$(INCLUDE) \
- -I$(SRCDIR)/vcl/inc \
-))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,vcl_mapmode, \
- vcl/qa/cppunit/mapmode \
-))
-
-$(eval $(call gb_CppunitTest_use_externals,vcl_mapmode,boost_headers))
-
-$(eval $(call gb_CppunitTest_use_libraries,vcl_mapmode, \
- comphelper \
- cppu \
- cppuhelper \
- sal \
- svt \
- test \
- tl \
- tk \
- unotest \
- vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,vcl_mapmode))
-
-$(eval $(call gb_CppunitTest_use_ure,vcl_mapmode))
-$(eval $(call gb_CppunitTest_use_vcl,vcl_mapmode))
-
-$(eval $(call gb_CppunitTest_use_components,vcl_mapmode,\
- configmgr/source/configmgr \
- i18npool/util/i18npool \
- ucb/source/core/ucb1 \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,vcl_mapmode))
-
-# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 93625766c832..086328dbf466 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -149,7 +149,6 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
CppunitTest_vcl_fontmetric \
CppunitTest_vcl_complextext \
CppunitTest_vcl_filters_test \
- CppunitTest_vcl_mapmode \
CppunitTest_vcl_mnemonic \
CppunitTest_vcl_outdev \
CppunitTest_vcl_app_test \
diff --git a/vcl/qa/cppunit/mapmode.cxx b/vcl/qa/cppunit/mapmode.cxx
deleted file mode 100644
index afa259a6e799..000000000000
--- a/vcl/qa/cppunit/mapmode.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <test/bootstrapfixture.hxx>
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-
-#include <osl/file.hxx>
-#include <osl/process.h>
-
-#include <vcl/mapmod.hxx>
-
-class VclMapModeTest : public test::BootstrapFixture
-{
-public:
- VclMapModeTest() : BootstrapFixture(true, false) {}
-
- void testMultiplier();
-
- CPPUNIT_TEST_SUITE(VclMapModeTest);
- CPPUNIT_TEST(testMultiplier);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void VclMapModeTest::testMultiplier()
-{
- MapMode aMapMode;
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Default map mode is MapUnit::MapPixel, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::MapSysFont );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapSysFont, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::MapAppFont );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapAppFont, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::Map100thMM );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map100thMM, multiplier should be 1", 1.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::Map10thMM );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map10thMM, multiplier should be 10", 10.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::MapMM );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapMM, multiplier should be 100", 100.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::MapCM );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapCM, multiplier should be 1000", 1000.0, aMapMode.GetUnitMultiplier(), 1E-12);
- aMapMode.SetMapUnit( MapUnit::Map1000thInch );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map1000thInch, multiplier should be 2.54", 2.54, aMapMode.GetUnitMultiplier(), 1E-12 );
- aMapMode.SetMapUnit( MapUnit::Map100thInch );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map100thInch, multiplier should be 2.54", 25.4, aMapMode.GetUnitMultiplier(), 1E-12 );
- aMapMode.SetMapUnit( MapUnit::Map10thInch );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::Map10thInch, multiplier should be 254", 254.0, aMapMode.GetUnitMultiplier(), 1E-12 );
- aMapMode.SetMapUnit( MapUnit::MapInch );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapInch, multiplier should be 2540", 2540.0, aMapMode.GetUnitMultiplier(), 1E-12 );
- aMapMode.SetMapUnit( MapUnit::MapTwip );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapTwip, multiplier should be 1.76388889", 1.76388889, aMapMode.GetUnitMultiplier(), 1E-12 );
- aMapMode.SetMapUnit( MapUnit::MapPoint );
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Map mode is MapUnit::MapPoint, multiplier should be 35.27777778", 35.27777778, aMapMode.GetUnitMultiplier(), 1E-12 );
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(VclMapModeTest);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
index c4d0cf9f555f..3f7a8272bd7f 100644
--- a/vcl/source/gdi/mapmod.cxx
+++ b/vcl/source/gdi/mapmod.cxx
@@ -129,52 +129,6 @@ void MapMode::SetScaleY( const Fraction& rScaleY )
mpImplMapMode->mbSimple = false;
}
-double MapMode::GetUnitMultiplier() const
-{
- double nMul;
- switch ( GetMapUnit() )
- {
- case MapUnit::MapPixel :
- case MapUnit::MapSysFont :
- case MapUnit::MapAppFont :
-
- case MapUnit::Map100thMM :
- nMul = 1;
- break;
- case MapUnit::Map10thMM :
- nMul = 10;
- break;
- case MapUnit::MapMM :
- nMul = 100;
- break;
- case MapUnit::MapCM :
- nMul = 1000;
- break;
- case MapUnit::Map1000thInch :
- nMul = 2.54;
- break;
- case MapUnit::Map100thInch :
- nMul = 25.4;
- break;
- case MapUnit::Map10thInch :
- nMul = 254;
- break;
- case MapUnit::MapInch :
- nMul = 2540;
- break;
- case MapUnit::MapTwip :
- nMul = 1.76388889;
- break;
- case MapUnit::MapPoint :
- nMul = 35.27777778;
- break;
- default:
- nMul = 1.0;
- break;
- }
- return nMul;
-}
-
MapMode& MapMode::operator=( const MapMode& rMapMode )
{
mpImplMapMode = rMapMode.mpImplMapMode;