summaryrefslogtreecommitdiffstats
path: root/cppcanvas
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-07-29 20:49:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-07-30 16:40:56 +0200
commit8689bd5490b473a7ffb149bbe5f7f0683f679c72 (patch)
tree896991b9de6e8aa9e00149b8ff7c12873cd73d48 /cppcanvas
parentcid#1489551 silence Uninitialized scalar variable (diff)
downloadcore-8689bd5490b473a7ffb149bbe5f7f0683f679c72.tar.gz
core-8689bd5490b473a7ffb149bbe5f7f0683f679c72.zip
convert TextAlign to scoped enum
Change-Id: Id2c466eacb44f0ea6adba75a0ac0be8be8e7ed4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119682 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/inc/outdevstate.hxx2
-rw-r--r--cppcanvas/source/mtfrenderer/mtftools.cxx26
2 files changed, 12 insertions, 16 deletions
diff --git a/cppcanvas/source/inc/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx
index 16cc3c4ff25a..09b70b6cdcd5 100644
--- a/cppcanvas/source/inc/outdevstate.hxx
+++ b/cppcanvas/source/inc/outdevstate.hxx
@@ -63,7 +63,7 @@ namespace cppcanvas::internal
textOverlineStyle(LINESTYLE_NONE),
textUnderlineStyle(LINESTYLE_NONE),
textStrikeoutStyle(STRIKEOUT_NONE),
- textReferencePoint(ALIGN_BASELINE),
+ textReferencePoint(TextAlign::Baseline),
isTextOutlineModeSet( false ),
isTextEffectShadowSet( false ),
diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx
index c5d36eb00652..52e35b73dc0c 100644
--- a/cppcanvas/source/mtfrenderer/mtftools.cxx
+++ b/cppcanvas/source/mtfrenderer/mtftools.cxx
@@ -51,28 +51,24 @@ namespace cppcanvas::tools
::Size getBaselineOffset( const ::cppcanvas::internal::OutDevState& outdevState,
const VirtualDevice& rVDev )
{
+ ::Size aRet(0, 0);
const ::FontMetric& aMetric = rVDev.GetFontMetric();
// calc offset for text output, the XCanvas always renders
// baseline offset.
switch( outdevState.textReferencePoint )
{
- case ALIGN_TOP:
- return ::Size( 0,
- aMetric.GetInternalLeading() + aMetric.GetAscent() );
-
- default:
- ENSURE_OR_THROW( false,
- "tools::getBaselineOffset(): Unexpected TextAlign value" );
- // FALLTHROUGH intended (to calm compiler warning - case won't happen)
- case ALIGN_BASELINE:
- return ::Size( 0, 0 );
-
- case ALIGN_BOTTOM:
- return ::Size( 0,
- -aMetric.GetDescent() );
-
+ case TextAlign::Baseline:
+ break;
+ case TextAlign::Top:
+ aRet = ::Size(0, aMetric.GetInternalLeading() + aMetric.GetAscent());
+ break;
+ case TextAlign::Bottom:
+ aRet = ::Size(0, -aMetric.GetDescent());
+ break;
}
+
+ return aRet;
}
::basegfx::B2DHomMatrix& calcLogic2PixelLinearTransform( ::basegfx::B2DHomMatrix& o_rMatrix,