[Libreoffice-commits] core.git: 2 commits - vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jul 24 15:59:15 UTC 2018
vcl/source/gdi/CommonSalLayout.cxx | 9 +++++++--
vcl/source/gdi/sallayout.cxx | 7 ++++---
2 files changed, 11 insertions(+), 5 deletions(-)
New commits:
commit d43c1b718f9a290307510b7d526a981b15264622
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 24 15:24:35 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 24 17:59:03 2018 +0200
split buffers to clarify what it does
Change-Id: Id7888d2e2ef1cdf21af4247207c2b0dda0aa3823
Reviewed-on: https://gerrit.libreoffice.org/57926
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 9cf26a6971cd..a738a1d5168b 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1400,20 +1400,21 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi
return mpLayouts[0]->GetTextBreak( nMaxWidth, nCharExtra, nFactor );
int nCharCount = mnEndCharPos - mnMinCharPos;
- std::unique_ptr<DeviceCoordinate[]> const pCharWidths(new DeviceCoordinate[2 * nCharCount]);
+ std::unique_ptr<DeviceCoordinate[]> const pCharWidths(new DeviceCoordinate[nCharCount]);
+ std::unique_ptr<DeviceCoordinate[]> const pFallbackCharWidths(new DeviceCoordinate[nCharCount]);
mpLayouts[0]->FillDXArray( pCharWidths.get() );
for( int n = 1; n < mnLevel; ++n )
{
SalLayout& rLayout = *mpLayouts[ n ];
- rLayout.FillDXArray( &pCharWidths[nCharCount] );
+ rLayout.FillDXArray( pFallbackCharWidths.get() );
double fUnitMul = mnUnitsPerPixel;
fUnitMul /= rLayout.GetUnitsPerPixel();
for( int i = 0; i < nCharCount; ++i )
{
if( pCharWidths[ i ] == 0 )
{
- DeviceCoordinate w = pCharWidths[ i + nCharCount ];
+ DeviceCoordinate w = pFallbackCharWidths[i];
w = static_cast<DeviceCoordinate>(w * fUnitMul + 0.5);
pCharWidths[ i ] = w;
}
commit ad3595cac951d069a2b0883a18711edab138c1ab
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 24 14:47:14 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 24 17:58:53 2018 +0200
forcepoint#53 restrict to expected index range
Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
Reviewed-on: https://gerrit.libreoffice.org/57920
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index eb3260bdbdc9..647788129d32 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -574,13 +574,18 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs)
bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
{
- int nCharCount = mnEndCharPos - mnMinCharPos;
+ const int nCharCount = mnEndCharPos - mnMinCharPos;
for (int i = 0; i < nCharCount; ++i)
pCharWidths[i] = 0;
for (auto const& aGlyphItem : m_GlyphItems)
- pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += aGlyphItem.mnNewWidth;
+ {
+ const int nIndex = aGlyphItem.mnCharPos - mnMinCharPos;
+ if (nIndex >= nCharCount)
+ continue;
+ pCharWidths[nIndex] += aGlyphItem.mnNewWidth;
+ }
return true;
}
More information about the Libreoffice-commits
mailing list