summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-10-05 06:19:56 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-10-05 16:02:52 +0200
commit1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch)
treeb59f213e245e151ee792ca424fd06b5a11c88857 /canvas
parent81d404803f477eb71b74eb9c7a67bba6b1af95d1 (diff)
Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b) it was expected to gradually remove SAL_U/W usage in Windows code by replacing with reinterpret_cast or changing to some bettertypes. But as it's useful to make use of fact that LibreOffice and Windows use compatible representation of strings, this commit puts these functions to a better-suited o3tl, and recommends that the functions be consistently used throughout Windows-specific code to reflect the compatibility and keep the casts safe. Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6 Reviewed-on: https://gerrit.libreoffice.org/43150 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/directx/dx_canvasfont.cxx8
-rw-r--r--canvas/source/directx/dx_canvashelper.cxx3
2 files changed, 4 insertions, 7 deletions
diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx
index 0fa32688ea6f..5bf74ccc0d2e 100644
--- a/canvas/source/directx/dx_canvasfont.cxx
+++ b/canvas/source/directx/dx_canvasfont.cxx
@@ -18,6 +18,7 @@
*/
#include <sal/config.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <com/sun/star/rendering/PanoseWeight.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
@@ -56,12 +57,7 @@ namespace dxcanvas
maFontRequest( rFontRequest ),
maFontMatrix( fontMatrix )
{
- const sal_Int32 nLen(rFontRequest.FontDescription.FamilyName.getLength());
- const sal_Unicode* pStr(rFontRequest.FontDescription.FamilyName.getStr());
- std::vector< sal_Unicode > pStrBuf(nLen+1,0);
- std::copy(pStr,pStr+nLen,&pStrBuf[0]);
-
- mpFontFamily.reset( new Gdiplus::FontFamily(SAL_W(&pStrBuf[0]),nullptr) );
+ mpFontFamily.reset( new Gdiplus::FontFamily(o3tl::toW(rFontRequest.FontDescription.FamilyName.getStr()),nullptr) );
if( !mpFontFamily->IsAvailable() )
mpFontFamily.reset( new Gdiplus::FontFamily(L"Arial",nullptr) );
diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx
index 87b9066fc08f..86222437d090 100644
--- a/canvas/source/directx/dx_canvashelper.cxx
+++ b/canvas/source/directx/dx_canvashelper.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/rendering/RepaintResult.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <comphelper/sequence.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <rtl/math.hxx>
#include <tools/diagnose_ex.h>
@@ -521,7 +522,7 @@ namespace dxcanvas
// TODO(F2): Proper layout (BiDi, CTL)! IMHO must use
// DrawDriverString here, and perform layouting myself...
ENSURE_OR_THROW(
- Gdiplus::Ok == pGraphics->DrawString( SAL_W(text.Text.copy( text.StartPosition,
+ Gdiplus::Ok == pGraphics->DrawString( o3tl::toW(text.Text.copy( text.StartPosition,
text.Length ).getStr()),
text.Length,
pFont->getFont().get(),