diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-28 09:27:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-29 12:38:51 +0200 |
commit | 894b4911ffb96ff667fdeb3aec7922316ab7230a (patch) | |
tree | 3942ed8088c058b70bb79984b186c5156284abf4 /sw | |
parent | 5b0ae3b59cd2cccfb72d991657366eb2a69bff49 (diff) |
pass DX array around using o3tl::span instead of pointer
so we get bounds checking in debug mode
Note that I cannot just pass around the std::vectors
involved because there is a place in editeng which
calls with a subset of a vector.
Change-Id: I5088a139593c27bf9cbe5d843ab4b0048ac6d508
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124330
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index bfca43e92147..9db05f74ff0b 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -211,7 +211,7 @@ static SalLayoutGlyphs* lcl_CreateLayout(const SwTextGlyphsKey& rKey, SwTextGlyp // Calculate glyph items. std::unique_ptr<SalLayout> pLayout = rKey.m_pOutputDevice->ImplLayout(rKey.m_aText, rKey.m_nIndex, rKey.m_nLength, Point(0, 0), 0, - nullptr, eGlyphItemsOnlyLayout); + {}, eGlyphItemsOnlyLayout); if (!pLayout) return nullptr; @@ -1114,7 +1114,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos ); rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); return; } @@ -1200,20 +1200,20 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { aKernArray[0] = rInf.GetWidth() + nSpaceAdd; rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), 1); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), 1); } else { aKernArray[sal_Int32(rInf.GetLen()) - 2] += nSpaceAdd; rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); } } else { rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); } } @@ -1230,7 +1230,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) } rInf.GetOut().DrawTextArray(aTextOriginPos, - rInf.GetText(), aKernArray.data(), + rInf.GetText(), { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); } @@ -1247,7 +1247,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) aKernArray[i] += nGridAddSum; } rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); } return; } @@ -1401,18 +1401,18 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) aKernArray[0] = rInf.GetWidth() + nSpaceAdd; rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), 1 ); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), 1 ); } else { aKernArray[ sal_Int32(rInf.GetLen()) - 2 ] += nSpaceAdd; rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); } } else rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); } else { @@ -1651,9 +1651,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos ); rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - aKernArray.data(), sal_Int32(rInf.GetIdx()), 1 ); + { aKernArray.data(), aKernArray.size() }, sal_Int32(rInf.GetIdx()), 1 ); if( bBullet ) - rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, aKernArray.data(), + rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, { aKernArray.data(), aKernArray.size() }, rInf.GetIdx() ? 1 : 0, 1 ); } else @@ -1842,7 +1842,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) : sal_Int32(rInf.GetIdx()); aGlyphsKey = SwTextGlyphsKey{ &rInf.GetOut(), *pStr, nTmpIdx, nLen }; pGlyphs = GetCachedSalLayoutGlyphs(aGlyphsKey); - rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, aKernArray.data(), + rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, { aKernArray.data(), aKernArray.size() }, nTmpIdx , nLen, SalLayoutFlags::NONE, pGlyphs ); if (bBullet) { @@ -1880,7 +1880,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) aKernArray [ i - 1 ] -= nAdd; } } - rInf.GetOut().DrawTextArray( aTextOriginPos, aBulletOverlay, aKernArray.data(), + rInf.GetOut().DrawTextArray( aTextOriginPos, aBulletOverlay, { aKernArray.data(), aKernArray.size() }, nTmpIdx , nLen ); pTmpFont->SetColor( aPreviousColor ); |