summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-15 13:48:45 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2016-11-15 15:37:11 +0000
commitd436065bc1c68fc2d90e73253d8c00503c72dfd0 (patch)
tree6ceb936a304988496e26a30516ff0739122ea982 /vcl
parent7e2ef433d29fca84ed27a9203b5761dc8dbd8bf8 (diff)
tdf#103725: Default to GDI even with the new layout engine
It seems that our DirectWrite integration is missing few key features, so back to GDI so at least people who need these feature can have away to make them work. So the situation is now with the new layout engine is like the old one; GDI when OpenGL is not use and DirectWrite when OpenGL is used. Fixing DirectWrite is now someone else’s problem. Should also fix tdf#100986. Change-Id: I102cac8a324f77b050d5183911b5cfda0b6b8f2b Reviewed-on: https://gerrit.libreoffice.org/30868 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/win/salgdi.h2
-rwxr-xr-xvcl/inc/win/winlayout.hxx2
-rw-r--r--vcl/win/gdi/salfont.cxx2
-rw-r--r--vcl/win/gdi/winlayout.cxx40
4 files changed, 32 insertions, 14 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 8f75c1b04a40..305005540841 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -357,7 +357,7 @@ private:
// get kernign pairs of the current font
sal_uLong GetKernPairs();
- static void DrawTextLayout(const CommonSalLayout&, HDC);
+ static void DrawTextLayout(const CommonSalLayout&, HDC, bool bUseDWrite);
public:
// public SalGraphics methods, the interface to the independent vcl part
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 64e78d4affc7..0e30e071050b 100755
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -421,7 +421,7 @@ protected:
TextOutRenderer & operator = (const TextOutRenderer &) = delete;
public:
- static TextOutRenderer & get();
+ static TextOutRenderer & get(bool bUseDWrite);
virtual ~TextOutRenderer() = default;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index f290bdd6c878..d2e11f8cfb2d 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1072,7 +1072,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
rLogFont.lfQuality = NONANTIALIASED_QUALITY;
// select vertical mode if requested and available
- if (!SalLayout::UseCommonLayout() && pFont->mbVertical && nNameLen )
+ if ( pFont->mbVertical && nNameLen )
{
// vertical fonts start with an '@'
memmove( &rLogFont.lfFaceName[1], &rLogFont.lfFaceName[0],
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 335bb8c9530e..f4ead1d845de 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -93,7 +93,7 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex,
}
// For now we assume DWrite is present and we won't bother with fallback paths.
- D2DWriteTextOutRenderer * pTxt = dynamic_cast<D2DWriteTextOutRenderer *>(&TextOutRenderer::get());
+ D2DWriteTextOutRenderer * pTxt = dynamic_cast<D2DWriteTextOutRenderer *>(&TextOutRenderer::get(true));
if (!pTxt)
return false;
@@ -3366,13 +3366,22 @@ void D2DWriteTextOutRenderer::CleanupModules()
DWriteCreateFactory = nullptr;
}
-TextOutRenderer & TextOutRenderer::get()
+TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
{
- static std::unique_ptr<TextOutRenderer> _impl(D2DWriteTextOutRenderer::InitModules()
- ? static_cast<TextOutRenderer*>(new D2DWriteTextOutRenderer())
- : static_cast<TextOutRenderer*>(new ExTextOutRenderer()));
+ if (bUseDWrite)
+ {
+ static std::unique_ptr<TextOutRenderer> _impl(D2DWriteTextOutRenderer::InitModules()
+ ? static_cast<TextOutRenderer*>(new D2DWriteTextOutRenderer())
+ : static_cast<TextOutRenderer*>(new ExTextOutRenderer()));
+
+ return *_impl;
+ }
+ else
+ {
+ static std::unique_ptr<TextOutRenderer> _impl(new ExTextOutRenderer());
- return *_impl;
+ return *_impl;
+ }
}
@@ -3390,6 +3399,15 @@ bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC,
if (nGlyphs < 1)
break;
+ if (SalLayout::UseCommonLayout())
+ {
+ for (int i = 0; i < nGlyphs; i++)
+ {
+ if ((glyphIntStr[i] & GF_ROTMASK) == GF_ROTL)
+ glyphIntStr[i] |= GF_VERT;
+ }
+ }
+
std::copy_n(glyphIntStr, nGlyphs, glyphWStr);
ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), nGlyphs, nullptr);
} while (!pRectToErase);
@@ -3788,7 +3806,7 @@ bool GraphiteWinLayout::DrawTextImpl(HDC hDC,
maImpl.DrawBase() = WinLayout::maDrawBase;
maImpl.DrawOffset() = WinLayout::maDrawOffset;
- TextOutRenderer & render = TextOutRenderer::get();
+ TextOutRenderer & render = TextOutRenderer::get(true);
bool const ok = render(*this, hDC, pRectToErase, pPos, pGetNextGlypInfo);
if( hOrigFont )
DeleteFont(SelectFont(hDC, hOrigFont));
@@ -4035,11 +4053,11 @@ LogicalFontInstance* WinFontFace::CreateFontInstance( FontSelectPattern& rFSD )
return pFontInstance;
}
-void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC)
+void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, bool bUseDWrite)
{
Point aPos(0, 0);
int nGlyphCount(0);
- TextOutRenderer &render = TextOutRenderer::get();
+ TextOutRenderer &render = TextOutRenderer::get(bUseDWrite);
bool result = render(rLayout, hDC, nullptr, &aPos, &nGlyphCount);
assert(!result);
}
@@ -4051,7 +4069,7 @@ void WinSalGraphics::DrawSalLayout(const CommonSalLayout& rLayout)
if (!bUseOpenGL)
{
// no OpenGL, just classic rendering
- DrawTextLayout(rLayout, hDC);
+ DrawTextLayout(rLayout, hDC, false);
}
else
{
@@ -4115,7 +4133,7 @@ void WinSalGraphics::DrawSalLayout(const CommonSalLayout& rLayout)
SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color));
// the actual drawing
- DrawTextLayout(rLayout, aDC.getCompatibleHDC());
+ DrawTextLayout(rLayout, aDC.getCompatibleHDC(), true);
std::unique_ptr<OpenGLTexture> xTexture(aDC.getTexture());
if (xTexture)