summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-11-08 02:29:36 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-08 06:34:27 +0100
commit6b4730f5649c9d028b140168f92f1fc12c2fb2cb (patch)
tree524a72be8cb17d2165732a19ade5459f7ccf5058 /emfio
parent73334560b2dd2d60ac58d2cc2b1a5295490b03e1 (diff)
Make usage of ETO_PDY flag more visible (EMF)
* Make usage of ETO_PDY flag more visible with introducing nBytesEach variable * Add comments for reading OutputDx ETO_PDY flag indicates that we should read twice values compared to the number of characters in the output string. Values are stored in an array of 32-bit unsigned integers called OutputDx, so there will be either 8 bytes or 4 bytes each depending on ETO_PDY is set or not. Change-Id: I3892c95bd9ad80b3c414e2556f91bd5218b22c3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124097 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/emfreader.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 83754ace1f2d..7a29571d4773 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1907,6 +1907,7 @@ namespace emfio
else if ( nOptions & ETO_OPAQUE )
DrawRectWithBGColor( aRect );
+ // ETO_RTLREADING indicates that the characters are laid from right to left
vcl::text::ComplexTextLayoutFlags nTextLayoutMode = vcl::text::ComplexTextLayoutFlags::Default;
if ( nOptions & ETO_RTLREADING )
nTextLayoutMode = vcl::text::ComplexTextLayoutFlags::BiDiRtl | vcl::text::ComplexTextLayoutFlags::TextOriginLeft;
@@ -1943,7 +1944,20 @@ namespace emfio
std::unique_ptr<tools::Long[]> pDYAry;
sal_Int32 nDxSize;
- bool bOverflow = o3tl::checked_multiply<sal_Int32>(nLen, (nOptions & ETO_PDY) ? 8 : 4, nDxSize);
+ sal_Int32 nBytesEach;
+
+ // Reading OutputDx
+ // ETO_PDY flag indicates that we should read twice values
+ // compared to the number of characters in the output string.
+ // Values are stored in an array of 32-bit unsigned integers
+ // named OutputDx, so there will be either 8 bytes or 4 bytes
+ // each depending on ETO_PDY is set or not.
+ if (nOptions & ETO_PDY)
+ nBytesEach = 8;
+ else
+ nBytesEach = 4;
+
+ bool bOverflow = o3tl::checked_multiply<sal_Int32>(nLen, nBytesEach, nDxSize);
if (!bOverflow && offDx && ((nCurPos + offDx + nDxSize) <= nNextPos ) && nNextPos <= mnEndPos)
{
mpInputStream->Seek( nCurPos + offDx );