[Libreoffice-commits] core.git: vcl/win

2017-09-28 Thread Stephan Bergmann
 vcl/win/app/salinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8457b50ffd6e41b4925aef17bed2b5a2f3bf56bd
Author: Stephan Bergmann 
Date:   Thu Sep 28 18:10:26 2017 +0200

loplugin:simplifybool (clang-cl)

Change-Id: I230c37482cfce85534f860ecf3426254be8981ab

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 487cf7fb09d2..bc0c908d9af2 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -205,7 +205,7 @@ void ImplSalYieldMutexAcquireWithWait( sal_uInt32 nCount )
 bool ImplSalYieldMutexTryToAcquire()
 {
 WinSalInstance* pInst = GetSalData()->mpInstance;
-return pInst ? pInst->mpSalYieldMutex->tryToAcquire() : false;
+return pInst && pInst->mpSalYieldMutex->tryToAcquire();
 }
 
 void ImplSalYieldMutexRelease()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-09-25 Thread Stephan Bergmann
 vcl/win/app/saltimer.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 3f95a79da8688e2bd0a8631e030c2385abbfc65c
Author: Stephan Bergmann 
Date:   Mon Sep 25 15:24:12 2017 +0200

-Werror,-Wint-to-void-pointer-cast, loplugin:cstylecast (clang-cl)

Change-Id: Ib06849499e46eb76f8049fea304f80c771e94098

diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index eb6993c8659d..1e11a9c4dba5 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -76,7 +76,8 @@ void WinSalTimer::ImplStart( sal_uLong nMS )
 // to be 0 and should not hurt; also see
 // https://www.microsoft.com/msj/0499/pooling/pooling.aspx
 CreateTimerQueueTimer(_nTimerId, nullptr, SalTimerProc,
-  (void*) m_nTimerStartTicks,
+  reinterpret_cast(
+  sal_uIntPtr(m_nTimerStartTicks)),
   nMS, 0, WT_EXECUTEINTIMERTHREAD | 
WT_EXECUTEONLYONCE);
 }
 
@@ -131,7 +132,8 @@ static void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
 // that happened during execution of the callback later directly from
 // the message queue
 BOOL const ret = PostMessageW(GetSalData()->mpFirstInstance->mhComWnd,
-  SAL_MSG_TIMER_CALLBACK, (WPARAM) data, 
0);
+  SAL_MSG_TIMER_CALLBACK,
+  reinterpret_cast(data), 0);
 #if OSL_DEBUG_LEVEL > 0
 if (0 == ret) // SEH prevents using SAL_WARN here?
 fputs("ERROR: PostMessage() failed!\n", stderr);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-09-25 Thread Stephan Bergmann
 vcl/win/app/salinst.cxx  |1 +
 vcl/win/app/saltimer.cxx |4 
 2 files changed, 5 insertions(+)

New commits:
commit fa12f373d89d6d88e99b44298c6798f6ef346735
Author: Stephan Bergmann 
Date:   Mon Sep 25 15:22:57 2017 +0200

Missing #include  (--disable-pch)

Change-Id: I30d8998b5f9ff29b8a3e8012f6112de597933d10

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 00ac504948f1..92ed7faa14fd 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 3b95b7fc60f0..eb6993c8659d 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+#include 
+
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-09-19 Thread Stephan Bergmann
 vcl/win/app/salinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit adbf7da7d1d9a1701c3fccbfbbf9d749d6478e6c
Author: Stephan Bergmann 
Date:   Tue Sep 19 11:08:38 2017 +0200

Inconsistent declarations of ImplSalYieldMutexAcquireWithWait

...introduced with 3840aede596e6fc24f7ed7df9100fb028134aac6 "Unify 
SolarMutex
implementations" (causing link failure and clang-cl loplugin:unreffun with
64 bit Windows builds)

Change-Id: I273d15e74ad88648ebbccb33f1348497779cc488

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 2f4e0b669689..539a7d2c3eef 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -175,7 +175,7 @@ sal_uInt32 SalYieldMutex::doRelease( const bool bUnlockAll )
 return nCount;
 }
 
-void ImplSalYieldMutexAcquireWithWait( sal_uLong nCount )
+void ImplSalYieldMutexAcquireWithWait( sal_uInt32 nCount )
 {
 WinSalInstance* pInst = GetSalData()->mpFirstInstance;
 if ( pInst )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-09-12 Thread Tor Lillqvist
 vcl/win/app/salinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit caf9e56a81d28bdb8d447bc9d3538bbd9969ff73
Author: Tor Lillqvist 
Date:   Tue Aug 29 10:24:16 2017 +0300

Change assertion failure to SAL_WARN

I hit it multiple times and have no interest in figuring out
why. Or time.

Change-Id: I3f22c8b62fdcf987b760ac16bfe8a21a8870d33e
Reviewed-on: https://gerrit.libreoffice.org/42212
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 09532902af00..97a5b6c55ad4 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -722,7 +722,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM 
wParam, LPARAM lParam, i
 // PM_QS_POSTMESSAGE is needed, so we don't process the 
SendMessage from DoYield!
 while ( PeekMessageW(, nullptr, SAL_MSG_TIMER_CALLBACK,
  SAL_MSG_TIMER_CALLBACK, PM_REMOVE | 
PM_NOYIELD | PM_QS_POSTMESSAGE) )
-assert(! "Multiple timer messages in queue" );
+SAL_WARN("vcl", "Multiple timer messages in queue");
 GetSalData()->mbOnIdleRunScheduler = false;
 EmitTimerCallback();
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-09-05 Thread Caolán McNamara
 vcl/win/gdi/salfont.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f263692de96ac68e73eeb953b7e92a18d149f30e
Author: Caolán McNamara 
Date:   Tue Sep 5 13:06:20 2017 +0100

Resolves: tdf#112180: avoid crash with specific ttf

Change-Id: I8cde147279173bffec0c991eb7676f5d4641138d
Reviewed-on: https://gerrit.libreoffice.org/41935
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index dc6d2c51692b..f463ecb20417 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -87,9 +87,9 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
 {
 // get required size in bytes
 mnByteCount = ::GetFontData( hDC, nTableTag, 0, nullptr, 0 );
-if( mnByteCount == GDI_ERROR )
-return;
-else if( !mnByteCount )
+if (mnByteCount == GDI_ERROR)
+mnByteCount = 0;
+if (!mnByteCount)
 return;
 
 // allocate the array
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-09-03 Thread Julien Nabet
 vcl/win/gdi/salfont.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c3b7c4d3ec6edb5db774d535b77239175f96
Author: Julien Nabet 
Date:   Sun Sep 3 14:31:11 2017 +0200

tdf#112180: avoid crash with specific ttf

by synchronizing announced size of data (mnByteCount)
with the real size of data (mpRawBytes)

Change-Id: I973bec9deb1150b630d1df32c89b33c253e4b3d2
Reviewed-on: https://gerrit.libreoffice.org/41860
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 360de5368aaa..dc6d2c51692b 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -126,6 +126,9 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
 if( nRawDataOfs != mnByteCount )
 {
 mpRawBytes.reset();
+// mnByteCount must correspond to mpRawBytes length
+SAL_WARN( "vcl", "Raw data of font is incomplete: " << nRawDataOfs << 
" byte(s) found whereas " << mnByteCount << " byte(s) expected!" );
+mnByteCount = 0;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-07-25 Thread Jan-Marek Glogowski
 vcl/win/app/salinst.cxx  |5 -
 vcl/win/app/saltimer.cxx |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 20ddcfb92afeec2da22cb8fd0feeb89014c2fc89
Author: Jan-Marek Glogowski 
Date:   Tue Jul 25 11:32:21 2017 +0200

WIN don't process the SendMessage from DoYield

Actually we just want to remove the SAL_MSG_TIMER_CALLBACK
messages, but this seems to be impossible using PeekMessage,
without the side effect of processing some messages:
"During this call, the system delivers pending, nonqueued
messages... Then the first queued message that matches the
specified filter is retrieved.".

But it is actually enought to ignore the SAL_MSG_THREADYIELD
message send using SendMessage from DoYield, which can be
filtered by using PM_QS_POSTMESSAGE.

Probably this should be resolved not using PeekMessage at all
by using a variable to hold the time of the last posted
SAL_MSG_TIMER_CALLBACK message, so we just run the callback
once, if our time is <= MSG time and ignore the multiple
queued messages. Same for mbOnIdleRunScheduler handling.

Change-Id: Ifacb20aa38e6b5aca908e5411cf2e100f702ad1f

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index cfffb97d0234..6458fca73c43 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -644,6 +644,8 @@ bool WinSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents, sal_uLong
 if( ImplGetSVData()->maAppData.mnModalMode )
 Sleep(1);
 else
+// If you change the SendMessageW function, you might need to 
update
+// the PeekMessage( ... PM_QS_POSTMESSAGE) calls!
 bDidWork = SendMessageW( mhComWnd, SAL_MSG_THREADYIELD, 
(WPARAM)bWait, (LPARAM)bHandleAllCurrentEvents );
 
 ImplSalAcquireYieldMutex( nCount );
@@ -729,8 +731,9 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM 
wParam, LPARAM lParam, i
 break;
 case SAL_MSG_TIMER_CALLBACK:
 MSG aMsg;
+// PM_QS_POSTMESSAGE is needed, so we don't process the 
SendMessage from DoYield!
 while ( PeekMessageW(, nullptr, SAL_MSG_TIMER_CALLBACK,
- SAL_MSG_TIMER_CALLBACK, PM_REMOVE | 
PM_NOYIELD) )
+ SAL_MSG_TIMER_CALLBACK, PM_REMOVE | 
PM_NOYIELD | PM_QS_POSTMESSAGE) )
 assert( "Multiple timer messages in queue" );
 assert( 0 == wParam );
 if ( 0 == wParam )
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 4ca5ebb572d2..847ff52851b8 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -46,10 +46,11 @@ void ImplSalStopTimer()
 // remove all pending SAL_MSG_TIMER_CALLBACK messages
 // we always have to do this, since ImplSalStartTimer with 0ms just queues
 // a new SAL_MSG_TIMER_CALLBACK message
+// PM_QS_POSTMESSAGE is needed, so we don't process the SendMessage from 
DoYield!
 MSG aMsg;
 int nMsgCount = 0;
 while ( PeekMessageW(, nullptr, SAL_MSG_TIMER_CALLBACK,
- SAL_MSG_TIMER_CALLBACK, PM_REMOVE | PM_NOYIELD) )
+ SAL_MSG_TIMER_CALLBACK, PM_REMOVE | PM_NOYIELD | 
PM_QS_POSTMESSAGE) )
 nMsgCount++;
 assert( nMsgCount <= 1 );
 pSalData->mbOnIdleRunScheduler = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-07-25 Thread Tomaž Vajngerl
 vcl/win/gdi/DWriteTextRenderer.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit ead33392ddabe9655bc1edc050955429dff450f7
Author: Tomaž Vajngerl 
Date:   Tue Jul 25 12:26:03 2017 +0200

tdf#109281 add fallback to GDI back when we can't bind a DC

Change-Id: Ibaa0a86562cdeaff989c2a548efa03ea24933213
Reviewed-on: https://gerrit.libreoffice.org/40398
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 11469aadb597..1bd413375f5f 100755
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -259,6 +259,11 @@ bool 
D2DWriteTextOutRenderer::performRender(CommonSalLayout const & rLayout, Sal
 bRetry = true;
 return false;
 }
+if (FAILED(hr))
+{
+// If for any reason we can't bind fallback to legacy APIs.
+return ExTextOutRenderer()(rLayout, rGraphics, hDC);
+}
 
 mlfEmHeight = 0;
 if (!GetDWriteFaceFromHDC(hDC, , ))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-07-17 Thread Tomaž Vajngerl
 vcl/win/gdi/DWriteTextRenderer.cxx |   11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit cf0a9b9c7a988b74102bcdd38710fb9e80521081
Author: Tomaž Vajngerl 
Date:   Sun Jul 16 22:46:45 2017 +0200

DWrite: resolve unreachable code warning

Change-Id: I5b9ffefcf8022366236328f0ca89982172b76feb
Reviewed-on: https://gerrit.libreoffice.org/40021
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 487a9ef76ff9..f876f368e882 100755
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -344,16 +344,7 @@ std::vector 
D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t
 
 bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** 
ppFontFace, float * lfSize) const
 {
-bool succeeded = false;
-try
-{
-succeeded = SUCCEEDED(CHECKHR(mpGdiInterop->CreateFontFaceFromHdc(hDC, 
ppFontFace)));
-}
-catch (const std::exception& e)
-{
-SAL_WARN("vcl.gdi", "Error in dwrite while creating font face: " << 
e.what());
-return false;
-}
+bool succeeded = 
SUCCEEDED(CHECKHR(mpGdiInterop->CreateFontFaceFromHdc(hDC, ppFontFace)));
 
 if (succeeded)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-07-17 Thread Tomaž Vajngerl
 vcl/win/gdi/DWriteTextRenderer.cxx |   32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

New commits:
commit cbda019e4ee0b1f4ca3fac8fbbe916a75af0956d
Author: Tomaž Vajngerl 
Date:   Sun Jul 16 22:44:14 2017 +0200

DWrite: HRESULT checks for debug mode

Change-Id: I4913b6e3d3c1766151571c467416e62409c8e260
Reviewed-on: https://gerrit.libreoffice.org/40020
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 8ccb1f451cda..487a9ef76ff9 100755
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -107,6 +107,25 @@ IDWriteRenderingParams* 
lclSetRenderingMode(IDWriteFactory* pDWriteFactory, DWRI
 return pParameters;
 }
 
+#ifdef SAL_LOG_WARN
+HRESULT checkResult(HRESULT hr, const char* file, size_t line)
+{
+if (FAILED(hr))
+{
+OUString sLocationString = OUString::createFromAscii(file) + ":" + 
OUString::number(line) + " ";
+SAL_DETAIL_LOG_STREAM(SAL_DETAIL_ENABLE_LOG_WARN, 
::SAL_DETAIL_LOG_LEVEL_WARN,
+  "vcl.gdi", sLocationString.toUtf8().getStr(),
+  "HRESULT failed with: " << (int(hr)));
+}
+return hr;
+}
+
+#define CHECKHR(funct) checkResult(funct, __FILE__, __LINE__)
+#else
+#define CHECKHR(funct) (funct)
+#endif
+
+
 } // end anonymous namespace
 
 D2DWriteTextOutRenderer::D2DWriteTextOutRenderer()
@@ -176,7 +195,7 @@ HRESULT D2DWriteTextOutRenderer::CreateRenderTarget()
 mpRT->Release();
 mpRT = nullptr;
 }
-return mpD2DFactory->CreateDCRenderTarget(, );
+return CHECKHR(mpD2DFactory->CreateDCRenderTarget(, ));
 }
 
 bool D2DWriteTextOutRenderer::Ready() const
@@ -189,7 +208,7 @@ bool D2DWriteTextOutRenderer::BindDC(HDC hDC, 
tools::Rectangle const & rRect)
 if (rRect.GetWidth() == 0 || rRect.GetHeight() == 0)
 return false;
 RECT const rc = { rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() 
};
-return SUCCEEDED(mpRT->BindDC(hDC, ));
+return SUCCEEDED(CHECKHR(mpRT->BindDC(hDC, )));
 }
 
 bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const ,
@@ -211,7 +230,8 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const ,
 
 ID2D1SolidColorBrush* pBrush = nullptr;
 COLORREF bgrTextColor = GetTextColor(mhDC);
-succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 
255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), 
));
+D2D1::ColorF aD2DColor(GetRValue(bgrTextColor) / 255.0f, 
GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f);
+succeeded &= SUCCEEDED(CHECKHR(mpRT->CreateSolidColorBrush(aD2DColor, 
)));
 
 HRESULT hr = S_OK;
 if (succeeded)
@@ -242,7 +262,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const ,
 mpRT->DrawGlyphRun(baseline, , pBrush);
 }
 
-hr = mpRT->EndDraw();
+hr = CHECKHR(mpRT->EndDraw());
 }
 
 if (pBrush)
@@ -298,7 +318,7 @@ std::vector 
D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t
 mpFontFace->GetMetrics();
 
 std::vector metrics(nGlyphs);
-if (!SUCCEEDED(mpFontFace->GetDesignGlyphMetrics(pGid, nGlyphs, 
metrics.data(
+if (!SUCCEEDED(CHECKHR(mpFontFace->GetDesignGlyphMetrics(pGid, nGlyphs, 
metrics.data()
 return std::vector();
 
 std::vector aOut(nGlyphs);
@@ -327,7 +347,7 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, 
IDWriteFontFace ** p
 bool succeeded = false;
 try
 {
-succeeded = SUCCEEDED(mpGdiInterop->CreateFontFaceFromHdc(hDC, 
ppFontFace));
+succeeded = SUCCEEDED(CHECKHR(mpGdiInterop->CreateFontFaceFromHdc(hDC, 
ppFontFace)));
 }
 catch (const std::exception& e)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-07-15 Thread Mike Kaganski
 vcl/win/app/salinst.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f054b9187155bc32b7d06808aea87127cb0a3a4f
Author: Mike Kaganski 
Date:   Sat Jul 15 11:37:22 2017 +0200

tdf#38915: don't wait on message queue if application already has quit.

Despite precautions in Application::Execute() and ImplYield(),
in my testing I sometimes see that soffice is waiting in
ImplSalYield()'s GetMessageW() when ImplGetSVData()->maAppData.mbAppQuit
is true, so that soffice.bin hangs in the background. I suspect
that this is related to the bug. Some obscure code path seems to
be able to get here after the flag is already set.

So, test also in ImplSalYield() right before GetMessageW() to
make sure. Another possibility is that we get here when the flag
is not set yet, and gets set while already waiting, but that would
mean this happens in a different thread.

Change-Id: Idb19eabcca8b5c24eac0ca76950edc1bf1e5bccb
Reviewed-on: https://gerrit.libreoffice.org/39996
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 1b1d0f82fee8..3a1522f7e836 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -580,7 +580,8 @@ ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
 bOneEvent = false;
 } while( --nMaxEvents && bOneEvent );
 
-if ( bWait && ! bWasMsg )
+// Also check that we don't wait when application already has quit
+if ( bWait && !bWasMsg && !ImplGetSVData()->maAppData.mbAppQuit )
 {
 if ( GetMessageW( , nullptr, 0, 0 ) )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-07-12 Thread Markus Mohrhard
 vcl/win/gdi/winlayout.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 008d7abcdd246cfc9bef6cbdbef85890ca2efd69
Author: Markus Mohrhard 
Date:   Wed Jul 12 18:20:38 2017 +0200

fix crash when aInkBoxes might be empty

e.g. 
http://crashreport.libreoffice.org/stats/signature/WinFontInstance::CacheGlyphToAtlas(bool,HDC__%20*,HFONT__%20*,int,SalGraphics%20&)

Change-Id: I0f32b549c687c2da6534f59a13ce1c5d57047829
Reviewed-on: https://gerrit.libreoffice.org/39874
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index e7257d38bacd..81acf53b7ba2 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -90,6 +90,9 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, 
int nGlyphIndex, S
 // Fetch the ink boxes and calculate the size of the atlas.
 tools::Rectangle bounds(0, 0, 0, 0);
 auto aInkBoxes = pTxt->GetGlyphInkBoxes(aGlyphIndices.data(), 
aGlyphIndices.data() + 1);
+if (aInkBoxes.empty())
+return false;
+
 for (auto  : aInkBoxes)
 bounds.Union(box + Point(bounds.Right(), 0));
 
@@ -519,7 +522,8 @@ bool D2DWriteTextOutRenderer::ReleaseFont()
 std::vector 
D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid, uint16_t * pGidEnd) 
const
 {
 ptrdiff_t nGlyphs = pGidEnd - pGid;
-if (nGlyphs < 0) return std::vector();
+if (nGlyphs < 0)
+return std::vector();
 
 DWRITE_FONT_METRICS aFontMetrics;
 mpFontFace->GetMetrics();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-05-08 Thread Noel Grandin
 vcl/win/gdi/winlayout.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 43e997d2d9f5ca98bf765e1c956bf56f66935eb5
Author: Noel Grandin 
Date:   Sun May 7 19:37:28 2017 +0200

hNonAliasedFont is unused

ever since commit e45d80f20ff6a05888f92ae942abed67609d5b20
  Author: Tim Eves 
  Date:   Tue Feb 23 16:45:21 2016 +
  "tdf#97171: Use DirectWrite for OpenGL glyph caching"

Change-Id: Ib6675e89caa68a5ee725a36a0d5ded973cc98723
Reviewed-on: https://gerrit.libreoffice.org/37348
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index feb5565be153..a510eba4d61a 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -141,8 +141,6 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 
 OpenGLCompatibleDC aDC(rGraphics, 0, 0, nBitmapWidth, nBitmapHeight);
 
-HFONT hNonAntialiasedFont = nullptr;
-
 SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0));
 SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255));
 
@@ -190,8 +188,6 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 default:
 SAL_WARN("vcl.gdi", "DrawGlyphRun-EndDraw failed: " << 
WindowsErrorString(GetLastError()));
 SelectFont(aDC.getCompatibleHDC(), hOrigFont);
-if (hNonAntialiasedFont != nullptr)
-DeleteObject(hNonAntialiasedFont);
 return false;
 }
 
@@ -205,8 +201,6 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 maGlyphCache.PutDrawElementInCache(aElement, nGlyphIndex);
 
 SelectFont(aDC.getCompatibleHDC(), hOrigFont);
-if (hNonAntialiasedFont != nullptr)
-DeleteObject(hNonAntialiasedFont);
 
 return true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-04-19 Thread Stephan Bergmann
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2f920c1da7d7021774cbc9ea8dbc4aefa2409a91
Author: Stephan Bergmann 
Date:   Wed Apr 19 17:37:54 2017 +0200

loplugin:subtlezeroinit (clang-cl)

Change-Id: I9c8e00be8823f8f2cbf1368b33e2f18b3a386a88

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 7c593371790a..c457e62a2296 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -261,7 +261,7 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
 }
 else
 {
-pSalData->m_pTextOutRenderer.reset(new ExTextOutRenderer());
+pSalData->m_pTextOutRenderer.reset(new ExTextOutRenderer);
 }
 }
 return *pSalData->m_pTextOutRenderer;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-04-06 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |   23 ---
 1 file changed, 23 deletions(-)

New commits:
commit 843c6d6eec95b99e867c28ab27860215d5d72b37
Author: Khaled Hosny 
Date:   Thu Apr 6 17:32:48 2017 +0200

tdf#106960: Fix math scaling on Windows

Remove this leftoever code from 1b7e788eb3bf9cbe56ed5cc4a3fa7fa5e70ac40a 
which
does nothing useful now.

Change-Id: Ia7fa888d5687c9da110b44139a8217558a7f641b
Reviewed-on: https://gerrit.libreoffice.org/36222
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index a66ef8fafc76..1dc45bc1e7ea 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -55,8 +55,6 @@
 
 using namespace vcl;
 
-static const int MAXFONTHEIGHT = 2048;
-
 
 inline FIXED FixedFromDouble( double d )
 {
@@ -830,7 +828,6 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
 
 HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern* i_pFont, HFONT& 
o_rOldFont)
 {
-float fFontScale;
 HFONT hNewFont = nullptr;
 
 HDC hdcScreen = nullptr;
@@ -841,26 +838,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern* 
i_pFont, HFONT& o_rOldFon
 LOGFONTW aLogFont;
 ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true );
 
-// #i47675# limit font requests to MAXFONTHEIGHT
-// TODO: share MAXFONTHEIGHT font instance
-if( (-aLogFont.lfHeight <= MAXFONTHEIGHT)
-&&  (+aLogFont.lfWidth <= MAXFONTHEIGHT) )
-{
-fFontScale = 1.0;
-}
-else if( -aLogFont.lfHeight >= +aLogFont.lfWidth )
-{
-fFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT;
-aLogFont.lfHeight = -MAXFONTHEIGHT;
-aLogFont.lfWidth = FRound( aLogFont.lfWidth / fFontScale );
-}
-else // #i95867# also limit font widths
-{
-fFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT;
-aLogFont.lfWidth = +MAXFONTHEIGHT;
-aLogFont.lfHeight = FRound( aLogFont.lfHeight / fFontScale );
-}
-
 hNewFont = ::CreateFontIndirectW(  );
 if( hdcScreen )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-03-14 Thread Stephan Bergmann
 vcl/win/app/salshl.cxx|8 ++--
 vcl/win/gdi/winlayout.cxx |4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 2789a8c202151fc8ce3cc3c220513200d67e8b07
Author: Stephan Bergmann 
Date:   Tue Mar 14 14:49:22 2017 +0100

loplugin:subtlezeroinit (clang-cl)

Change-Id: I34367cad2d07b9fc6c8f4607ee5e74625f12e78f

diff --git a/vcl/win/app/salshl.cxx b/vcl/win/app/salshl.cxx
index 3c3c710..3f8e5f5 100644
--- a/vcl/win/app/salshl.cxx
+++ b/vcl/win/app/salshl.cxx
@@ -102,12 +102,8 @@ bool ImplLoadSalIcon( int nId, HICON& rIcon, HICON& 
rSmallIcon )
 if( rIcon )
 {
 // add to icon cache
-pSalIcon = new SalIcon();
-pSalIcon->nId = nId;
-pSalIcon->hIcon = rIcon;
-pSalIcon->hSmallIcon = rSmallIcon;
-pSalIcon->pNext = pSalData->mpFirstIcon;
-pSalData->mpFirstIcon = pSalIcon;
+pSalData->mpFirstIcon = new SalIcon{
+nId, rIcon, rSmallIcon, pSalData->mpFirstIcon};
 }
 
 return (rSmallIcon != nullptr);
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index a8d71fc..b41ad59 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -249,13 +249,13 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
 {
 static std::unique_ptr 
_impl(D2DWriteTextOutRenderer::InitModules()
 ? static_cast(new D2DWriteTextOutRenderer())
-: static_cast(new ExTextOutRenderer()));
+: static_cast(new ExTextOutRenderer));
 
 return *_impl;
 }
 else
 {
-static std::unique_ptr _impl(new ExTextOutRenderer());
+static std::unique_ptr _impl(new ExTextOutRenderer);
 
 return *_impl;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-02-13 Thread Stephan Bergmann
 vcl/win/window/salframe.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 3ee77072ff774dccd38edc03e8714a39e586f94a
Author: Stephan Bergmann 
Date:   Mon Feb 13 18:11:34 2017 +0100

-Werror,-Wunused-macros (clang-cl)

...since 65b7b6322b662785bf032e66c76abc36c9a2bb0e 
"loplugin:unusedenumconstants
read-only constants in vcl"

Change-Id: I50b904dfbfecf3400591fadd392e229505c1a97f

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 88e6f81..c4b6d92 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -109,9 +109,6 @@ using namespace ::com::sun::star::beans;
 #ifndef WM_MOUSEHWHEEL
 # define WM_MOUSEHWHEEL 0x020E
 #endif
-#ifndef IDC_PEN
-# define IDC_PEN MAKEINTRESOURCE(32631)
-#endif
 
 const unsigned int WM_USER_SYSTEM_WINDOW_ACTIVATED = 
RegisterWindowMessageA("SYSTEM_WINDOW_ACTIVATED");
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-02-12 Thread Arnaud Versini
 vcl/win/gdi/salvd.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit b82a9f34eca092f13396177d61145093be84e600
Author: Arnaud Versini 
Date:   Sun Feb 12 10:39:34 2017 +0100

VCL: Simplify WinSalInstance::CreateVirtualDevice

Change-Id: I26e9823faa53fdbb0ae468f03e40b0a4e5313b49
Reviewed-on: https://gerrit.libreoffice.org/34170
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 65d8600..afd4fc7 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -90,14 +90,12 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( 
SalGraphics* pSGraphics,
 
 HDC hDC = nullptr;
 HBITMAP hBmp = nullptr;
-boolbOk = FALSE;
 
 if( pData )
 {
 hDC = (pData->hDC) ? pData->hDC : GetDC(pData->hWnd);
 hBmp = nullptr;
-bOk = (hDC != nullptr);
-if (bOk)
+if (hDC)
 {
 nDX = GetDeviceCaps( hDC, HORZRES );
 nDY = GetDeviceCaps( hDC, VERTRES );
@@ -119,11 +117,9 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( 
SalGraphics* pSGraphics,
 // #124826# continue even if hBmp could not be created
 // if we would return a failure in this case, the process
 // would terminate which is not required
-
-bOk = (hDC != nullptr);
 }
 
-if ( bOk )
+if (hDC)
 {
 WinSalVirtualDevice*pVDev = new WinSalVirtualDevice(hDC, hBmp, 
nBitCount, (pData != nullptr && pData->hDC != nullptr ), nDX, nDY);
 SalData*pSalData = GetSalData();
@@ -143,8 +139,6 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( 
SalGraphics* pSGraphics,
 }
 else
 {
-if ( hDC && !pData )
-DeleteDC( hDC );
 if ( hBmp )
 DeleteBitmap( hBmp );
 return nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-02-08 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 026345eeb2aa9fca02bc055f28ebd34abd7ad680
Author: Khaled Hosny 
Date:   Thu Feb 9 00:18:10 2017 +0200

Don’t look for bundled fonts relative to executable path on Windows

Just do like other platforms, so that the fonts are avialble to unit tests
since cppunittester is not run from instdir.

Change-Id: Ib209473f5b6b07a154fecb430dca45b32e8fa556
Reviewed-on: https://gerrit.libreoffice.org/34048
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 0461f31..b6b4915 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1302,14 +1302,11 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 // since we are only interested in fonts that could not be
 // registered before because of missing administration rights
 // only the font path of the user installation is needed
-OUString aPath;
-osl_getExecutableFile(  );
-aPath = aPath.copy( 0, aPath.lastIndexOf('/') );
-OUString aFontDirUrl = aPath.copy( 0, aPath.lastIndexOf('/') );
-aFontDirUrl += "/" LIBO_SHARE_FOLDER "/fonts/truetype";
+OUString aPath("$BRAND_BASE_DIR");
+rtl_bootstrap_expandMacros();
 
 // collect fonts in font path that could not be registered
-osl::Directory aFontDir( aFontDirUrl );
+osl::Directory aFontDir(aPath + "/" LIBO_SHARE_FOLDER 
"/fonts/truetype");
 osl::FileBase::RC rcOSL = aFontDir.open();
 if( rcOSL == osl::FileBase::E_None )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-02-07 Thread Mark Hung
 vcl/win/gdi/winlayout.cxx |   28 ++--
 1 file changed, 26 insertions(+), 2 deletions(-)

New commits:
commit aa9251103a131880afa621501936603d8c75af9d
Author: Mark Hung 
Date:   Sat Jan 14 19:00:31 2017 +0800

tdf#105286 use alternative font when glyph is not vertical.

In vertical layout, a vertical font is selected. For windows,
that means prepending a '@' to the font name. Switch back to
the one without '@' in order to display characters that needs
to be rotated 90 degrees in vertical layout correctly.

Change-Id: I4e0361929f898eddc671b739b36a12dd26d68018
Reviewed-on: https://gerrit.libreoffice.org/33064
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 6436c61..54c00af 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -291,14 +291,38 @@ bool ExTextOutRenderer::operator ()(SalLayout const 
, HDC hDC,
 {
 bool bGlyphs = false;
 const GlyphItem* pGlyph;
+HFONT hFont = static_cast(GetCurrentObject( hDC, OBJ_FONT ));
+HFONT hAltFont = nullptr;
+bool bUseAltFont = false;
+const CommonSalLayout* pCSL = dynamic_cast();
+if (pCSL && pCSL->getFontSelData().mbVertical)
+{
+LOGFONTW aLogFont;
+GetObjectW(hFont, sizeof(LOGFONTW), );
+if (aLogFont.lfFaceName[0] == '@')
+{
+memmove([0], [1],
+sizeof(aLogFont.lfFaceName)-sizeof(aLogFont.lfFaceName[0]));
+hAltFont = CreateFontIndirectW();
+}
+}
 while (rLayout.GetNextGlyphs(1, , *pPos, *pGetNextGlypInfo))
 {
 bGlyphs = true;
 WORD glyphWStr[] = { pGlyph->maGlyphId };
-if (pGlyph->IsVertical())
-glyphWStr[0] |= 0x0200; // A (undocumented?) GDI flag for 
vertical glyphs
+if (hAltFont && pGlyph->IsVertical() == bUseAltFont)
+{
+bUseAltFont = !bUseAltFont;
+SelectFont(hDC, bUseAltFont ? hAltFont : hFont);
+}
 ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(), 1, nullptr);
 }
+if (hAltFont)
+{
+if (bUseAltFont)
+SelectFont(hDC, hFont);
+DeleteObject(hAltFont);
+}
 
 return (pRectToErase && bGlyphs);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-01-24 Thread Stephan Bergmann
 vcl/win/gdi/salfont.cxx |   18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

New commits:
commit d63b767c699e1658516c2a4514e4f0461ae29dd2
Author: Stephan Bergmann 
Date:   Tue Jan 24 10:38:23 2017 +0100

loplugin:useuniqueptr

Change-Id: I502ebf4024cd9b0ee61d58d6b6a8e342c7ceac08

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 5c4d834..d1aebb3 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -74,19 +75,17 @@ class RawFontData
 {
 public:
 explicitRawFontData( HDC, DWORD nTableTag=0 );
-~RawFontData() { delete[] mpRawBytes; }
-const unsigned char*get() const { return mpRawBytes; }
-const unsigned char*steal() { unsigned char* p = mpRawBytes; 
mpRawBytes = nullptr; return p; }
+const unsigned char*get() const { return mpRawBytes.get(); }
+const unsigned char*steal() { return mpRawBytes.release(); }
 int   size() const { return mnByteCount; }
 
 private:
-unsigned char*  mpRawBytes;
+std::unique_ptr mpRawBytes;
 unsignedmnByteCount;
 };
 
 RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
-:   mpRawBytes( nullptr )
-,   mnByteCount( 0 )
+:   mnByteCount( 0 )
 {
 // get required size in bytes
 mnByteCount = ::GetFontData( hDC, nTableTag, 0, nullptr, 0 );
@@ -96,7 +95,7 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
 return;
 
 // allocate the array
-mpRawBytes = new unsigned char[ mnByteCount ];
+mpRawBytes.reset(new unsigned char[ mnByteCount ]);
 
 // get raw data in chunks small enough for GetFontData()
 unsigned nRawDataOfs = 0;
@@ -111,7 +110,7 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
 if( nFDGet > nMaxChunkSize )
 nFDGet = nMaxChunkSize;
 const DWORD nFDGot = ::GetFontData( hDC, nTableTag, nRawDataOfs,
-mpRawBytes + nRawDataOfs, nFDGet );
+mpRawBytes.get() + nRawDataOfs, nFDGet );
 if( !nFDGot )
 break;
 else if( nFDGot != GDI_ERROR )
@@ -128,8 +127,7 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
 // cleanup if the raw data is incomplete
 if( nRawDataOfs != mnByteCount )
 {
-delete[] mpRawBytes;
-mpRawBytes = nullptr;
+mpRawBytes.reset();
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-01-15 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit db146ea596c8056ef7a75d7d6c58d9293161d5da
Author: Khaled Hosny 
Date:   Thu Jan 12 22:52:08 2017 +0200

tdf#105015: Don’t ignore all printer fonts

For whatever reason we query printer output device for fonts and for
whatever reason GDI will only report fonts from the printer which
often in formats we want to ignore. This results in aborting the
application when we reject all fonts on the printer!

Just special case printer output devices and hope for the best.

I think this commit is partially blamed as it is evidenced now that
there was a good reason to only abort for window output devices, but
I’m leaving this as it is for now:

commit ea7102c93c33884a68d4dba0de7d52f8ed4f4579
Author: Chris Sherlock 
Date:   Tue Mar 25 21:54:20 2014 +1100

fdo#74702 OutputDevice::ImplInitFontList() fails if no fonts on device

It makes no sense that ImplInitFontList() only fails for Window
instances. I have carefully checked all the functions that use
this function, and there are no good cases when no fonts won't cause
problems. In fact, we have a number of functions that specifically
rely on the fact that ImplInitFontList will populate
OutputDevice::mpFontCollection with at least one font.

Therefore, I'm making this abort if it can't populate the collection,
regardless of whether it is a Window, Printer or VirtualDevice.

I have also refactored GetDefaultDevice - I now check the default
pOutDev parameter to see if it is NULL (the default), in which case
it is referring to the default window, so I call on
Application::GetDefaultDevice() instead of going straight to the
pimpl data structure used by the Application class.

Reviewed-on: https://gerrit.libreoffice.org/33014
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 88d6675a40034fa786efd75cf14175f3c0c83e2e)

Change-Id: I3f34ba0cea9f88966ace3a5ef7fac868972ea5ac
Reviewed-on: https://gerrit.libreoffice.org/33087
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index d1332ae8..5c4d834 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -336,6 +336,7 @@ struct ImplEnumInfo
 PhysicalFontCollection* mpList;
 OUString*   mpName;
 LOGFONTW*   mpLogFont;
+boolmbPrinter;
 int mnFontCount;
 };
 
@@ -1057,10 +1058,19 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* 
lpelfe,
 }
 else
 {
+// Ignore non-device fonts on printers.
+if (pInfo->mbPrinter)
+{
+if ((nFontType & RASTER_FONTTYPE) && !(nFontType & 
DEVICE_FONTTYPE))
+{
+SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << 
OUString(pLogFont->elfLogFont.lfFaceName));
+return 1;
+}
+}
 // Only SFNT fonts are supported, ignore anything else.
-if (!(nFontType & TRUETYPE_FONTTYPE) &&
-!(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
-!(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
+else if (!(nFontType & TRUETYPE_FONTTYPE) &&
+ !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
+ !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
 {
 SAL_INFO("vcl.gdi", "Unsupported font ignored: " << 
OUString(pLogFont->elfLogFont.lfFaceName));
 return 1;
@@ -1323,6 +1333,7 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 aInfo.mhDC  = getHDC();
 aInfo.mpList= pFontCollection;
 aInfo.mpName= nullptr;
+aInfo.mbPrinter = mbPrinter;
 aInfo.mnFontCount   = 0;
 
 LOGFONTW aLogFont;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2017-01-12 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |   28 
 1 file changed, 8 insertions(+), 20 deletions(-)

New commits:
commit 349a3c073391842e94ee83345e9c2f38339be1d7
Author: Khaled Hosny 
Date:   Thu Jan 12 08:51:39 2017 +0200

Drop unused struct members

Change-Id: I37aea9a2a40ab0e9642709de3b9e935bee9a6a53
Reviewed-on: https://gerrit.libreoffice.org/32986
Reviewed-by: Khaled Hosny 
Tested-by: Khaled Hosny 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 9860d5f..d1332ae8 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -335,10 +335,7 @@ struct ImplEnumInfo
 HDC mhDC;
 PhysicalFontCollection* mpList;
 OUString*   mpName;
-LOGFONTA*   mpLogFontA;
-LOGFONTW*   mpLogFontW;
-UINTmnPreferredCharSet;
-boolmbPrinter;
+LOGFONTW*   mpLogFont;
 int mnFontCount;
 };
 
@@ -1049,12 +1046,12 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* 
lpelfe,
 {
 OUString aName = OUString(reinterpret_cast(pLogFont->elfLogFont.lfFaceName));
 pInfo->mpName = 
-memcpy( pInfo->mpLogFontW->lfFaceName, 
pLogFont->elfLogFont.lfFaceName, (aName.getLength()+1)*sizeof( wchar_t ) );
-pInfo->mpLogFontW->lfCharSet = pLogFont->elfLogFont.lfCharSet;
-EnumFontFamiliesExW( pInfo->mhDC, pInfo->mpLogFontW, 
SalEnumFontsProcExW,
- reinterpret_cast(pInfo), 0 );
-pInfo->mpLogFontW->lfFaceName[0] = '\0';
-pInfo->mpLogFontW->lfCharSet = DEFAULT_CHARSET;
+memcpy(pInfo->mpLogFont->lfFaceName, 
pLogFont->elfLogFont.lfFaceName, (aName.getLength()+1)*sizeof(wchar_t));
+pInfo->mpLogFont->lfCharSet = pLogFont->elfLogFont.lfCharSet;
+EnumFontFamiliesExW(pInfo->mhDC, pInfo->mpLogFont, 
SalEnumFontsProcExW,
+reinterpret_cast(pInfo), 0);
+pInfo->mpLogFont->lfFaceName[0] = '\0';
+pInfo->mpLogFont->lfCharSet = DEFAULT_CHARSET;
 pInfo->mpName = nullptr;
 }
 }
@@ -1326,21 +1323,12 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 aInfo.mhDC  = getHDC();
 aInfo.mpList= pFontCollection;
 aInfo.mpName= nullptr;
-aInfo.mpLogFontA= nullptr;
-aInfo.mpLogFontW= nullptr;
-aInfo.mbPrinter = mbPrinter;
 aInfo.mnFontCount   = 0;
 
-aInfo.mnPreferredCharSet = DEFAULT_CHARSET;
-DWORD nCP = GetACP();
-CHARSETINFO aCharSetInfo;
-if ( TranslateCharsetInfo( reinterpret_cast((sal_IntPtr)nCP), 
, TCI_SRCCODEPAGE ) )
-aInfo.mnPreferredCharSet = aCharSetInfo.ciCharset;
-
 LOGFONTW aLogFont;
 memset( , 0, sizeof( aLogFont ) );
 aLogFont.lfCharSet = DEFAULT_CHARSET;
-aInfo.mpLogFontW = 
+aInfo.mpLogFont = 
 EnumFontFamiliesExW( getHDC(), ,
 SalEnumFontsProcExW, reinterpret_cast(), 0 );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-12-20 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 72002992a3c5213882fa4d60c7cd8fab10f0b009
Author: Khaled Hosny 
Date:   Tue Dec 20 23:35:28 2016 +0200

tdf#104733: Don't ignore OpenType-CFF fons on Windows

This is a folloup for ef4b9032de55e6b1b182e4ead1bbe6e590df296e, turns
out TRUTYPE_FONTTYPE does not cover CFF fonts like I thought (the
fonts that I was checking were actually TTF fonts).

Change-Id: I2d7b34b625aa03134421dc44a24e3c66be25df98
Reviewed-on: https://gerrit.libreoffice.org/32258
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 7c5fd4a..6be5acd 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1054,8 +1054,13 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 else
 {
 // Only SFNT fonts are supported, ignore anything else.
-if (!(nFontType & TRUETYPE_FONTTYPE))
+if (!(nFontType & TRUETYPE_FONTTYPE) &&
+!(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
+!(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
+{
+SAL_INFO("vcl.gdi", "Unsupported font ignored: " << 
OUString(pLogFont->elfLogFont.lfFaceName));
 return 1;
+}
 
 WinFontFace* pData = ImplLogMetricToDevFontDataW( pLogFont, 
&(pMetric->ntmTm), nFontType );
 pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-12-20 Thread Markus Mohrhard
 vcl/win/window/salframe.cxx |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 081267ebaacb38c564b36bb3e2576bf22d52b3e5
Author: Markus Mohrhard 
Date:   Mon Dec 19 22:37:24 2016 +0100

try to avoid the annoying focus stealing on windows

Change-Id: Ic6d3492a4707f24b616a7dee34a111ba0af4f281
Reviewed-on: https://gerrit.libreoffice.org/32207
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 424e588..689a69c 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -827,6 +827,17 @@ static void ImplSalFrameFullScreenPos( WinSalFrame* 
pFrame, bool bAlways = FALSE
 }
 }
 
+namespace {
+
+void SetForegroundWindow_Impl(HWND hwnd)
+{
+static bool bUseForegroundWindow = !std::getenv("VCL_HIDE_WINDOWS");
+if (bUseForegroundWindow)
+SetForegroundWindow(hwnd);
+}
+
+}
+
 WinSalFrame::WinSalFrame()
 {
 SalData* pSalData = GetSalData();
@@ -1179,8 +1190,8 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool 
bNoActivate )
 {
 HWND hWndParent = ::GetParent( hWnd );
 if ( hWndParent )
-SetForegroundWindow( hWndParent );
-SetForegroundWindow( hWnd );
+SetForegroundWindow_Impl( hWndParent );
+SetForegroundWindow_Impl( hWnd );
 }
 
 pFrame->mbInShow = FALSE;
@@ -1977,7 +1988,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags 
)
 DWORD  myThreadID   = GetCurrentThreadId();
 DWORD  currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
 AttachThreadInput(myThreadID, currThreadID,TRUE);
-SetForegroundWindow(hWnd);
+SetForegroundWindow_Impl(hWnd);
 AttachThreadInput(myThreadID,currThreadID,FALSE);
 }
 
@@ -2011,7 +2022,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags 
)
 // Windows sometimes incorrectly reports to have the focus;
 // thus make sure to really get the focus
 if ( ::GetFocus() == hWnd )
-SetForegroundWindow( hWnd );
+SetForegroundWindow_Impl( hWnd );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-12-15 Thread Khaled Hosny
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1fbfe5cbc288ead6bba9d30ddb849dcb41a0d5e0
Author: Khaled Hosny 
Date:   Fri Dec 16 08:54:45 2016 +0200

Fix typo from 6c436ba09cb35235ce6f4065cf74c9a6ff14a4bd

This broke OpenGL glyph caching since we were using a different DC
than the one we selected the font on.

Change-Id: I43218891aa1bc75599700ce6e0b582a5e73ff210

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 1f31cfa..57ac16f 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -57,7 +57,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, 
int nGlyphIndex, S
 SAL_WARN("vcl.gdi", "CreateCompatibleDC failed: " << 
WindowsErrorString(GetLastError()));
 return false;
 }
-HFONT hOrigFont = static_cast(SelectObject(hDC, hFont));
+HFONT hOrigFont = static_cast(SelectObject(hNewDC, hFont));
 if (hOrigFont == nullptr)
 {
 SAL_WARN("vcl.gdi", "SelectObject failed: " << 
WindowsErrorString(GetLastError()));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-12-15 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit ef4b9032de55e6b1b182e4ead1bbe6e590df296e
Author: Khaled Hosny 
Date:   Thu Dec 15 09:59:59 2016 +0200

tdf#103514: Try harder to ignore non-SFNT fonts

It seems that Script (and probably other bitmap fonts) have zero
nFontType, so instead if checking for RASTER_FONTTYPE, check for not
TRUTYPE_FONTTYPE (which seems to cover both TrueType and CFF-based SFNT
fonts).

Change-Id: Ie39ed99b219b756885b13b3ecbf3616556a277db
Reviewed-on: https://gerrit.libreoffice.org/32031
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 65c909f..8bf8c54 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1054,16 +1054,8 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 }
 else
 {
-// Ignore non-device font on printer.
-if (pInfo->mbPrinter && !(nFontType & DEVICE_FONTTYPE))
-return 1;
-
-// Ignore non-scalable fonts.
-if (nFontType & RASTER_FONTTYPE)
-return 1;
-
-// Ignore font formats we don’t support.
-if ((pMetric->ntmTm.ntmFlags & NTM_TYPE1) || (pMetric->ntmTm.ntmFlags 
& NTM_MULTIPLEMASTER))
+// Only SFNT fonts are supported, ignore anything else.
+if (!(nFontType & TRUETYPE_FONTTYPE))
 return 1;
 
 WinFontFace* pData = ImplLogMetricToDevFontDataW( pLogFont, 
&(pMetric->ntmTm), nFontType );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-12-15 Thread Samuel Mehrbrodt
 vcl/win/gdi/salnativewidgets-luna.cxx |   25 -
 1 file changed, 25 deletions(-)

New commits:
commit cd5b872632311b6c9fa6c5e89f23b8c5aedd62ca
Author: Samuel Mehrbrodt 
Date:   Thu Dec 15 08:14:25 2016 +

Revert "tdf#54169 Don't show acclerators by default on Windows"

Reverted because of issues mentioned in the bug report.

This reverts commit 64889c9fb6c3e8e7b7a7349833f7a10236104168.

Change-Id: I10fa0d0e55fd4c7c3624d9eb8a97e8c068b9db17
Reviewed-on: https://gerrit.libreoffice.org/32032
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index bb053c6..23fa61a 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -188,31 +188,6 @@ BOOL VisualStylesAPI::IsThemeActive()
 void SalData::initNWF()
 {
 ImplSVData* pSVData = ImplGetSVData();
-pSVData->maNWFData.mbEnableAccel = false; // Don't show accelerators all 
the time
-pSVData->maNWFData.mbAutoAccel = true;// Show accelerators only when 
alt is pressed
-
-HKEY hkey;
-
-if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Control 
Panel\\Accessibility\\Keyboard Preference", ))
-{
-DWORD dwType = 0;
-sal_uInt8 Data[2]; // possible values: "1", "0"
-DWORD cbData = sizeof(Data);
-
-if (ERROR_SUCCESS == RegQueryValueEx(hkey, "On", nullptr, , 
Data, )) // Check whether "make keyboard easier to use" is turned on
-{
-if (dwType == REG_SZ)
-{
-bool bValue = ((0 == stricmp(reinterpret_cast(Data), "1")));
-if(bValue)
-{
-pSVData->maNWFData.mbEnableAccel = true; // Always show 
accelerators
-pSVData->maNWFData.mbAutoAccel = false;
-}
-}
-}
-RegCloseKey(hkey);
-}
 
 // the menu bar and the top docking area should have a common background 
(gradient)
 pSVData->maNWFData.mbMenuBarDockingAreaCommonBG = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-12-08 Thread Abhilash Singh
 vcl/win/gdi/salnativewidgets-luna.cxx |   25 +
 1 file changed, 25 insertions(+)

New commits:
commit 64889c9fb6c3e8e7b7a7349833f7a10236104168
Author: Abhilash Singh 
Date:   Wed Dec 7 10:26:10 2016 +0530

tdf#54169 Don't show acclerators by default on Windows

Change-Id: I2bdecae83ed23e4f6fff0be99b46005a6db43837
Reviewed-on: https://gerrit.libreoffice.org/31711
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 23fa61a..bb053c6 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -188,6 +188,31 @@ BOOL VisualStylesAPI::IsThemeActive()
 void SalData::initNWF()
 {
 ImplSVData* pSVData = ImplGetSVData();
+pSVData->maNWFData.mbEnableAccel = false; // Don't show accelerators all 
the time
+pSVData->maNWFData.mbAutoAccel = true;// Show accelerators only when 
alt is pressed
+
+HKEY hkey;
+
+if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Control 
Panel\\Accessibility\\Keyboard Preference", ))
+{
+DWORD dwType = 0;
+sal_uInt8 Data[2]; // possible values: "1", "0"
+DWORD cbData = sizeof(Data);
+
+if (ERROR_SUCCESS == RegQueryValueEx(hkey, "On", nullptr, , 
Data, )) // Check whether "make keyboard easier to use" is turned on
+{
+if (dwType == REG_SZ)
+{
+bool bValue = ((0 == stricmp(reinterpret_cast(Data), "1")));
+if(bValue)
+{
+pSVData->maNWFData.mbEnableAccel = true; // Always show 
accelerators
+pSVData->maNWFData.mbAutoAccel = false;
+}
+}
+}
+RegCloseKey(hkey);
+}
 
 // the menu bar and the top docking area should have a common background 
(gradient)
 pSVData->maNWFData.mbMenuBarDockingAreaCommonBG = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-11-30 Thread Khaled Hosny
 vcl/win/gdi/winlayout.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit ba3e52699bc05911bc1f9e3cbd5d1332902c736a
Author: Khaled Hosny 
Date:   Wed Nov 30 14:42:19 2016 +0200

tdf#104013: Band aid for overzealous clipping

Change-Id: If66b7a61f4165ea2e504625cde36161adf945a53
Reviewed-on: https://gerrit.libreoffice.org/31418
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 19ab9ae..e2ea865 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3427,6 +3427,11 @@ bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout 
const , Rectangl
 rOut.Union(b);
 }
 
+// The clipping rectangle is sometimes overzealous, add an extra pixel to
+// remedy this.
+if (!rOut.IsEmpty())
+rOut.expand(1);
+
 return true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-11-17 Thread Stephan Bergmann
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 721cbf443744661c3c83a45186eb0b72d6e20e41
Author: Stephan Bergmann 
Date:   Thu Nov 17 17:05:18 2016 +0100

Silence -Werror,-Wlogical-op-parentheses

Change-Id: I4d592ef4bd683ffe8d9d44b3d3b188f9d4ed63ba

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index e5b891d..4941ac7 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -413,7 +413,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
 
 int nGlyphWidth = 0;
 // Unicode variance selectors selects glyph of previous base 
character, do not have width itself.
-if ( nCharCode >= 0xFE00 && nCharCode <= 0xFE0F || nCharCode >= 
0xE0100 && nCharCode <= 0xE01EF )
+if ( (nCharCode >= 0xFE00 && nCharCode <= 0xFE0F) || (nCharCode >= 
0xE0100 && nCharCode <= 0xE01EF) )
 {
 mpOutGlyphs[ i ] = DROPPED_OUTGLYPH;
 mpGlyphAdvances[ i ] = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-11-16 Thread Mark Hung
 vcl/win/gdi/winlayout.cxx |   21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 53778372a269da7c51958a7e234df4d41027fb77
Author: Mark Hung 
Date:   Sat Oct 8 22:08:28 2016 +0800

tdf#43740 SimpleWinLayout::LayoutText only advance position for actual 
glyphs.

Unicode variance selectors selects glyph of previous base character and
do not have character width itself.

Change-Id: Id0a0d9fcd40794b6db8ff89f84ad42a842472916
Reviewed-on: https://gerrit.libreoffice.org/29618
Tested-by: Jenkins 
Reviewed-by: jan iversen 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 671fa3f..e5b891d 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -411,8 +411,25 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
 }
 }
 
-// get the advance width for the current UTF-32 code point
-int nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode );
+int nGlyphWidth = 0;
+// Unicode variance selectors selects glyph of previous base 
character, do not have width itself.
+if ( nCharCode >= 0xFE00 && nCharCode <= 0xFE0F || nCharCode >= 
0xE0100 && nCharCode <= 0xE01EF )
+{
+mpOutGlyphs[ i ] = DROPPED_OUTGLYPH;
+mpGlyphAdvances[ i ] = 0;
+if ( bSurrogate &&  ( i+1 ) < mnGlyphCount )
+{
+mpOutGlyphs[ ++i ] = DROPPED_OUTGLYPH;
+mpGlyphAdvances[ i ] = 0;
+}
+continue;
+}
+else
+{
+// get the advance width for the current UTF-32 code point
+ nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode );
+}
+
 if( nGlyphWidth == -1 )
 {
 ABC aABC;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-11-10 Thread Stephan Bergmann
 vcl/win/gdi/salfont.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 508bb937db9ca736dadd5d2739e25ba40c417d68
Author: Stephan Bergmann 
Date:   Fri Nov 11 08:55:20 2016 +0100

loplugin:override

Change-Id: I3b0d6394fa6f127f89ee7dfcd2ec22de495fa566

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index d0c00a6..f290bdd 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -151,7 +151,7 @@ public:
 mhDC = GetDC(nullptr);
 };
 
-~WinGlyphFallbackSubstititution()
+~WinGlyphFallbackSubstititution() override
 {
 ReleaseDC(nullptr, mhDC);
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-11-01 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 5d39c2013374727b1c8f147b8b99d54402a7ff02
Author: Khaled Hosny 
Date:   Wed Nov 2 01:37:21 2016 +0200

tdf#71603: Create a new DC for the font fallback

For some reason re-using the DC from SalGraphics results in
GetFontData() returning GDI_ERROR and we fail to read the font’s 
“cmap”
table. The wired thing is that this happens only for fonts that were
not used before, so if you open a document directly the fallback works
but if you open start center or blank Writer document you get no
fallback. GDI is “interesting”.

Change-Id: Ic23095cabbd2623717271ce5d89bea75dca76a9a

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 8d6f065..d0c00a6 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -146,7 +146,15 @@ class WinGlyphFallbackSubstititution
 :public ImplGlyphFallbackFontSubstitution
 {
 public:
-explicitWinGlyphFallbackSubstititution( HDC );
+explicit WinGlyphFallbackSubstititution()
+{
+mhDC = GetDC(nullptr);
+};
+
+~WinGlyphFallbackSubstititution()
+{
+ReleaseDC(nullptr, mhDC);
+};
 
 bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingChars ) 
const override;
 private:
@@ -154,10 +162,6 @@ private:
 bool HasMissingChars(PhysicalFontFace*, OUString& rMissingChars) const;
 };
 
-inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC 
)
-:   mhDC( hDC )
-{}
-
 // does a font face hold the given missing characters?
 bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, 
OUString& rMissingChars) const
 {
@@ -1677,7 +1681,7 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 SalEnumFontsProcExW, reinterpret_cast(), 0 );
 
 // set glyph fallback hook
-static WinGlyphFallbackSubstititution aSubstFallback( getHDC() );
+static WinGlyphFallbackSubstititution aSubstFallback;
 static WinPreMatchFontSubstititution aPreMatchFont;
 pFontCollection->SetFallbackHook(  );
 pFontCollection->SetPreMatchHook();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-11-01 Thread Khaled Hosny
 vcl/win/gdi/winlayout.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 8d192b66e36576af4033d34ea895602a0c7a41ae
Author: Khaled Hosny 
Date:   Tue Nov 1 23:34:29 2016 +0200

Misplaced #if ENABLE_GRAPHITE

Change-Id: I2af3fdf100f6aaf435d8ed33d781ea0ca4ec21ec

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 3aed82d..3f051d7 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3326,14 +3326,6 @@ bool UniscribeLayout::IsKashidaPosValid ( int nCharPos ) 
const
 return true;
 }
 
-#if ENABLE_GRAPHITE
-
-sal_GlyphId GraphiteLayoutWinImpl::getKashidaGlyph(int & rWidth)
-{
-rWidth = mrFont.GetMinKashidaWidth();
-return mrFont.GetMinKashidaGlyph();
-}
-
 HINSTANCE D2DWriteTextOutRenderer::mmD2d1 = nullptr,
   D2DWriteTextOutRenderer::mmDWrite = nullptr;
 D2DWriteTextOutRenderer::pD2D1CreateFactory_t 
D2DWriteTextOutRenderer::D2D1CreateFactory = nullptr;
@@ -3708,6 +3700,14 @@ bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout 
const , Rectangl
 return true;
 }
 
+#if ENABLE_GRAPHITE
+
+sal_GlyphId GraphiteLayoutWinImpl::getKashidaGlyph(int & rWidth)
+{
+   rWidth = mrFont.GetMinKashidaWidth();
+   return mrFont.GetMinKashidaGlyph();
+}
+
 float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId)
 {
 HDC hDC = static_cast(const_cast(appFontHandle));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-10-31 Thread lbenes
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6a737c942b1a4f5c3a99c625793fcd4422b64784
Author: lbenes 
Date:   Sun Oct 30 23:44:11 2016 -0400

fix MSVC 2015 build Error C2397

Change-Id: I4810aa8b0b7d28bcd41b4aa19d40f41757d540cd
Reviewed-on: https://gerrit.libreoffice.org/30411
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 5655785..3aed82d 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3474,7 +3474,7 @@ bool D2DWriteTextOutRenderer::operator ()(SalLayout const 
, HDC hDC,
 DWRITE_GLYPH_OFFSET glyphOffsets[MAX_GLYPHS] = { { 0.0f, 0.0f }, };
 
 bool bVertical = false;
-double nYDiff = 0.0f;
+float nYDiff = 0.0f;
 const CommonSalLayout* pCSL = dynamic_cast();
 if (pCSL)
 bVertical = pCSL->getFontSelData().mbVertical;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-10-28 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx |  116 
 1 file changed, 50 insertions(+), 66 deletions(-)

New commits:
commit 8f0f5e0c709d01555a4069f8665889924ed181c7
Author: Khaled Hosny 
Date:   Thu Oct 27 22:58:37 2016 +0200

tdf#103514: Always ignore bitmap fonts on Windows

We should never see any bitmap fonts now, so all the Courier stuff can
go away.

Since we never list the bitmap fonts in the first place, the old code
for replacing some of them with scalable equivalents never kicks in. We
instead implement PreMatchFontSubstitution hook for the same effect.

Change-Id: I54f3c068bcd64554ed3498f4ba5b0f76bbd38589
Reviewed-on: https://gerrit.libreoffice.org/30345
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 7f11d65..d3e4e5e 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -69,10 +69,6 @@ inline int IntTimes256FromFixed(FIXED f)
 return nFixedTimes256;
 }
 
-// these variables can be static because they store system wide settings
-static bool bImplSalCourierScalable = false;
-static bool bImplSalCourierNew = false;
-
 // raw font data with a scoped lifetime
 class RawFontData
 {
@@ -283,6 +279,13 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar )
 return LANGUAGE_DONTKNOW;
 }
 
+class WinPreMatchFontSubstititution
+:public ImplPreMatchFontSubstitution
+{
+public:
+bool FindFontSubstitute(FontSelectPattern&) const override;
+};
+
 class WinGlyphFallbackSubstititution
 :public ImplGlyphFallbackFontSubstitution
 {
@@ -363,6 +366,39 @@ namespace
 }
 }
 
+// These are Win 3.1 bitmap fonts using "FON" font format
+// which is not supported with "Direct Write" so let's substitute them
+// with a font that is supported and always available.
+// Based on:
+// 
https://dxr.mozilla.org/mozilla-esr10/source/gfx/thebes/gfxDWriteFontList.cpp#1057
+static const std::map aBitmapFontSubs =
+{
+{ "MS Sans Serif", "Microsoft Sans Serif" },
+{ "MS Serif",  "Times New Roman" },
+{ "Small Fonts",   "Arial" },
+{ "Courier",   "Courier New" },
+{ "Roman", "Times New Roman" },
+{ "Script","Mistral" }
+};
+
+// TODO: See if Windows have API that we can use here to improve font fallback.
+bool WinPreMatchFontSubstititution::FindFontSubstitute(FontSelectPattern& 
rFontSelData) const
+{
+if (rFontSelData.IsSymbolFont() || IsStarSymbol(rFontSelData.maSearchName))
+return false;
+
+for (const auto& aSub : aBitmapFontSubs)
+{
+if (rFontSelData.maSearchName == GetEnglishSearchFontName(aSub.first))
+{
+rFontSelData.maSearchName = aSub.second;
+return true;
+}
+}
+
+return false;
+}
+
 // find a fallback font for missing characters
 // TODO: should stylistic matches be searched and preferred?
 bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& 
rFontSelData, OUString& rMissingChars ) const
@@ -449,9 +485,6 @@ struct ImplEnumInfo
 LOGFONTA*   mpLogFontA;
 LOGFONTW*   mpLogFontW;
 UINTmnPreferredCharSet;
-boolmbCourier;
-boolmbImplSalCourierScalable;
-boolmbImplSalCourierNew;
 boolmbPrinter;
 int mnFontCount;
 };
@@ -1220,26 +1253,6 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* 
i_pFont, float& o_rFontS
 LOGFONTW aLogFont;
 ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true );
 
-// on the display we prefer Courier New when Courier is a
-// bitmap only font and we need to stretch or rotate it
-if( mbScreen
-&&  (i_pFont->mnWidth != 0
-  || i_pFont->mnOrientation != 0
-  || i_pFont->mpFontData == nullptr
-  || (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight))
-&& !bImplSalCourierScalable
-&& bImplSalCourierNew
-&& (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
-lstrcpynW( aLogFont.lfFaceName, L"Courier New", 12 );
-
-// Script and Roman are Win 3.1 bitmap fonts using "FON" font format
-// which is not supported with "Direct Write" so let's substitute them
-// with a font that is supported and always available.
-if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Script") == 0)
-wcscpy(aLogFont.lfFaceName, L"Times New Roman");
-if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Roman") == 0)
-wcscpy(aLogFont.lfFaceName, L"Times New Roman");
-
 // #i47675# limit font requests to MAXFONTHEIGHT
 // TODO: share MAXFONTHEIGHT font instance
 if( (-aLogFont.lfHeight <= MAXFONTHEIGHT)
@@ -1507,12 +1520,6 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,

[Libreoffice-commits] core.git: vcl/win

2016-10-10 Thread Stephan Bergmann
 vcl/win/gdi/salprn.cxx |  174 +++--
 1 file changed, 85 insertions(+), 89 deletions(-)

New commits:
commit 0db235d61f323cecbbc1db761ba19cb5da4b3e6f
Author: Stephan Bergmann 
Date:   Mon Oct 10 12:24:23 2016 +0200

Expand some silly macros

Change-Id: Idf7b9285c655aef40e2618b44c35248ccd13084d
Reviewed-on: https://gerrit.libreoffice.org/29663
Reviewed-by: Stephan Bergmann 
Tested-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 926854a..6db349e 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -447,27 +447,21 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 return TRUE;
 }
 
-#define DECLARE_DEVMODE( i )\
-DEVMODEW* pDevModeW = SAL_DEVMODE_W(i);\
-if( pDevModeW == NULL )\
-return
-
-#define CHOOSE_DEVMODE(i)\
-(pDevModeW->i)
-
 static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* 
pSetupData, JobSetFlags nFlags )
 {
 if ( !pSetupData || !pSetupData->GetDriverData() )
 return;
 
-DECLARE_DEVMODE( pSetupData );
+DEVMODEW* pDevModeW = SAL_DEVMODE_W(pSetupData);
+if( pDevModeW == nullptr )
+return;
 
 // Orientation
 if ( nFlags & JobSetFlags::ORIENTATION )
 {
-if ( CHOOSE_DEVMODE(dmOrientation) == DMORIENT_PORTRAIT )
+if ( pDevModeW->dmOrientation == DMORIENT_PORTRAIT )
 pSetupData->SetOrientation( Orientation::Portrait );
-else if ( CHOOSE_DEVMODE(dmOrientation) == DMORIENT_LANDSCAPE )
+else if ( pDevModeW->dmOrientation == DMORIENT_LANDSCAPE )
 pSetupData->SetOrientation( Orientation::Landscape );
 }
 
@@ -485,7 +479,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 // search the right bin and assign index to mnPaperBin
 for( DWORD i = 0; i < nCount; ++i )
 {
-if( CHOOSE_DEVMODE(dmDefaultSource) == pBins[ i ] )
+if( pDevModeW->dmDefaultSource == pBins[ i ] )
 {
 pSetupData->SetPaperBin( (sal_uInt16)i );
 break;
@@ -499,10 +493,10 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 // PaperSize
 if ( nFlags & JobSetFlags::PAPERSIZE )
 {
-if( (CHOOSE_DEVMODE(dmFields) & (DM_PAPERWIDTH|DM_PAPERLENGTH)) == 
(DM_PAPERWIDTH|DM_PAPERLENGTH) )
+if( (pDevModeW->dmFields & (DM_PAPERWIDTH|DM_PAPERLENGTH)) == 
(DM_PAPERWIDTH|DM_PAPERLENGTH) )
 {
-pSetupData->SetPaperWidth( CHOOSE_DEVMODE(dmPaperWidth)*10 );
-pSetupData->SetPaperHeight( CHOOSE_DEVMODE(dmPaperLength)*10 );
+pSetupData->SetPaperWidth( pDevModeW->dmPaperWidth*10 );
+pSetupData->SetPaperHeight( pDevModeW->dmPaperLength*10 );
 }
 else
 {
@@ -524,7 +518,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 {
 for( DWORD i = 0; i < nPaperCount; ++i )
 {
-if( pPapers[ i ] == CHOOSE_DEVMODE(dmPaperSize) )
+if( pPapers[ i ] == pDevModeW->dmPaperSize )
 {
 pSetupData->SetPaperWidth( pPaperSizes[ i ].x*10 );
 pSetupData->SetPaperHeight( pPaperSizes[ i ].y*10 );
@@ -537,7 +531,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 if( pPaperSizes )
 rtl_freeMemory( pPaperSizes );
 }
-switch( CHOOSE_DEVMODE(dmPaperSize) )
+switch( pDevModeW->dmPaperSize )
 {
 case DMPAPER_LETTER:
 pSetupData->SetPaperFormat( PAPER_LETTER );
@@ -708,13 +702,13 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 if( nFlags & JobSetFlags::DUPLEXMODE )
 {
 DuplexMode eDuplex = DuplexMode::Unknown;
-if( (CHOOSE_DEVMODE(dmFields) & DM_DUPLEX) )
+if( (pDevModeW->dmFields & DM_DUPLEX) )
 {
-if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_SIMPLEX )
+if( pDevModeW->dmDuplex == DMDUP_SIMPLEX )
 eDuplex = DuplexMode::Off;
-else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_VERTICAL )
+else if( pDevModeW->dmDuplex == DMDUP_VERTICAL )
 eDuplex = DuplexMode::LongEdge;
-else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_HORIZONTAL )
+else if( pDevModeW->dmDuplex == DMDUP_HORIZONTAL )
 eDuplex = DuplexMode::ShortEdge;
 }
 pSetupData->SetDuplexMode( eDuplex );
@@ -726,16 +720,18 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* 
pPrinter, const ImplJobSet
 if ( !pSetupData || !pSetupData->GetDriverData() )
 return;
 
-

[Libreoffice-commits] core.git: vcl/win

2016-08-25 Thread Stephan Bergmann
 vcl/win/gdi/salnativewidgets-luna.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 1594fd83c303139692c5dd6a7f2e236dbf99638e
Author: Stephan Bergmann 
Date:   Thu Aug 25 17:40:45 2016 +0200

-Werror,-Wswitch (clang-cl)

Change-Id: I874e103486dd77842a2299e0f20fe42ef6a7eaf5

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 4526f7a..c8e3b38 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -629,6 +629,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
 case ControlPart::TrackHorzRight: iPart = SBP_LOWERTRACKHORZ; 
break;
 case ControlPart::TrackVertUpper: iPart = SBP_UPPERTRACKVERT; 
break;
 case ControlPart::TrackVertLower: iPart = SBP_LOWERTRACKVERT; 
break;
+default: break;
 }
 
 if( nState & ControlState::PRESSED )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-08-25 Thread Stephan Bergmann
 vcl/win/gdi/gdiimpl.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fa83177200bba96325663268a913af8447c1c689
Author: Stephan Bergmann 
Date:   Thu Aug 25 17:40:21 2016 +0200

-Werror,-Winconsistent-missing-override (clang-cl)

Change-Id: Ie06e9ba94697c40fa03a535ad3f03c5ff181266e

diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index db6e46a..aa10539 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -83,7 +83,7 @@ public:
 virtual void SetFillColor( SalColor nSalColor ) override;
 
 // enable/disable XOR drawing
-virtual void SetXORMode( bool bSet);
+virtual void SetXORMode( bool bSet) override;
 
 // set line color for raster operations
 virtual void SetROPLineColor( SalROPColor nROPColor ) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-07-30 Thread Mark Hung
 vcl/win/window/salframe.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 462d2311384e71ab76f9d8d357d2bc1375490b13
Author: Mark Hung 
Date:   Mon Jul 11 23:22:25 2016 +0800

Fix SolarMutex not locked when using IME on dropdown list.

Surround ImplHandleIMEQueryCharPosition() by
ImplSalYieldMutexAcquireWithWait() and ImplSalYieldMutexRelease().

Change-Id: I3843ad351f3b92801cd1e0066a3c73f2a52c44bd
Reviewed-on: https://gerrit.libreoffice.org/27117
Tested-by: Jenkins 
Reviewed-by: Mark Hung 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 084705c..0f341f7 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5857,7 +5857,13 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, 
WPARAM wParam, LPARAM lP
 }
 else if ( (sal_uIntPtr)( wParam ) == IMR_QUERYCHARPOSITION )
 {
-nRet = ImplHandleIMEQueryCharPosition( hWnd, lParam );
+if ( ImplSalYieldMutexTryToAcquire() )
+{
+nRet = ImplHandleIMEQueryCharPosition( hWnd, lParam );
+ImplSalYieldMutexRelease();
+}
+else
+nRet = FALSE;
 rDef = FALSE;
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-07-03 Thread Tomaž Vajngerl
 vcl/win/gdi/salfont.cxx   |8 
 vcl/win/gdi/winlayout.cxx |   14 +-
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit b5cd1220b849a9759dd4446032a7e1affbf151f2
Author: Tomaž Vajngerl 
Date:   Mon Jul 4 09:21:13 2016 +0800

tdf#98710 check the font is bound, substitute FON fonts

If we can't bind the font then we can't proceed with rendering
and caching of the glyphs. This may avoid the crash but the font
won't be drawn. This happens for old Windows 3.1 bitmap fonts in
FON format which Direct Write doesn't support. So in addition
substitute "Script" and "Roman" FON fonts with "Times New Roman".

Change-Id: I16b480399b47989738a703ad84c0398493f9f4e3
Reviewed-on: https://gerrit.libreoffice.org/26885
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 5aa4aa4..331f519 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1373,6 +1373,14 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* 
i_pFont, float& o_rFontS
 && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
 lstrcpynW( aLogFont.lfFaceName, L"Courier New", 12 );
 
+// Script and Roman are Win 3.1 bitmap fonts using "FON" font format
+// which is not supported with "Direct Write" so let's substitute them
+// with a font that is supported and always available.
+if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Script") == 0)
+wcscpy(aLogFont.lfFaceName, L"Times New Roman");
+if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Roman") == 0)
+wcscpy(aLogFont.lfFaceName, L"Times New Roman");
+
 // #i47675# limit font requests to MAXFONTHEIGHT
 // TODO: share MAXFONTHEIGHT font instance
 if( (-aLogFont.lfHeight <= MAXFONTHEIGHT)
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 5ceec06..d0f0b9a 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -276,6 +276,7 @@ class D2DWriteTextOutRenderer : public TextOutRenderer
 {
 typedef HRESULT(WINAPI *pD2D1CreateFactory_t)(D2D1_FACTORY_TYPE,
 REFIID, const D2D1_FACTORY_OPTIONS *, void **);
+
 typedef HRESULT(WINAPI *pDWriteCreateFactory_t)(DWRITE_FACTORY_TYPE,
 REFIID, IUnknown **);
 
@@ -379,7 +380,12 @@ bool WinFontInstance::CacheGlyphToAtlas(bool 
bRealGlyphIndices, int nGlyphIndex,
 if (!pTxt)
 return false;
 
-pTxt->BindFont(hDC);
+if (!pTxt->BindFont(hDC))
+{
+SAL_WARN("vcl.gdi", "Binding of font failed. The font might not be 
supported by Direct Write.");
+DeleteDC(hDC);
+return false;
+}
 
 // Bail for non-horizontal text.
 {
@@ -405,6 +411,11 @@ bool WinFontInstance::CacheGlyphToAtlas(bool 
bRealGlyphIndices, int nGlyphIndex,
 // Fetch the ink boxes and calculate the size of the atlas.
 if (!bRealGlyphIndices)
 {
+if (!pTxt->GetFontFace())
+{
+SAL_WARN("vcl.gdi", "Font face is not available.");
+return false;
+}
 if 
(!SUCCEEDED(pTxt->GetFontFace()->GetGlyphIndices(aCodePointsOrGlyphIndices.data(),
 aCodePointsOrGlyphIndices.size(), aGlyphIndices.data(
 {
 pTxt->ReleaseFont();
@@ -415,6 +426,7 @@ bool WinFontInstance::CacheGlyphToAtlas(bool 
bRealGlyphIndices, int nGlyphIndex,
 {
 aGlyphIndices[0] = aCodePointsOrGlyphIndices[0];
 }
+
 Rectangle bounds(0, 0, 0, 0);
 auto aInkBoxes = pTxt->GetGlyphInkBoxes(aGlyphIndices.data(), 
aGlyphIndices.data() + 1);
 for (auto  : aInkBoxes)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-06-02 Thread krishna keshav
 vcl/win/gdi/winlayout.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit c0843884a0929ae4e5ad30e2410d8a8f6dfb1670
Author: krishna keshav 
Date:   Mon May 30 02:17:22 2016 +0530

tdf#96099 Reduce number of typedefs used for trivial container types

Removed "typedef" for std::unordered_map in 
vcl/win/gdi/winlayout.cxx

Change-Id: I2798a21be61d6ceee680762d4145a2ae1fc1242d
Reviewed-on: https://gerrit.libreoffice.org/25644
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 7133a7c..76900a5 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -50,8 +50,6 @@
 #include 
 #include 
 
-typedef std::unordered_map IntMap;
-
 // Graphite headers
 #include 
 #if ENABLE_GRAPHITE
@@ -233,10 +231,10 @@ public:
 }
 
 private:
-IntMap  maWidthMap;
-mutable int mnMinKashidaWidth;
-mutable int mnMinKashidaGlyph;
-boolmbGLyphySetupCalled;
+std::unordered_mapmaWidthMap;
+mutable int mnMinKashidaWidth;
+mutable int mnMinKashidaGlyph;
+boolmbGLyphySetupCalled;
 };
 
 GLuint WinFontInstance::mnGLyphyProgram = 0;
@@ -345,7 +343,7 @@ inline void WinFontInstance::CacheGlyphWidth( int 
nCharCode, int nCharWidth )
 
 inline int WinFontInstance::GetCachedGlyphWidth( int nCharCode ) const
 {
-IntMap::const_iterator it = maWidthMap.find( nCharCode );
+auto it = maWidthMap.find( nCharCode );
 if( it == maWidthMap.end() )
 return -1;
 return it->second;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-25 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 5f459af600597d3508676252b23ff8b5e00427dd
Author: Tor Lillqvist 
Date:   Wed May 25 14:58:27 2016 +0300

tdf#98792: This assertion is not needed

In some cases this assert() even prevents stuff from working
nicely. (In a build where assertions are active, obviously, so this
commit has no effect on "production" builds.) See bug report for some
(fairly clueless) comments by me.

Change-Id: Id1847f6e0a7dc30e63e6dd7d5800515c4229b9d1

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index d00a49e..7133a7c 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -2373,7 +2373,6 @@ int UniscribeLayout::GetNextGlyphs( int nLen, 
sal_GlyphId* pGlyphs, Point& rPos,
 if( mpGlyphs2Chars )  // unless explicitly requested+provided
 {
 nCharPos = mpGlyphs2Chars[ nStart ];
-assert(-1 != nCharPos);
 }
 
 // inject kashida glyphs if needed
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-12 Thread Tor Lillqvist
 vcl/win/gdi/salfont.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 64e24d9bfc02910b80d77b83dcf3346eff546f96
Author: Tor Lillqvist 
Date:   Thu May 12 17:58:04 2016 +0300

Revert "tdf#98983: Font fallback: Map 'MS Sans Serif' to the TrueType 
version"

Turns out the problem has already been fixed in master in a different
way by mst. Sorry, I did not have a master build to check in Windows,
I was actually working on fixing the bug in a 5.1 tree.

This reverts commit 0a986598cf64fc386d267693a78047c2dd71a61a.

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 62d3e61..d198dc6 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1375,11 +1375,7 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* 
i_pFont, float& o_rFontS
 && !bImplSalCourierScalable
 && bImplSalCourierNew
 && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
-wcscpy( aLogFont.lfFaceName, L"Courier New" );
-
-// Prefer the scalable 'Microsoft Sans Serif' to the old raster 'MS Sans 
Serif'
-if( ImplSalWICompareAscii( aLogFont.lfFaceName, "MS Sans Serif" ) == 0 )
-wcscpy( aLogFont.lfFaceName, L"Microsoft Sans Serif" );
+lstrcpynW( aLogFont.lfFaceName, L"Courier New", 12 );
 
 // #i47675# limit font requests to MAXFONTHEIGHT
 // TODO: share MAXFONTHEIGHT font instance
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-12 Thread Tor Lillqvist
 vcl/win/gdi/salfont.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 0a986598cf64fc386d267693a78047c2dd71a61a
Author: Tor Lillqvist 
Date:   Thu May 12 17:29:20 2016 +0300

tdf#98983: Font fallback: Map 'MS Sans Serif' to the TrueType version

Also, I don't see the point in using lstrcpynW() instead of a plain
wcscpy(), as we were passing the manually specified very length of the
source string (including terminating nul character) anyway. We did not
use a copying function that would have taken the size of the
destination buffer as a limit parameter, for instance.

Change-Id: If9e2f56b16358201c113e06289f63ed3454e00c9

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index d198dc6..62d3e61 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1375,7 +1375,11 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* 
i_pFont, float& o_rFontS
 && !bImplSalCourierScalable
 && bImplSalCourierNew
 && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
-lstrcpynW( aLogFont.lfFaceName, L"Courier New", 12 );
+wcscpy( aLogFont.lfFaceName, L"Courier New" );
+
+// Prefer the scalable 'Microsoft Sans Serif' to the old raster 'MS Sans 
Serif'
+if( ImplSalWICompareAscii( aLogFont.lfFaceName, "MS Sans Serif" ) == 0 )
+wcscpy( aLogFont.lfFaceName, L"Microsoft Sans Serif" );
 
 // #i47675# limit font requests to MAXFONTHEIGHT
 // TODO: share MAXFONTHEIGHT font instance
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-12 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 43c95611d2621d1f2f9d60b26c07aad25c62baed
Author: Tor Lillqvist 
Date:   Thu May 12 14:22:42 2016 +0300

tdf#99369: Try harder to bail out for non-horizontal text

Look not only for fonts with rotated glyphs (where the first character
of the face name is '@') but also for font objects with non-zero
orientation or escapement in general.

Change-Id: Ia88d38010e52ada8193f2b8057d9f3250108e9f1

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 7c217b6..0e39c12 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -383,17 +383,21 @@ bool WinFontInstance::CacheGlyphToAtlas(bool 
bRealGlyphIndices, int nGlyphIndex,
 
 pTxt->BindFont(hDC);
 
-// Bail for vertical text.
+// Bail for non-horizontal text.
 {
 wchar_t sFaceName[200];
 int nFaceNameLen = GetTextFaceW(hDC, SAL_N_ELEMENTS(sFaceName), 
sFaceName);
-SelectObject(hDC, hOrigFont);
-DeleteDC(hDC);
 
 if (!nFaceNameLen)
 SAL_WARN("vcl.gdi", "GetTextFace failed: " << 
WindowsErrorString(GetLastError()));
 
-if (sFaceName[0] == '@')
+LOGFONTW aLogFont;
+GetObjectW(rLayout.mhFont, sizeof(LOGFONTW), );
+
+SelectObject(hDC, hOrigFont);
+DeleteDC(hDC);
+
+if (sFaceName[0] == '@' || aLogFont.lfOrientation != 0 || 
aLogFont.lfEscapement != 0)
 {
 pTxt->ReleaseFont();
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-11 Thread Juergen Funk
 vcl/win/app/salinst.cxx |2 ++
 vcl/win/window/salframe.cxx |3 +++
 2 files changed, 5 insertions(+)

New commits:
commit 0761614ccf5beb9051fb132c5f1990198f32967f
Author: Juergen Funk 
Date:   Sat Mar 26 22:46:51 2016 +0100

tdf#98924  In windows, change the keyboard layout per application

reint the key maps when in windows change the language for the
application

Change-Id: I71045386b4fe4d6db5572effa07a2f01ce79e74f
Reviewed-on: https://gerrit.libreoffice.org/23556
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 1f2d22c..906129f 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -299,6 +299,8 @@ void SalData::initKeyCodeMap()
 if( nKey < 0x )\
 maVKMap[ nKey ] = b;
 
+maVKMap.clear();
+
 initKey( '+', KEY_ADD );
 initKey( '-', KEY_SUBTRACT );
 initKey( '*', KEY_MULTIPLY );
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index fd5d207..a716898 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -4917,6 +4917,9 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, 
LPARAM lParam )
 if( nLang != pFrame->mnInputLang )
 pFrame->CallCallback( SalEvent::InputLanguageChange, 0 );
 
+// reinit spec. keys
+GetSalData()->initKeyCodeMap();
+
 ImplSalYieldMutexRelease();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-10 Thread Noel Grandin
 vcl/win/window/salframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 02dac9f7c956f6073d810f4a0c80c733f40aea6d
Author: Noel Grandin 
Date:   Tue May 10 09:17:18 2016 +0200

fix Windows build (second attempt)

Change-Id: I5aa3bcf16cbcda984a74ec85a49a354087f5044e

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 75fd6d9..3d5711f 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -183,7 +183,7 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
 long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
 long nRightDeco = abs( aRect.right - aRect2.right );
 
-pFrame->maState.mnState &= 
WindowStateState(~(WindowStateState::Minimized | WindowStateState::Maximized));
+pFrame->maState.mnState &= 
~WindowStateState(WindowStateState::Minimized | WindowStateState::Maximized);
 // subtract decoration
 pFrame->maState.mnX  = aRect.left+nLeftDeco;
 pFrame->maState.mnY  = aRect.top+nTopDeco;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-10 Thread Tim Eves
 vcl/win/gdi/winlayout.cxx |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 1caae7289d696686e88f60155cef895c5d781f53
Author: Tim Eves 
Date:   Tue May 10 09:47:30 2016 +0700

tdf#99207: Fix incorrect RGB ordering in Graphite DWrite path

Direct 2D accepts colours specified as UINT32 ARGB values or
floats. However GDI presents colours as COLOREFS which are 32 bit
FBGR (F is a flag not an alpha) values. Passing a COLORREF to
D2D1:ColorF swaps the red and blue channels. This patch converts
the COLORREF into RGB float triples using the GDI colour macros.

Change-Id: Iee5c00bfb10fa8771a2a1019976f70633cca4094
Reviewed-on: https://gerrit.libreoffice.org/24819
Tested-by: Jenkins 
Reviewed-by: Martin Hosken 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index be97cfe..7c217b6 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3745,8 +3745,9 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const 
, HDC hDC,
 bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, 
bounds);
 succeeded &= BindDC(hDC, bounds);   // Update the bounding rect.
 
-ID2D1SolidColorBrush* pBlackBrush = NULL;
-succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetTextColor(hDC)), 
));
+ID2D1SolidColorBrush* pBrush = NULL;
+COLORREF bgrTextColor = GetTextColor(mhDC);
+succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 
255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), 
));
 
 HRESULT hr = S_OK;
 int nGlyphs = 0;
@@ -3781,14 +3782,14 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout 
const , HDC hDC,
 0
 };
 
-mpRT->DrawGlyphRun(baseline, , pBlackBrush);
+mpRT->DrawGlyphRun(baseline, , pBrush);
 } while (!pRectToErase);
 
 hr = mpRT->EndDraw();
 }
 
-if (pBlackBrush)
-pBlackBrush->Release();
+if (pBrush)
+pBrush->Release();
 
 ReleaseFont();
 
@@ -3886,7 +3887,8 @@ bool D2DWriteTextOutRenderer::DrawGlyphs(const Point & 
origin, uint16_t * pGid,
 bool succeeded = BindDC(mhDC, bounds);   // Update the bounding rect.
 
 ID2D1SolidColorBrush* pBrush = NULL;
-succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetTextColor(mhDC)), 
));
+COLORREF bgrTextColor = GetTextColor(mhDC);
+succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 
255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), 
));
 
 HRESULT hr = S_OK;
 if (succeeded)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-05-10 Thread Noel Grandin
 vcl/win/window/salframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5949683a5da9efd11fa387007363a754f39833d9
Author: Noel Grandin 
Date:   Tue May 10 08:57:55 2016 +0200

fix Windows build

Change-Id: Ia00af427fda31867a19457b7ef30158b385639e6

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index adced19..75fd6d9 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -183,7 +183,7 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
 long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
 long nRightDeco = abs( aRect.right - aRect2.right );
 
-pFrame->maState.mnState &= ~(WindowStateState::Minimized | 
WindowStateState::Maximized);
+pFrame->maState.mnState &= 
WindowStateState(~(WindowStateState::Minimized | WindowStateState::Maximized));
 // subtract decoration
 pFrame->maState.mnX  = aRect.left+nLeftDeco;
 pFrame->maState.mnY  = aRect.top+nTopDeco;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-04-19 Thread Julien Nabet
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3dca8575d63db50b0120fbff09bbfcd056fa3732
Author: Julien Nabet 
Date:   Tue Apr 19 22:41:46 2016 +0200

Prefer prefix ++/-- operators for non-primitive types

Change-Id: I83273c31a03cf79126e71d55b39211c18f8bfcd0
Reviewed-on: https://gerrit.libreoffice.org/24249
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index ea1341f..b248aeb 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -155,7 +155,7 @@ public:
 }
 else
 {
-it++;
+++it;
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-04-14 Thread Armin Le Grand
 vcl/win/gdi/gdiimpl.cxx |   44 
 1 file changed, 32 insertions(+), 12 deletions(-)

New commits:
commit ffbe65924d532f5ec35fc32ecd95f9535b478214
Author: Armin Le Grand 
Date:   Wed Apr 13 16:39:42 2016 +0200

tdf#40863 only use polygons with area for WinClipRegions

Due to a former fix CustomShapes have extra polygons with a single
point in the top-left and bottom-right corner of their BoundRect,
a workaround to allow getting their correct BoundRect in slideshow.
Unfortunately this makes the win command CreatePolyPolygonRgn fail
to create the needed ClipRegions so that the geometry is processed
without clipping. Changed to only use polygons as input that have an
area.

Change-Id: I0eeda5776402777ed00de92f42a55f206575f58b
Reviewed-on: https://gerrit.libreoffice.org/24059
Reviewed-by: Noel Grandin 
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b3a39f1..0317ca0 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1151,6 +1151,7 @@ bool WinSalGraphicsImpl::setClipRegion( const 
vcl::Region& i_rClip )
 aPolyPoints.reserve( 1024 );
 std::vector< INT > aPolyCounts( nCount, 0 );
 basegfx::B2DHomMatrix aExpand;
+sal_uInt32 nTargetCount(0);
 static bool bExpandByOneInXandY(true);
 
 if(bExpandByOneInXandY)
@@ -1167,26 +1168,45 @@ bool WinSalGraphicsImpl::setClipRegion( const 
vcl::Region& i_rClip )
 aPolyPolygon.getB2DPolygon(a),
 1));
 const sal_uInt32 nPoints(aPoly.count());
-aPolyCounts[a] = nPoints;
 
-for( sal_uInt32 b = 0; b < nPoints; b++ )
+// tdf#40863 For CustomShapes there is a hack (see
+// f64ef72743e55389e446e0d4bc6febd475011023) that adds polygons
+// with a single point in top-left and bottom-right corner
+// of the BoundRect to be able to determine the correct 
BoundRect
+// in the slideshow. Unfortunately, CreatePolyPolygonRgn below
+// fails with polygons containing a single pixel, so clipping 
is
+// lost. For now, use only polygons with more than two points 
- the
+// ones that may have an area.
+// Note: polygons with one point which are curves may have an 
area,
+// but the polygon is already subdivided here, so no need to 
test
+// this.
+if(nPoints > 2)
 {
-basegfx::B2DPoint aPt(aPoly.getB2DPoint(b));
+aPolyCounts[nTargetCount] = nPoints;
+nTargetCount++;
 
-if(bExpandByOneInXandY)
+for( sal_uInt32 b = 0; b < nPoints; b++ )
 {
-aPt = aExpand * aPt;
-}
+basegfx::B2DPoint aPt(aPoly.getB2DPoint(b));
+
+if(bExpandByOneInXandY)
+{
+aPt = aExpand * aPt;
+}
 
-POINT aPOINT;
-// #i122149# do correct rounding
-aPOINT.x = basegfx::fround(aPt.getX());
-aPOINT.y = basegfx::fround(aPt.getY());
-aPolyPoints.push_back( aPOINT );
+POINT aPOINT;
+// #i122149# do correct rounding
+aPOINT.x = basegfx::fround(aPt.getX());
+aPOINT.y = basegfx::fround(aPt.getY());
+aPolyPoints.push_back( aPOINT );
+}
 }
 }
 
-mrParent.mhRegion = CreatePolyPolygonRgn( [0], 
[0], nCount, ALTERNATE );
+if(nTargetCount)
+{
+mrParent.mhRegion = CreatePolyPolygonRgn( [0], 
[0], nTargetCount, ALTERNATE );
+}
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-04-11 Thread Juergen Funk
 vcl/win/window/salframe.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 58bcea744ac4d9f73f055527369ef54cbc8f1a97
Author: Juergen Funk 
Date:   Sat Mar 26 10:37:13 2016 +0100

tdf#87944 COLOR-PICKER stays on wrong position.

After this patch dab2582f05979cd99a5937cb95a387cfed70bb8d
under windows always open on the wrong position
(open in the middle of the application but not under the
pushbutton)

Change-Id: Ib245df6ccb2be768f7a12b638864d5c3cea1a390
Reviewed-on: https://gerrit.libreoffice.org/23557
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 63b96ca..f04d923 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1310,6 +1310,9 @@ void WinSalFrame::SetPosSize( long nX, long nY, long 
nWidth, long nHeight,
 
 nX = aPt.x;
 nY = aPt.y;
+
+// the position is set
+mbDefPos = false;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-04-07 Thread Marco Cecchetti
 vcl/win/gdi/winlayout.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 92e33ae10d63b5acd8643d33c032dbb022bd75be
Author: Marco Cecchetti 
Date:   Thu Apr 7 12:10:29 2016 +0200

tdf#98710 - catch exception due to crash in dwrite

Change-Id: I448b166866710825d2b3c582796c392436fe072e
Reviewed-on: https://gerrit.libreoffice.org/23892
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 12df505..1ee9d02 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -4002,7 +4002,16 @@ bool D2DWriteTextOutRenderer::DrawGlyphs(const Point & 
origin, uint16_t * pGid,
 
 bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** 
ppFontFace, float * lfSize) const
 {
-bool const succeeded = SUCCEEDED(mpGdiInterop->CreateFontFaceFromHdc(hDC, 
ppFontFace));
+bool succeeded = false;
+try
+{
+succeeded = SUCCEEDED(mpGdiInterop->CreateFontFaceFromHdc(hDC, 
ppFontFace));
+}
+catch (const std::exception& e)
+{
+SAL_WARN("vcl.gdi.opengl", "Error in dwrite while creating font face: 
" << e.what());
+return false;
+}
 
 if (succeeded)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-04-07 Thread Tor Lillqvist
 vcl/win/gdi/salfont.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit e821558b2e233a9c04712555a6bdcb5020c1209f
Author: Tor Lillqvist 
Date:   Mon Mar 28 16:38:24 2016 +0300

No need for  here

Change-Id: I809143b0c2b5fe36ce01f44e6eca2f33ae36198f

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 4b844c3..d7c9627 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -21,7 +21,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-31 Thread Marco Cecchetti
 vcl/win/gdi/salfont.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 9fa87bb1a42c45446f78b4d8c8096d7ce90a8022
Author: Marco Cecchetti 
Date:   Wed Mar 30 19:41:57 2016 +0200

tdf#98812: follow-up

pFont->mpFontInstance can be NULL.

Change-Id: I934703bc40621dc412e444cc9a370c7031cbbb86
Reviewed-on: https://gerrit.libreoffice.org/23654
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 48a3c92..6819d21 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1458,7 +1458,12 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* 
pFont, int nFallbackLevel
 {
 
GetWinFontEntry(nFallbackLevel)->mpFontCache->Release(GetWinFontEntry(nFallbackLevel));
 }
-pFont->mpFontInstance->mpFontCache->Acquire(pFont->mpFontInstance);
+// WinSalGraphics::GetEmbedFontData does not set mpFontInstance
+// since it is interested in font file data only.
+if (pFont->mpFontInstance)
+{
+pFont->mpFontInstance->mpFontCache->Acquire(pFont->mpFontInstance);
+}
 mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast( 
pFont->mpFontInstance );
 mpWinFontData[ nFallbackLevel ] = static_cast( 
pFont->mpFontData );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-29 Thread Armin Le Grand
 vcl/win/gdi/gdiimpl.cxx |  153 ++--
 1 file changed, 47 insertions(+), 106 deletions(-)

New commits:
commit 84f7867de70fb91e7e3bd8acc8175b4be4be31dd
Author: Armin Le Grand 
Date:   Thu Mar 24 13:46:51 2016 +0100

tdf#98859 use ObjectOriented approach for Gdiplus

Current usage of Gdiplus uses direct procedure calls to e.g. allocate
Gdiplus specific objects. This includes the risk to forget to free
those objects. Using Gdiplus Objects in scopes avoids that.

Change-Id: I48f086d708cce67229edff0983b96e63c19907d7
Reviewed-on: https://gerrit.libreoffice.org/23492
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 7febbe8..2366fbe 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1871,51 +1871,10 @@ bool WinSalGraphicsImpl::drawPolyPolygonBezier( 
sal_uInt32 nPoly, const sal_uInt
 return bRet;
 }
 
-void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GpPath *pPath, const 
basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
-{
-sal_uInt32 nCount(rPolygon.count());
-
-if(nCount)
-{
-const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1);
-const bool bControls(rPolygon.areControlPointsUsed());
-basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0));
-
-for(sal_uInt32 a(0); a < nEdgeCount; a++)
-{
-const sal_uInt32 nNextIndex((a + 1) % nCount);
-const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex));
-
-if(bControls && (rPolygon.isNextControlPointUsed(a) || 
rPolygon.isPrevControlPointUsed(nNextIndex)))
-{
-const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a));
-const basegfx::B2DPoint 
aCb(rPolygon.getPrevControlPoint(nNextIndex));
-
-Gdiplus::DllExports::GdipAddPathBezier(pPath,
-aCurr.getX(), aCurr.getY(),
-aCa.getX(), aCa.getY(),
-aCb.getX(), aCb.getY(),
-aNext.getX(), aNext.getY());
-}
-else
-{
-Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), 
aCurr.getY(), aNext.getX(), aNext.getY());
-}
-
-if(a + 1 < nEdgeCount)
-{
-aCurr = aNext;
-
-if(bNoLineJoin)
-{
-Gdiplus::DllExports::GdipStartPathFigure(pPath);
-}
-}
-}
-}
-}
-
-void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, 
const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
+void impAddB2DPolygonToGDIPlusGraphicsPathReal(
+Gdiplus::GraphicsPath& rGraphicsPath,
+const basegfx::B2DPolygon& rPolygon,
+bool bNoLineJoin)
 {
 sal_uInt32 nCount(rPolygon.count());
 
@@ -1935,16 +1894,17 @@ void 
impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, const
 const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a));
 const basegfx::B2DPoint 
aCb(rPolygon.getPrevControlPoint(nNextIndex));
 
-Gdiplus::DllExports::GdipAddPathBezier(
-pPath,
-aCurr.getX(), aCurr.getY(),
-aCa.getX(), aCa.getY(),
-aCb.getX(), aCb.getY(),
-aNext.getX(), aNext.getY());
+rGraphicsPath.AddBezier(
+static_cast< Gdiplus::REAL >(aCurr.getX()), static_cast< 
Gdiplus::REAL >(aCurr.getY()),
+static_cast< Gdiplus::REAL >(aCa.getX()), static_cast< 
Gdiplus::REAL >(aCa.getY()),
+static_cast< Gdiplus::REAL >(aCb.getX()), static_cast< 
Gdiplus::REAL >(aCb.getY()),
+static_cast< Gdiplus::REAL >(aNext.getX()), static_cast< 
Gdiplus::REAL >(aNext.getY()));
 }
 else
 {
-Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), 
aCurr.getY(), aNext.getX(), aNext.getY());
+rGraphicsPath.AddLine(
+static_cast< Gdiplus::REAL >(aCurr.getX()), static_cast< 
Gdiplus::REAL >(aCurr.getY()),
+static_cast< Gdiplus::REAL >(aNext.getX()), static_cast< 
Gdiplus::REAL >(aNext.getY()));
 }
 
 if(a + 1 < nEdgeCount)
@@ -1953,7 +1913,7 @@ void 
impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, const
 
 if(bNoLineJoin)
 {
-Gdiplus::DllExports::GdipStartPathFigure(pPath);
+rGraphicsPath.StartFigure();
 }
 }
 }
@@ -1966,33 +1926,32 @@ bool WinSalGraphicsImpl::drawPolyPolygon( const 
basegfx::B2DPolyPolygon& rPolyPo
 
 if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 

[Libreoffice-commits] core.git: vcl/win

2016-03-21 Thread Tomofumi Yagi
 vcl/win/gdi/winlayout.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 526790bc2386520a4644a1c8e72e84cd4f10c42f
Author: Tomofumi Yagi 
Date:   Sat Mar 19 13:29:44 2016 +0900

fix windows 64bit build on vs2015

Visual Studio 2015 will report as follows at the time of 64bit build.

/core/vcl/win/gdi/winlayout.cxx(3972): error C2397:
conversion from 'long' to 'FLOAT' requires a narrowing.

Change-Id: I1a96bd9244c693a3d41b4bf4c2df80ad3b106adc
Reviewed-on: https://gerrit.libreoffice.org/23367
Tested-by: Jenkins 
Reviewed-by: jan iversen 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 572f6a9..e073a01 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3967,7 +3967,9 @@ bool D2DWriteTextOutRenderer::DrawGlyphs(const Point & 
origin, uint16_t * pGid,
 {
 std::copy(pGid, pGidEnd, glyphIndices);
 std::copy_n(pAdvances, nGlyphs, glyphAdvances);
-std::transform(pOffsets, pOffsets + nGlyphs, glyphOffsets, 
[](Point ) { return DWRITE_GLYPH_OFFSET{ o.X(), o.Y() }; });
+std::transform(pOffsets, pOffsets + nGlyphs,
+glyphOffsets,
+[](Point ) { return 
DWRITE_GLYPH_OFFSET{static_cast(o.X()), static_cast(o.Y()) }; });
 D2D1_POINT_2F baseline = { origin.X() - bounds.Left(), origin.Y() 
- bounds.Top() };
 DWRITE_GLYPH_RUN glyphs = {
 mpFontFace,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-19 Thread Gurkaran
 vcl/win/gdi/salnativewidgets-luna.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 157c60a7077098bb9b142e825fee8bec18d015db
Author: Gurkaran 
Date:   Sat Mar 19 18:35:05 2016 -0600

Remove commented-out code

Follow-up to 2f7815ab6b3f93f7f9712d403846f1874b8e3a2b

Change-Id: Ifd2dca4105caf5693a8ae17d26f950a3aef418bd

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 7b4f5fd..d9db4a0 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -666,8 +666,6 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
 }
 if( nType == CTRL_SPINBOX )
 {
-//rc.right--;
-//rc.bottom--;
 if( nPart == PART_ALL_BUTTONS )
 {
 if( aValue.getType() == CTRL_SPINBUTTONS )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-19 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit f6a0ed20ba79c72788fa029fe99572e2d5a666e7
Author: Tor Lillqvist 
Date:   Thu Mar 17 10:00:04 2016 +0200

Add a humble wish

Change-Id: Ie94f991acebda4e9074dba46d7bd65b433e0ce9b

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index f4f8d94..d67221e 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -1516,7 +1516,9 @@ bool SimpleWinLayout::CacheGlyphs(SalGraphics& rGraphics) 
const
 int nCodePoint;
 if (i < mnGlyphCount-1 && rtl::isHighSurrogate(mpOutGlyphs[i]) && 
rtl::isLowSurrogate(mpOutGlyphs[i+1]))
 {
-#if 1
+#if 1 // Don't remove the #else branch in case somebody wants to
+  // continue trying to figure out why sequential non-BMP glyphs
+  // get scribbled on top of each others if caching is used.
 return false;
 #else
 nCodePoint = rtl::combineSurrogates(mpOutGlyphs[i], 
mpOutGlyphs[i+1]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-19 Thread Tim Eves
 vcl/win/gdi/winlayout.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 0eea1465a06119903fca5f5b6dfe5b05a80546ba
Author: Tim Eves 
Date:   Fri Mar 18 14:19:50 2016 +0700

Fix failure to print when using the D2DWrite path

It seems that D2D1DCRenderrTarget cannot bind to a DC on a printer
device. Now whenever that attempt to bind the DC fails we run the
legacy API path as a fallback.

Change-Id: I6ad8d82e5280fd2dcf669310bab0f5bfc23a138a
Reviewed-on: https://gerrit.libreoffice.org/23366
Tested-by: Jenkins 
Reviewed-by: Martin Hosken 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index d67221e..572f6a9 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3799,15 +3799,13 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout 
const , HDC hDC,
 return false;
 
 if (!BindFont(hDC))
-return false;
-Rectangle bounds;
-bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, 
bounds);
-if (pRectToErase)
 {
-// Isn't this equivalent to simply doing: bounds = *pRectToErase ?
-bounds.Intersection(*pRectToErase);
-bounds.Union(*pRectToErase);
+// If for any reason we can't bind fallback to legacy APIs.
+return ExTextOutRenderer()(rLayout, hDC, pRectToErase, pPos, 
pGetNextGlypInfo);
 }
+
+Rectangle bounds;
+bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, 
bounds);
 succeeded &= BindDC(hDC, bounds);   // Update the bounding rect.
 
 ID2D1SolidColorBrush* pBlackBrush = NULL;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-18 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit e3d0e8069e3bd82831b0070f70052f2202180192
Author: Tor Lillqvist 
Date:   Wed Mar 16 16:51:09 2016 +0200

tdf#97319: Give up on caching non-BMP glyphs

I can't figure out why successive non-BMP glyphs in the bugdoc get
drawn on top of each others. So bail out...

Change-Id: I9c6241916347ec31d616e5cbf00bf3b1869edba2

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index fa16339..f4f8d94 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -730,7 +730,10 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
 if( bSurrogate )
 nCharCode = 0x1 + ((pCodes[0] - 0xD800) << 10) + 
(pCodes[1] - 0xDC00);
 else // or fall back to a replacement character
+{
+// FIXME: Surely this is an error situation that should not 
happen?
 nCharCode = '?';
+}
 }
 
 // get the advance width for the current UTF-32 code point
@@ -1513,8 +1516,12 @@ bool SimpleWinLayout::CacheGlyphs(SalGraphics& 
rGraphics) const
 int nCodePoint;
 if (i < mnGlyphCount-1 && rtl::isHighSurrogate(mpOutGlyphs[i]) && 
rtl::isLowSurrogate(mpOutGlyphs[i+1]))
 {
+#if 1
+return false;
+#else
 nCodePoint = rtl::combineSurrogates(mpOutGlyphs[i], 
mpOutGlyphs[i+1]);
 i++;
+#endif
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-15 Thread Christian Lohmaier
 vcl/win/gdi/winlayout.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 53f645a9c959d93bde9230862c415c4ab2e3817b
Author: Christian Lohmaier 
Date:   Tue Mar 15 23:38:33 2016 +0100

fix windows build

34a7b51ea482d4487d4fb8e61cde18aa1ff9b8ff (for 5-1) auto → size_t made
32bit happy, but win64bit still failed with:
error C2784: ´_Ty std::min(std::initializer_list<_Elem>,_Pr)´ : could
not deduce template argument for ´std::initializer_list<_Elem>´ from
´__int64´

Change-Id: Ib44840f692f1bcdea90decfe443c6eb72806002a

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index a5ca8e5..fa16339 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3955,8 +3955,8 @@ bool D2DWriteTextOutRenderer::DrawGlyphs(const Point & 
origin, uint16_t * pGid,
 DWRITE_GLYPH_OFFSET glyphOffsets[MAX_GLYPHS] = { { 0.0f, 0.0f }, };
 
 mpRT->BeginDraw();
-for (auto nGlyphs = std::min(pGidEnd - pGid, MAX_GLYPHS); pGid != 
pGidEnd;
-pGid += nGlyphs, nGlyphs = std::min(pGidEnd - pGid, 
MAX_GLYPHS))
+for (size_t nGlyphs = std::min(static_cast(pGidEnd - pGid), 
MAX_GLYPHS); pGid != pGidEnd;
+pGid += nGlyphs, nGlyphs = 
std::min(static_cast(pGidEnd - pGid), MAX_GLYPHS))
 {
 std::copy(pGid, pGidEnd, glyphIndices);
 std::copy_n(pAdvances, nGlyphs, glyphAdvances);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-15 Thread Michael Meeks
 vcl/win/gdi/winlayout.cxx |   30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

New commits:
commit 04ce76c7211295865e750a2441f94c267ba2f51c
Author: Michael Meeks 
Date:   Tue Feb 23 15:01:03 2016 +

vcl: improve opengl glyph cache debugging.

Show cutting rectangles, base-lines, and count box widths.

Change-Id: Ic6a08c4c029d6b576ea55479bbf6293accae6f15
Reviewed-on: https://gerrit.libreoffice.org/23251
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 9aa23ac..a5ca8e5 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -280,17 +280,34 @@ void DumpGlyphBitmap(HDC hDC, const 
OpenGLGlyphCacheChunk& rChunk)
 SAL_INFO("vcl.gdi.opengl", "Bitmap " << hBitmap << ": " << aBitmap.bmWidth 
<< "x" << aBitmap.bmHeight << ":");
 
 std::ostringstream sLine("\n", std::ios_base::ate);
+std::ostringstream sScale;
+long nPrintWidth = std::min(125l, aBitmap.bmWidth);
 for (long y = 0; y < aBitmap.bmHeight; y++)
 {
 if (y == rChunk.mnBaselineOffset + rChunk.getExtraOffset())
-sLine << "-";
-else
-sLine << ColorFor(GetPixel(hDC, 0, y));
-for (long x = 1; x < std::min(75l, aBitmap.bmWidth); x++)
+sLine << "--\n";
+long n = 0;
+for (long x = 0; x < nPrintWidth; x++)
+{
+// delimit.
+for (size_t i = 0; i < rChunk.maLocation.size(); ++i)
+{
+if (x == rChunk.maLocation[i].Right())
+{
+n = 0;
+sLine << '|';
+if (y == 0)
+sScale << ' ';
+break;
+}
+}
 sLine << ColorFor(GetPixel(hDC, x, y));
-if (y < aBitmap.bmHeight - 1)
-sLine << "\n";
+if (y == 0)
+sScale << (n++ % 10);
+}
+sLine << "\n";
 }
+sLine << sScale.str();
 SAL_INFO("vcl.gdi.opengl", sLine.str());
 }
 
@@ -565,7 +582,6 @@ bool WinFontInstance::AddChunkOfGlyphs(bool 
bRealGlyphIndices, int nGlyphIndex,
 #ifdef SAL_LOG_INFO
 SAL_INFO("vcl.gdi.opengl", "this=" << this << " now: " << 
maOpenGLGlyphCache);
 DumpGlyphBitmap(aDC.getCompatibleHDC(), aChunk);
-
 {
 std::ostringstream sLine;
 for (int i = 0; i < nCount; i++)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-14 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 41c57363faf857a41a4fc61079c32282dda970ab
Author: Tor Lillqvist 
Date:   Mon Mar 14 20:20:49 2016 +0200

Bin a few pointless static const integers

Change-Id: I59f2547523129155b9d17699cc985fe0bd78f7e6

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index ffa0b3f..56df894 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -2317,9 +2317,8 @@ int UniscribeLayout::GetNextGlyphs( int nLen, 
sal_GlyphId* pGlyphs, Point& rPos,
 {
 // create and reset the new array
 mpGlyphs2Chars = new int[ mnGlyphCapacity ];
-static const int CHARPOS_NONE = -1;
 for( int i = 0; i < mnGlyphCount; ++i )
-mpGlyphs2Chars[i] = CHARPOS_NONE;
+mpGlyphs2Chars[i] = -1;
 // calculate the char->glyph mapping
 for( nItem = 0; nItem < mnItemCount; ++nItem )
 {
@@ -2362,7 +2361,7 @@ int UniscribeLayout::GetNextGlyphs( int nLen, 
sal_GlyphId* pGlyphs, Point& rPos,
 // use a heuristic to fill the gaps in the glyphs2chars array
 c = !rVI.IsRTL() ? rVI.mnMinCharPos : rVI.mnEndCharPos - 1;
 for( int i = rVI.mnMinGlyphPos; i < rVI.mnEndGlyphPos; ++i ) {
-if( mpGlyphs2Chars[i] == CHARPOS_NONE )
+if( mpGlyphs2Chars[i] == -1 )
 mpGlyphs2Chars[i] = c;
 else
 c = mpGlyphs2Chars[i];
@@ -2573,11 +2572,10 @@ void UniscribeLayout::DropGlyph( int nStartx8 )
 
 void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 {
-static const WCHAR cDroppedGlyph = DROPPED_OUTGLYPH;
 int i;
 // if there are no dropped glyphs don't bother
 for( i = 0; i < mnGlyphCount; ++i )
-if( mpOutGlyphs[ i ] == cDroppedGlyph )
+if( mpOutGlyphs[ i ] == DROPPED_OUTGLYPH )
 break;
 if( i >= mnGlyphCount )
 return;
@@ -2614,7 +2612,7 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 for( i = rVI.mnMinCharPos; i < rVI.mnEndCharPos; ++i )
 {
 int j = mpLogClusters[ i ] + rVI.mnMinGlyphPos;
-if( mpOutGlyphs[ j ] == cDroppedGlyph )
+if( mpOutGlyphs[ j ] == DROPPED_OUTGLYPH )
 mpCharWidths[ i ] = 0;
 }
 
@@ -2622,7 +2620,7 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 int nMinGlyphPos, nEndGlyphPos, nOrigMinGlyphPos = rVI.mnMinGlyphPos;
 GetItemSubrange( rVI, nMinGlyphPos, nEndGlyphPos );
 i = nMinGlyphPos;
-while( (i < nEndGlyphPos) && (mpOutGlyphs[i] == cDroppedGlyph) )
+while( (i < nEndGlyphPos) && (mpOutGlyphs[i] == DROPPED_OUTGLYPH) )
 {
 rVI.mnMinGlyphPos = ++i;
 }
@@ -2641,18 +2639,18 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 {
 // drop any glyphs in the visual item outside the range
 for (i = nOrigMinGlyphPos; i < nMinGlyphPos; i++)
-mpOutGlyphs[ i ] = cDroppedGlyph;
+mpOutGlyphs[ i ] = DROPPED_OUTGLYPH;
 rVI.mnMinGlyphPos = i = nOrigMinGlyphPos;
 }
 
 // handle dropped glyphs in the middle of visual item
 for(; i < nEndGlyphPos; ++i )
-if( mpOutGlyphs[ i ] == cDroppedGlyph )
+if( mpOutGlyphs[ i ] == DROPPED_OUTGLYPH )
 break;
 int j = i;
 while( ++i < nEndGlyphPos )
 {
-if( mpOutGlyphs[ i ] == cDroppedGlyph )
+if( mpOutGlyphs[ i ] == DROPPED_OUTGLYPH )
 continue;
 mpOutGlyphs[ j ]  = mpOutGlyphs[ i ];
 mpGlyphOffsets[ j ]   = mpGlyphOffsets[ i ];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-14 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   22 --
 1 file changed, 22 deletions(-)

New commits:
commit 9082f204a91324523287dabe9e288c1fa0d43aa1
Author: Tor Lillqvist 
Date:   Mon Mar 14 19:58:51 2016 +0200

Bin leftover #if 0 snippet

Change-Id: I848a5dca6d18c3df57f563bb137efaed2e000461

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index c8856dc..ffa0b3f 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3752,27 +3752,6 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout 
const , HDC hDC,
 
 if (!BindFont(hDC))
 return false;
-#if 0
-// Gather glyph positioning data.
-std::vector indices;
-std::vector advances;
-std::vector offsets;
-sal_GlyphId nLGlyph;
-DeviceCoordinate nAdv;
-while (rLayout.GetNextGlyphs(1, , *pPos, *pGetNextGlypInfo, ) 
== 1)
-{
-indices.push_back(nLGlyph);
-advances.push_back(nAdv);
-offsets.push_back(Point(0,pPos->Y()));
-}
-
-// Find the bounds
-DrawGlyphs(rLayout.DrawBase(), indices.data(), 
indices.data()+indices.size(), advances.data(), offsets.data());
-
-ReleaseFont();
-
-return false;
-#else
 Rectangle bounds;
 bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, 
bounds);
 if (pRectToErase)
@@ -3834,7 +3813,6 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const 
, HDC hDC,
 CreateRenderTarget();
 
 return (succeeded && nGlyphs >= 1 && pRectToErase);
-#endif
 }
 
 bool D2DWriteTextOutRenderer::BindFont(HDC hDC)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-11 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 67ef33f914eae7d9752cd7d354e76210f33f59f0
Author: Tor Lillqvist 
Date:   Fri Mar 11 15:07:50 2016 +0200

Passing a string to a std::ostringstream ctor is tricky

For it to do what one typically wants, also std::ios_base::ate is
needed.

Change-Id: If520c98cbd4d3913b644c2137623c2b7e9c5c708

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 31168bc..ab04e70 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -179,7 +179,7 @@ void DumpGlyphBitmap(HDC hDC)
 
 SAL_INFO("vcl.gdi.opengl", "Bitmap " << hBitmap << ": " << aBitmap.bmWidth 
<< "x" << aBitmap.bmHeight << ":");
 
-std::ostringstream sLine("\n");
+std::ostringstream sLine("\n", std::ios_base::ate);
 for (long y = 0; y < aBitmap.bmHeight; y++)
 {
 for (long x = 0; x < std::min(75l, aBitmap.bmWidth); x++)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-10 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit a076feda8e6541ce611866e3f20f65648ec2b50b
Author: Tor Lillqvist 
Date:   Thu Mar 10 12:14:01 2016 +0200

Follow the coding style of surrounding code

Change-Id: I80a2d935d92c8330f3815b6e79ccc58bc39541b0

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 691901e..31168bc 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3673,8 +3673,10 @@ bool D2DWriteTextOutRenderer::InitModules()
 
 void D2DWriteTextOutRenderer::CleanupModules()
 {
-if (mmD2d1) FreeLibrary(mmD2d1);
-if (mmDWrite)   FreeLibrary(mmDWrite);
+if (mmD2d1)
+FreeLibrary(mmD2d1);
+if (mmDWrite)
+FreeLibrary(mmDWrite);
 
 mmD2d1 = nullptr;
 mmDWrite = nullptr;
@@ -3741,10 +3743,14 @@ D2DWriteTextOutRenderer::D2DWriteTextOutRenderer()
 
 D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
 {
-if (mpRT)mpRT->Release();
-if (mpGdiInterop)mpGdiInterop->Release();
-if (mpDWriteFactory) mpDWriteFactory->Release();
-if (mpD2DFactory)mpD2DFactory->Release();
+if (mpRT)
+mpRT->Release();
+if (mpGdiInterop)
+mpGdiInterop->Release();
+if (mpDWriteFactory)
+mpDWriteFactory->Release();
+if (mpD2DFactory)
+mpD2DFactory->Release();
 
 CleanupModules();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-09 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 2823f7bd4898ab9ebc7ea2937b9db235dc52ae84
Author: Tor Lillqvist 
Date:   Wed Mar 9 19:45:41 2016 +0200

Make the new D2D Graphite rendering work also in the OpenGL case

It used to render just black boxes.

The change in DrawTextImpl() semantics from
61085083e4a5060ba7e2135818264d63c6da13c2 was not properly implemented
in the new Graphite code. The return value is not some kind of
"success" indicator, but tells the caller whether to continue the loop
at that level.

We do need to call FillRect() to fill the requested rectangle of the
HDC with white. On the other hand, the call to Clear() is not needed
and in fact makes no text show up.

(I now see that that same code snippet that calls FillRect() is used
in all the DrawTextImpl() implementations, so it should be factored
out to the call site in WinLayout::DrawText().)

Change-Id: If0533ea1edf065b06ae888c6e57c026f447bcf78

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index cccae83..39d6fd7 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3768,6 +3768,12 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout 
const , HDC hDC,
 const Rectangle* pRectToErase,
 Point* pPos, int* pGetNextGlypInfo)
 {
+if (pRectToErase)
+{
+RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left() + pRectToErase->GetWidth(), pRectToErase->Top() + 
pRectToErase->GetHeight() };
+FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
+}
+
 if (!Ready())
 return false;
 
@@ -3794,18 +3800,15 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout 
const , HDC hDC,
 succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetTextColor(hDC)), 
));
 
 HRESULT hr = S_OK;
+int nGlyphs = 0;
 if (succeeded)
 {
-if (pRectToErase)
-mpRT->Clear(D2D1::ColorF(D2D1::ColorF::White));
-
 const int MAX_GLYPHS = 2;
 sal_GlyphId glyphIntStr[MAX_GLYPHS];
 UINT16 glyphIndices[MAX_GLYPHS];
 long   glyphIntAdv[MAX_GLYPHS];
 FLOAT  glyphAdvances[MAX_GLYPHS];
 DWRITE_GLYPH_OFFSET glyphOffsets[MAX_GLYPHS] = { { 0.0f, 0.0f }, };
-int nGlyphs = 0;
 
 mpRT->BeginDraw();
 do
@@ -3844,7 +3847,7 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const 
, HDC hDC,
 if (hr == D2DERR_RECREATE_TARGET)
 CreateRenderTarget();
 
-return (SUCCEEDED(hr) && succeeded && pRectToErase);
+return (succeeded && nGlyphs >= 1 && pRectToErase);
 }
 
 bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** 
ppFontFace, float * lfSize) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-03-03 Thread Michael Meeks
 vcl/win/gdi/salfont.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit a419ef186038e92f27ac5e201e231578867a66e9
Author: Michael Meeks 
Date:   Thu Mar 3 11:31:03 2016 +

tdf#98380 - opengl - get font anti-aliasing right.

Change-Id: I087c4939c19bc5966da45cb848d71e95ac982e33
Reviewed-on: https://gerrit.libreoffice.org/22854
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 7cfff0e..a47f3d1 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "fontsubset.hxx"
 #include "outdev.h"
@@ -1303,6 +1304,15 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
 rLogFont.lfPitchAndFamily = pWinFontData->GetPitchAndFamily();
 }
 
+static BYTE nDefaultQuality = NONANTIALIASED_QUALITY;
+if (nDefaultQuality == NONANTIALIASED_QUALITY)
+{
+if (OpenGLWrapper::isVCLOpenGLEnabled())
+nDefaultQuality = ANTIALIASED_QUALITY;
+else
+nDefaultQuality = DEFAULT_QUALITY;
+}
+
 rLogFont.lfWeight  = ImplWeightToWin( pFont->GetWeight() );
 rLogFont.lfHeight  = (LONG)-pFont->mnHeight;
 rLogFont.lfWidth   = (LONG)pFont->mnWidth;
@@ -1312,7 +1322,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
 rLogFont.lfEscapement  = pFont->mnOrientation;
 rLogFont.lfOrientation = rLogFont.lfEscapement;
 rLogFont.lfClipPrecision   = CLIP_DEFAULT_PRECIS;
-rLogFont.lfQuality = DEFAULT_QUALITY;
+rLogFont.lfQuality = nDefaultQuality;
 rLogFont.lfOutPrecision= OUT_TT_PRECIS;
 if ( pFont->mnOrientation )
 rLogFont.lfClipPrecision |= CLIP_LH_ANGLES;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-01-28 Thread Michael Stahl
 vcl/win/gdi/winlayout.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b9160c2511287223d7e014de3134fde917b9320e
Author: Michael Stahl 
Date:   Thu Jan 28 13:20:27 2016 +0100

vcl: try to fix windows build

There are at least 3 different definitions of SCRIPT_CONTROL, apparently
newer versions of Windows SDK append flags at the end, so just
initialize it with memset.

Change-Id: I2e5f957bff1002629bf012e3effd3f1d281da3e1

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 856f70d..bc03845 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -1695,7 +1695,9 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
 aScriptState.fDigitSubstitute   = bool(rArgs.mnFlags & 
SalLayoutFlags::SubstituteDigits);
 aScriptState.fArabicNumContext  = aScriptState.fDigitSubstitute & 
aScriptState.uBidiLevel;
 DWORD nLangId = 0;  // TODO: get language from font
-SCRIPT_CONTROL aScriptControl = 
{nLangId,false,false,false,false,false,false,false,false,false,false,0};
+SCRIPT_CONTROL aScriptControl;
+memset(, 0, sizeof(aScriptControl));
+aScriptControl.uDefaultLanguage = nLangId;
 aScriptControl.fNeutralOverride = aScriptState.fOverrideDirection;
 aScriptControl.fContextDigits   = bool(rArgs.mnFlags & 
SalLayoutFlags::SubstituteDigits);
 aScriptControl.fMergeNeutralItems = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-01-26 Thread Matteo Casalin
 vcl/win/gdi/salprn.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ccd681dabd75b14feaf410640cddc20862316cb3
Author: Matteo Casalin 
Date:   Tue Jan 26 22:23:51 2016 +0100

Blind fix for Windows

Change-Id: Icd28c3126eb764187788f3726bfa3a5db54ba7e6

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index dbe8533..ae2d923 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -722,7 +722,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 }
 }
 
-static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* 
pSetupData, sal_uLong nFlags )
+static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* 
pSetupData, JobSetFlags nFlags )
 {
 if ( !pSetupData || !pSetupData->mpDriverData )
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-01-19 Thread Tor Lillqvist
 vcl/win/gdi/gdiimpl.cxx |   16 
 1 file changed, 16 deletions(-)

New commits:
commit 94f7321e66b136fdff880a7c89eaebbc0e6782f2
Author: Tor Lillqvist 
Date:   Tue Jan 19 14:13:41 2016 +0200

Win9x has been dead and forgotten for a long time

Change-Id: I75c58e81c27edd65239c6e033170a432735a81e4

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 6cb9e3e..5c13028 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -73,7 +73,6 @@
 #define DMAP( _def_nVal, _def_nThres )  
((pDitherDiff[_def_nVal]>(_def_nThres))?pDitherHigh[_def_nVal]:pDitherLow[_def_nVal])
 
 #define SAL_POLY_STACKBUF   32
-#define USE_GDI_BEZIERS
 
 namespace {
 
@@ -1775,22 +1774,15 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 
nPoly, const sal_uInt32* pP
 
 bool WinSalGraphicsImpl::drawPolyLineBezier( sal_uInt32 nPoints, const 
SalPoint* pPtAry, const BYTE* pFlgAry )
 {
-#ifdef USE_GDI_BEZIERS
-// for NT, we can handover the array directly
 static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 ImplRenderPath( mrParent.getHDC(), nPoints, pPtAry, pFlgAry );
 
 return true;
-#else
-return false;
-#endif
 }
 
 bool WinSalGraphicsImpl::drawPolygonBezier( sal_uInt32 nPoints, const 
SalPoint* pPtAry, const BYTE* pFlgAry )
 {
-#ifdef USE_GDI_BEZIERS
-// for NT, we can handover the array directly
 static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 POINT   aStackAry1[SAL_POLY_STACKBUF];
@@ -1831,16 +1823,11 @@ bool WinSalGraphicsImpl::drawPolygonBezier( sal_uInt32 
nPoints, const SalPoint*
 }
 
 return bRet;
-#else
-return false;
-#endif
 }
 
 bool WinSalGraphicsImpl::drawPolyPolygonBezier( sal_uInt32 nPoly, const 
sal_uInt32* pPoints,
  const SalPoint* const* pPtAry, 
const BYTE* const* pFlgAry )
 {
-#ifdef USE_GDI_BEZIERS
-// for NT, we can handover the array directly
 static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 sal_uLong nCurrPoly, nTotalPoints;
@@ -1885,9 +1872,6 @@ bool WinSalGraphicsImpl::drawPolyPolygonBezier( 
sal_uInt32 nPoly, const sal_uInt
 }
 
 return bRet;
-#else
-return false;
-#endif
 }
 
 void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GpPath *pPath, const 
basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2016-01-06 Thread Tor Lillqvist
 vcl/win/gdi/salfont.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 2b9ec36ed7cb3b77d8a5fde798544cf5a7f9ec3e
Author: Tor Lillqvist 
Date:   Wed Jan 6 10:45:08 2016 +0200

Bin unnecessary variable

Change-Id: I140785838f2665b735b288d689c873502d1d1cfb

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 1f83835..26ade82 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1817,8 +1817,6 @@ bool WinSalGraphics::AddTempDevFont( 
PhysicalFontCollection* pFontCollection,
 if( !ImplAddTempFont( *GetSalData(), rFontFileURL ) )
 return false;
 
-UINT nPreferredCharSet = DEFAULT_CHARSET;
-
 // create matching FontData struct
 aDFA.SetSymbolFlag(false); // TODO: how to know it without accessing the 
font?
 aDFA.SetFamilyType(FAMILY_DONTKNOW);
@@ -1837,7 +1835,7 @@ bool WinSalGraphics::AddTempDevFont( 
PhysicalFontCollection* pFontCollection,
 */
 
 ImplWinFontData* pFontData = new ImplWinFontData( aDFA, 0,
-sal::static_int_cast(nPreferredCharSet),
+sal::static_int_cast(DEFAULT_CHARSET),
 sal::static_int_cast(TMPF_VECTOR|TMPF_TRUETYPE) );
 pFontData->SetFontId( reinterpret_cast(pFontData) );
 pFontCollection->Add( pFontData );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-30 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 7368803e540d530a157d3c4234ca5428a44cbc4a
Author: Tor Lillqvist 
Date:   Mon Dec 21 18:36:07 2015 +0200

tdf#96420: Avoid drawing ugly black boxes on top of replacement glyphs

When UniscribeLayout::DrawText() was used from MultiSalLayout to draw
the base layout level after having drawn fallback glyphs, it
mis-rendered the runs that contained the missing glyphs. Avoid this by
handing the pRectToErase parameter also here.

Change-Id: Ib40aa9e9e60d72db1cdd331ba03ae8230aadbba8

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index f46ae47..75d3467 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -1777,10 +1777,16 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 }
 
 bool UniscribeLayout::DrawTextImpl(HDC hDC,
-   const Rectangle* /* pRectToErase */,
+   const Rectangle* pRectToErase,
Point* /* pPos */,
int* /* pGetNextGlypInfo */) const
 {
+if (pRectToErase)
+{
+RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left()+pRectToErase->GetWidth(), 
pRectToErase->Top()+pRectToErase->GetHeight() };
+FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
+}
+
 HFONT hOrigFont = DisableFontScaling();
 
 int nBaseClusterOffset = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-18 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   79 --
 vcl/win/gdi/winlayout.hxx |6 +--
 2 files changed, 52 insertions(+), 33 deletions(-)

New commits:
commit 61085083e4a5060ba7e2135818264d63c6da13c2
Author: Tor Lillqvist 
Date:   Fri Dec 18 14:38:27 2015 +0200

tdf#95054: Make sure glyphs alpha blend properly in the Graphite+OpenGL case

The problem apparently was that the GraphiteWinLayout::DrawTextImpl()
function drew each glyph using a separate call to ExtTextOutW().  That
mishandled anti-aliased glyphs (alpha), somewhat in the way as
described in the nice long comment (thanks kendy!) in
WinLayout::DrawText().

The irony here is that in the case of Graphite fonts and OpenGL, it is
exactly from that code block in WinLayout::DrawText() that
GraphiteWinLayout::DrawTextImpl() gets called, and in that situation
it itself runs into the same or similar problem as the calling code
wants to avoid for the run as a whole. It draws each glyph separately,
and subsequent glyphs will overwrite the rightmost pixels of the
earlier one instead of blend properly. Or something like that.

As a solution, change the interface of DrawTextImpl() so that instead
of being called once to draw a run of text, it might draw just a part
of the run, and in that case expects to be called repeatedly to draw
the whole text.

The GraphiteWinLayout::DrawTextImpl() implementation does it like this
in the case of using OpenGL (as indicated by the presence of a
non-null pRectToErase, as added in
b7842c93dc06b831d3fa649410ed847358ce9d17 for tdf#95648). The end
result is that it draws one glyph at a time into the DC for the bitmap
allocated in the caller, WinLayout::DrawText(). The caller uses that
bitmap as a texture and blends it into the actual destination,
separately for each glyph.

For non-Graphite fonts, or when not using OpenGL, nothing should
change. No repeated DrawTextImpl calls are done to iterate over a run.

Change-Id: Ib7adc30665fc7804913fd2f8886c5b29d9ca42c4

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index a1cdf14..f46ae47 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -566,7 +566,10 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 if (!mbUseOpenGL)
 {
 // no OpenGL, just classic rendering
-DrawTextImpl(hDC, NULL);
+Point aPos(0, 0);
+int nGetNextGlypInfo(0);
+bool bContinue = DrawTextImpl(hDC, NULL, , );
+assert(!bContinue);
 }
 else if (CacheGlyphs(rGraphics) &&
  DrawCachedGlyphs(rGraphics))
@@ -607,40 +610,49 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 Rectangle aRect;
 GetBoundRect(rGraphics, aRect);
 
-OpenGLCompatibleDC aDC(rGraphics, aRect.Left(), aRect.Top(), 
aRect.GetWidth(), aRect.GetHeight());
+WinOpenGLSalGraphicsImpl *pImpl = 
dynamic_cast(rWinGraphics.mpImpl.get());
 
-// we are making changes to the DC, make sure we got a new one
-assert(aDC.getCompatibleHDC() != hDC);
+if (pImpl)
+{
+pImpl->PreDraw();
 
-// setup the hidden DC with black color and white background, we will
-// use the result of the text drawing later as a mask only
-HFONT hOrigFont = SelectFont(aDC.getCompatibleHDC(), mhFont);
+Point aPos(0, 0);
+int nGetNextGlypInfo(0);
+while (true)
+{
+OpenGLCompatibleDC aDC(rGraphics, aRect.Left(), aRect.Top(), 
aRect.GetWidth(), aRect.GetHeight());
 
-SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0));
-SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255));
+// we are making changes to the DC, make sure we got a new one
+assert(aDC.getCompatibleHDC() != hDC);
 
-UINT nTextAlign = GetTextAlign(hDC);
-SetTextAlign(aDC.getCompatibleHDC(), nTextAlign);
+// setup the hidden DC with black color and white background, 
we will
+// use the result of the text drawing later as a mask only
+HFONT hOrigFont = SelectFont(aDC.getCompatibleHDC(), mhFont);
 
-// the actual drawing
-DrawTextImpl(aDC.getCompatibleHDC(), );
+SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0));
+SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255));
 
-COLORREF color = GetTextColor(hDC);
-SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), 
GetBValue(color));
+UINT nTextAlign = GetTextAlign(hDC);
+SetTextAlign(aDC.getCompatibleHDC(), nTextAlign);
 
-WinOpenGLSalGraphicsImpl *pImpl = 
dynamic_cast(rWinGraphics.mpImpl.get());
-if (pImpl)
-{
-   

[Libreoffice-commits] core.git: vcl/win

2015-12-17 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   14 ++
 vcl/win/gdi/winlayout.hxx |6 +++---
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit b7842c93dc06b831d3fa649410ed847358ce9d17
Author: Tor Lillqvist 
Date:   Thu Dec 17 15:14:49 2015 +0200

tdf#95648: Erase the OpenGLCompatibleDC to white before drawing text into it

For some reason this is needed in the case of GraphiteWinLayout and
OpenGL. Otherwise when a space glyph is "drawn" into a space that is
wider than the nominal width of the space glyph, we get two black
rectangles surrounding the white space "glyph".

Change-Id: Ifb4ea00d9e5f078518ac97d7dd18694088aa1cdf

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 0bed284..a1cdf14 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -566,7 +566,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 if (!mbUseOpenGL)
 {
 // no OpenGL, just classic rendering
-DrawTextImpl(hDC);
+DrawTextImpl(hDC, NULL);
 }
 else if (CacheGlyphs(rGraphics) &&
  DrawCachedGlyphs(rGraphics))
@@ -623,7 +623,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 SetTextAlign(aDC.getCompatibleHDC(), nTextAlign);
 
 // the actual drawing
-DrawTextImpl(aDC.getCompatibleHDC());
+DrawTextImpl(aDC.getCompatibleHDC(), );
 
 COLORREF color = GetTextColor(hDC);
 SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), 
GetBValue(color));
@@ -1764,7 +1764,7 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 }
 }
 
-void UniscribeLayout::DrawTextImpl(HDC hDC) const
+void UniscribeLayout::DrawTextImpl(HDC hDC, const Rectangle* /* pRectToErase 
*/) const
 {
 HFONT hOrigFont = DisableFontScaling();
 
@@ -2801,8 +2801,14 @@ void  GraphiteWinLayout::AdjustLayout(ImplLayoutArgs& 
rArgs)
 maImpl.AdjustLayout(rArgs);
 }
 
-void GraphiteWinLayout::DrawTextImpl(HDC hDC) const
+void GraphiteWinLayout::DrawTextImpl(HDC hDC, const Rectangle* pRectToErase) 
const
 {
+if (pRectToErase)
+{
+RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left()+pRectToErase->GetWidth(), 
pRectToErase->Top()+pRectToErase->GetHeight() };
+FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
+}
+
 HFONT hOrigFont = DisableFontScaling();
 maImpl.DrawBase() = WinLayout::maDrawBase;
 maImpl.DrawOffset() = WinLayout::maDrawOffset;
diff --git a/vcl/win/gdi/winlayout.hxx b/vcl/win/gdi/winlayout.hxx
index 545d267..db09d1e 100644
--- a/vcl/win/gdi/winlayout.hxx
+++ b/vcl/win/gdi/winlayout.hxx
@@ -53,7 +53,7 @@ public:
 virtual voidDrawText(SalGraphics&) const override;
 
 /// Draw to the provided HDC.
-virtual voidDrawTextImpl(HDC hDC) const = 0;
+virtual voidDrawTextImpl(HDC hDC, const Rectangle* pRectToErase) 
const = 0;
 
 virtual boolCacheGlyphs(SalGraphics& rGraphics) const = 0;
 virtual boolDrawCachedGlyphs(SalGraphics& rGraphics) const = 0;
@@ -75,7 +75,7 @@ public:
 
 virtual boolLayoutText( ImplLayoutArgs& ) override;
 virtual voidAdjustLayout( ImplLayoutArgs& ) override;
-virtual voidDrawTextImpl(HDC hDC) const override;
+virtual voidDrawTextImpl(HDC hDC, const Rectangle* pRectToErase) const 
override;
 virtual boolCacheGlyphs(SalGraphics& rGraphics) const override;
 virtual boolDrawCachedGlyphs(SalGraphics& rGraphics) const override;
 virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& 
rPos, int&,
@@ -168,7 +168,7 @@ public:
 // used by upper layers
 virtual bool  LayoutText( ImplLayoutArgs& ) override;// first step of 
layout
 virtual void  AdjustLayout( ImplLayoutArgs& ) override;  // adjusting 
after fallback etc.
-virtual void  DrawTextImpl(HDC hDC) const override;
+virtual void  DrawTextImpl(HDC hDC, const Rectangle* pRectToErase) const 
override;
 virtual bool  CacheGlyphs(SalGraphics& rGraphics) const override;
 virtual bool  DrawCachedGlyphs(SalGraphics& rGraphics) const override;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-13 Thread Julien Nabet
 vcl/win/gdi/gdiimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bdafd030e5aabc127fb18229968af1ae061359a8
Author: Julien Nabet 
Date:   Sun Dec 13 11:43:02 2015 +0100

Blind fix for TB Win64Dbg

Regression from 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=1321ae8ceba1801cd75322d6cf51ab53bac86b2a

Change-Id: Iba9e9560e34d9107787d117a7cfff82349b7f933
Reviewed-on: https://gerrit.libreoffice.org/20680
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 8af9909..2d86dbe 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2310,7 +2310,7 @@ bool WinSalGraphicsImpl::drawTransformedBitmap(
 const SalBitmap* pAlphaBitmap)
 {
 assert(dynamic_cast());
-assert(dynamic_cast());
+assert(dynamic_cast(pAlphaBitmap));
 
 const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& 
>(rSourceBitmap);
 const WinSalBitmap* pSalAlpha = static_cast< const WinSalBitmap* 
>(pAlphaBitmap);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-13 Thread Michael Meeks
 vcl/win/gdi/gdiimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 63feac2a3264ead8f52148644b14078a4be5a2b9
Author: Michael Meeks 
Date:   Mon Dec 14 02:38:43 2015 +

Fix drawTransformedBitmap for NULL pAlphaBitmap.

Change-Id: Iff1a0eb8e4b112b874813023551a797320ac0ad5

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 2d86dbe..dc16217 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2310,7 +2310,7 @@ bool WinSalGraphicsImpl::drawTransformedBitmap(
 const SalBitmap* pAlphaBitmap)
 {
 assert(dynamic_cast());
-assert(dynamic_cast(pAlphaBitmap));
+assert(!pAlphaBitmap || dynamic_cast(pAlphaBitmap));
 
 const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& 
>(rSourceBitmap);
 const WinSalBitmap* pSalAlpha = static_cast< const WinSalBitmap* 
>(pAlphaBitmap);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-12 Thread Tomaž Vajngerl
 vcl/win/gdi/salgdi2.cxx |   50 
 1 file changed, 38 insertions(+), 12 deletions(-)

New commits:
commit 917d59a84124d1022bd1912874e7a53c674784f1
Author: Tomaž Vajngerl 
Date:   Sat Dec 12 10:15:34 2015 +0100

tdf#94851 check SalBitmap & convert in all drawBitmap methods

Change-Id: I040dd62737237ad7e016201a798ee42e27853556
Reviewed-on: https://gerrit.libreoffice.org/20656
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx
index aa08d91..91b97db 100644
--- a/vcl/win/gdi/salgdi2.cxx
+++ b/vcl/win/gdi/salgdi2.cxx
@@ -71,17 +71,15 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY,
 nSrcWidth, nSrcHeight, nFlags );
 }
 
-void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap)
+namespace
 {
-if (dynamic_cast(mpImpl.get()) == nullptr &&
-dynamic_cast() == nullptr)
-{
-SalBitmap& rConstBitmap = const_cast(rSalBitmap);
-BitmapBuffer* pRead = rConstBitmap.AcquireBuffer(BITMAP_READ_ACCESS);
 
-std::unique_ptr pWinSalBitmap(new WinSalBitmap());
-pWinSalBitmap->Create(rConstBitmap.GetSize(), 
rConstBitmap.GetBitCount(), BitmapPalette());
-BitmapBuffer* pWrite = 
pWinSalBitmap->AcquireBuffer(BITMAP_WRITE_ACCESS);
+void convertToWinSalBitmap(SalBitmap& rSalBitmap, WinSalBitmap& rWinSalBitmap)
+{
+BitmapBuffer* pRead = rSalBitmap.AcquireBuffer(BITMAP_READ_ACCESS);
+
+rWinSalBitmap.Create(rSalBitmap.GetSize(), rSalBitmap.GetBitCount(), 
BitmapPalette());
+BitmapBuffer* pWrite = 
rWinSalBitmap.AcquireBuffer(BITMAP_WRITE_ACCESS);
 
 sal_uInt8* pSource(pRead->mpBits);
 sal_uInt8* pDestination(pWrite->mpBits);
@@ -92,10 +90,21 @@ void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, 
const SalBitmap& rSal
 pSource += pRead->mnScanlineSize;
 pDestination += pWrite->mnScanlineSize;
 }
-pWinSalBitmap->ReleaseBuffer(pWrite, BITMAP_WRITE_ACCESS);
+rWinSalBitmap.ReleaseBuffer(pWrite, BITMAP_WRITE_ACCESS);
+
+rSalBitmap.ReleaseBuffer(pRead, BITMAP_READ_ACCESS);
+}
 
-rConstBitmap.ReleaseBuffer(pRead, BITMAP_READ_ACCESS);
+} // end anonymous namespace
 
+void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap)
+{
+if (dynamic_cast(mpImpl.get()) == nullptr &&
+dynamic_cast() == nullptr)
+{
+std::unique_ptr pWinSalBitmap(new WinSalBitmap());
+SalBitmap& rConstBitmap = const_cast(rSalBitmap);
+convertToWinSalBitmap(rConstBitmap, *pWinSalBitmap);
 mpImpl->drawBitmap(rPosAry, *pWinSalBitmap.get());
 }
 else
@@ -108,7 +117,24 @@ void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry,
   const SalBitmap& rSSalBitmap,
   const SalBitmap& rSTransparentBitmap )
 {
-mpImpl->drawBitmap( rPosAry, rSSalBitmap, rSTransparentBitmap );
+if (dynamic_cast(mpImpl.get()) == nullptr &&
+dynamic_cast() == nullptr)
+{
+std::unique_ptr pWinSalBitmap(new WinSalBitmap());
+SalBitmap& rConstBitmap = const_cast(rSSalBitmap);
+convertToWinSalBitmap(rConstBitmap, *pWinSalBitmap);
+
+
+std::unique_ptr pWinTransparentSalBitmap(new 
WinSalBitmap());
+SalBitmap& rConstTransparentBitmap = 
const_cast(rSTransparentBitmap);
+convertToWinSalBitmap(rConstTransparentBitmap, 
*pWinTransparentSalBitmap);
+
+mpImpl->drawBitmap(rPosAry, *pWinSalBitmap, *pWinTransparentSalBitmap);
+}
+else
+{
+mpImpl->drawBitmap(rPosAry, rSSalBitmap, rSTransparentBitmap);
+}
 }
 
 bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-12 Thread Tomaž Vajngerl
 vcl/win/gdi/salgdi2.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8227e8bef1c8c6c95627daf5023fe927605d50d2
Author: Tomaž Vajngerl 
Date:   Sat Dec 12 15:00:35 2015 +0100

tdf#94851 quick fix for drawBitmap

Change-Id: Iffc0c9b2215c85760856ab876fa6e04613cb4200
Reviewed-on: https://gerrit.libreoffice.org/20662
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx
index 91b97db..6f0e5d4 100644
--- a/vcl/win/gdi/salgdi2.cxx
+++ b/vcl/win/gdi/salgdi2.cxx
@@ -104,7 +104,7 @@ void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, 
const SalBitmap& rSal
 {
 std::unique_ptr pWinSalBitmap(new WinSalBitmap());
 SalBitmap& rConstBitmap = const_cast(rSalBitmap);
-convertToWinSalBitmap(rConstBitmap, *pWinSalBitmap);
+convertToWinSalBitmap(rConstBitmap, *pWinSalBitmap.get());
 mpImpl->drawBitmap(rPosAry, *pWinSalBitmap.get());
 }
 else
@@ -122,14 +122,14 @@ void WinSalGraphics::drawBitmap( const SalTwoRect& 
rPosAry,
 {
 std::unique_ptr pWinSalBitmap(new WinSalBitmap());
 SalBitmap& rConstBitmap = const_cast(rSSalBitmap);
-convertToWinSalBitmap(rConstBitmap, *pWinSalBitmap);
+convertToWinSalBitmap(rConstBitmap, *pWinSalBitmap.get());
 
 
 std::unique_ptr pWinTransparentSalBitmap(new 
WinSalBitmap());
 SalBitmap& rConstTransparentBitmap = 
const_cast(rSTransparentBitmap);
-convertToWinSalBitmap(rConstTransparentBitmap, 
*pWinTransparentSalBitmap);
+convertToWinSalBitmap(rConstTransparentBitmap, 
*pWinTransparentSalBitmap.get());
 
-mpImpl->drawBitmap(rPosAry, *pWinSalBitmap, *pWinTransparentSalBitmap);
+mpImpl->drawBitmap(rPosAry, *pWinSalBitmap.get(), 
*pWinTransparentSalBitmap.get());
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-07 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |   33 -
 1 file changed, 32 insertions(+), 1 deletion(-)

New commits:
commit e9da0f499c39f9607d67ec344dff1b83dae1bfa2
Author: Tor Lillqvist 
Date:   Mon Dec 7 18:02:33 2015 +0200

Do turn on GL_BLEND for the GLyphy crack

That is what GLyphy's demo_glstate_setup() does, and it does seems to
help a bit.

Change-Id: I03703def86558a8689c427bcbb62cd218b9a111f

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 3afa26e..0bed284 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -1867,6 +1867,20 @@ bool 
UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
 pImpl->PreDraw();
 
 rGraphics.GetOpenGLContext()->UseNoProgram();
+
+#if 0
+HDC hDC = rGraphics.GetOpenGLContext()->getOpenGLWindow().hDC;
+HBITMAP hbitmap = (HBITMAP)GetCurrentObject(hDC, OBJ_BITMAP);
+
+SAL_ DEBUG("hdc=" << hDC << " hbitmap=" << hbitmap);
+if (hbitmap != NULL) {
+BITMAP bm;
+GetObjectW(hbitmap, sizeof(bm), );
+SAL_ DEBUG(" size=" << bm.bmWidth << "x" << bm.bmHeight <<
+  " bpp=" << bm.bmBitsPixel);
+}
+#endif
+
 glUseProgram( mrWinFontEntry.mnGLyphyProgram );
 CHECK_GL_ERROR();
 demo_atlas_set_uniforms( mrWinFontEntry.mpGLyphyAtlas );
@@ -1875,7 +1889,7 @@ bool 
UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
 
 nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_debug" );
 CHECK_GL_ERROR();
-glUniform1f( nLoc, 0 ); // FIXME: Try to get the "debug" thing displayed 
first
+glUniform1f( nLoc, 0 );
 CHECK_GL_ERROR();
 
 nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_contrast" 
);
@@ -1903,6 +1917,23 @@ bool 
UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
 glUniform1f( nLoc, 0 );
 CHECK_GL_ERROR();
 
+glEnable(GL_BLEND);
+CHECK_GL_ERROR();
+glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+CHECK_GL_ERROR();
+
+#if 0
+// glyphy-demo sets sRGB on initially, and there it has a perhaps 
beneficial effect,
+// but doesn't help very much here, if at all
+GLboolean available = false;
+if ((glewIsSupported("GL_ARB_framebuffer_sRGB") || 
glewIsSupported("GL_EXT_framebuffer_sRGB")) &&
+(glGetBooleanv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, ), 
available))
+{
+glEnable(GL_FRAMEBUFFER_SRGB);
+CHECK_GL_ERROR();
+}
+#endif
+
 // FIXME: This code snippet is mostly copied from the one in
 // UniscribeLayout::DrawTextImpl. Should be factored out.
 int nBaseClusterOffset = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-07 Thread Tor Lillqvist
 vcl/win/gdi/winlayout.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 573cd28987614a8893f47f67f05587b7afd86546
Author: Tor Lillqvist 
Date:   Mon Dec 7 14:01:39 2015 +0200

tdf#96070: Just give up on glyph caching for non-horizontal text

Change-Id: I60f54523f927e97d739a4c735e54b2cc3400aff3

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index b5ce57e..3afa26e 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -358,7 +358,8 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, 
const WinLayout& rLayou
 aChunk.mbVertical = false;
 }
 
-if (aChunk.mbVertical && aLogfont.lfEscapement != 2700)
+// Don't even try to handle non-horizontal text
+if (aChunk.mbVertical || aLogfont.lfEscapement != 0)
 return false;
 
 OpenGLCompatibleDC aDC(rGraphics, 0, 0, nBitmapWidth, nBitmapHeight);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-12-01 Thread Tor Lillqvist
 vcl/win/source/gdi/winlayout.cxx |5 +
 vcl/win/source/gdi/winlayout.hxx |1 +
 2 files changed, 6 insertions(+)

New commits:
commit 7ac763db694a956cb1e4f82477a7f9fe993f1f1a
Author: Tor Lillqvist 
Date:   Tue Dec 1 15:13:17 2015 +0200

tdf#95194: We need to set the GF flags in UniscribeLayout::GetNextGlyphs()

The old SimpleWinLayout::GetNextGlyphs() did it.
PDFWriterImpl::drawVerticalGlyphs() expects GF_ROTL etc to be set when
necessary for vertical text when exporting to PDF.

Change-Id: I325d6e9f75a3bc51f24add33dd3bffe7b3c7bee0

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d326006..b5ce57e 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -824,6 +824,8 @@ OUString VisAttrArrayToString(SCRIPT_VISATTR *pVisAttrs, 
int n)
 
 bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
 {
+msTheString = rArgs.mrStr;
+
 // for a base layout only the context glyphs have to be dropped
 // => when the whole string is involved there is no extra context
 typedef std::vector TIntVector;
@@ -1524,6 +1526,9 @@ int UniscribeLayout::GetNextGlyphs( int nLen, 
sal_GlyphId* pGlyphs, Point& rPos,
 }
 
 // update return values
+if( (mnLayoutFlags & SalLayoutFlags::Vertical) &&
+nCharPos != -1 )
+aGlyphId |= GetVerticalFlags( msTheString[nCharPos] );
 *(pGlyphs++) = aGlyphId;
 if( pGlyphAdvances )
 *(pGlyphAdvances++) = nGlyphWidth;
diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
index 664915b..545d267 100644
--- a/vcl/win/source/gdi/winlayout.hxx
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -110,6 +110,7 @@ private:
 
 // string specific info
 // everything is in logical order
+OUStringmsTheString;// Sadly we need it in 
GetNextGlyphs(), to be able to call GetVerticalFlags()
 int mnCharCapacity;
 WORD*   mpLogClusters;  // map from absolute_char_pos to 
relative_glyph_pos
 int*mpCharWidths;   // map from absolute_char_pos to 
char_width
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-11-25 Thread Michael Stahl
 vcl/win/source/gdi/salgdi3.cxx |   70 -
 1 file changed, 70 deletions(-)

New commits:
commit ba369045f605e76ad60d6828efcd6c316dea0da5
Author: Michael Stahl 
Date:   Wed Nov 25 17:22:54 2015 +0100

vcl: SalEnumFontsProcExA is unused since 2010

Change-Id: Id1b1de27752a6b8a74ea3521b53c38f032bfa24b

diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 9412799..98fde75 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -915,22 +915,6 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( 
const ENUMLOGFONTEXW& rE
 return aDFA;
 }
 
-static ImplWinFontData* ImplLogMetricToDevFontDataA( const ENUMLOGFONTEXA* 
pLogFont,
- const NEWTEXTMETRICA* pMetric,
- DWORD nFontType )
-{
-int nHeight = 0;
-if ( nFontType & RASTER_FONTTYPE )
-nHeight = pMetric->tmHeight - pMetric->tmInternalLeading;
-
-ImplWinFontData* pData = new ImplWinFontData(
-WinFont2DevFontAttributes(*pLogFont, *pMetric, nFontType),
-nHeight,
-pLogFont->elfLogFont.lfCharSet,
-pMetric->tmPitchAndFamily );
-
-return pData;
-}
 
 static ImplWinFontData* ImplLogMetricToDevFontDataW( const ENUMLOGFONTEXW* 
pLogFont,
  const NEWTEXTMETRICW* pMetric,
@@ -1662,60 +1646,6 @@ bool 
WinSalGraphics::GetFontCapabilities(vcl::FontCapabilities 
 return mpWinFontData[0]->GetFontCapabilities(rFontCapabilities);
 }
 
-int CALLBACK SalEnumFontsProcExA( const ENUMLOGFONTEXA* pLogFont,
-  const NEWTEXTMETRICEXA* pMetric,
-  DWORD nFontType, LPARAM lParam )
-{
-ImplEnumInfo* pInfo = (ImplEnumInfo*)(void*)lParam;
-if ( !pInfo->mpName )
-{
-// Ignore vertical fonts
-if ( pLogFont->elfLogFont.lfFaceName[0] != '@' )
-{
-if ( !pInfo->mbImplSalCourierNew )
-pInfo->mbImplSalCourierNew = stricmp( 
pLogFont->elfLogFont.lfFaceName, "Courier New" ) == 0;
-if ( !pInfo->mbImplSalCourierScalable )
-pInfo->mbCourier = stricmp( pLogFont->elfLogFont.lfFaceName, 
"Courier" ) == 0;
-else
-pInfo->mbCourier = FALSE;
-OUString aName( ImplSalGetUniString( 
pLogFont->elfLogFont.lfFaceName ) );
-pInfo->mpName = 
-strncpy( pInfo->mpLogFontA->lfFaceName, 
pLogFont->elfLogFont.lfFaceName, LF_FACESIZE );
-pInfo->mpLogFontA->lfCharSet = pLogFont->elfLogFont.lfCharSet;
-EnumFontFamiliesExA( pInfo->mhDC, pInfo->mpLogFontA, 
(FONTENUMPROCA)SalEnumFontsProcExA,
- (LPARAM)(void*)pInfo, 0 );
-pInfo->mpLogFontA->lfFaceName[0] = '\0';
-pInfo->mpLogFontA->lfCharSet = DEFAULT_CHARSET;
-pInfo->mpName = NULL;
-pInfo->mbCourier = FALSE;
-}
-}
-else
-{
-// ignore non-scalable non-device font on printer
-if( pInfo->mbPrinter )
-if( (nFontType & RASTER_FONTTYPE) && !(nFontType & 
DEVICE_FONTTYPE) )
-return 1;
-
-ImplWinFontData* pData = ImplLogMetricToDevFontDataA( pLogFont, 
&(pMetric->ntmTm), nFontType );
-pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
-
-// prefer the system character set, so that we get as much as
-// possible important characters. In the other case we could only
-// display a limited set of characters (#87309#)
-if ( pInfo->mnPreferredCharSet == pLogFont->elfLogFont.lfCharSet )
-pData->mnQuality += 100;
-
-// knowing Courier to be scalable is nice
-if( pInfo->mbCourier )
-pInfo->mbImplSalCourierScalable |= pData->IsScalable();
-
-pInfo->mpList->Add( pData );
-}
-
-return 1;
-}
-
 int CALLBACK SalEnumFontsProcExW( const ENUMLOGFONTEXW* pLogFont,
   const NEWTEXTMETRICEXW* pMetric,
   DWORD nFontType, LPARAM lParam )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-11-25 Thread Tor Lillqvist
 vcl/win/source/gdi/winlayout.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 694214bebd43a39f1a77fc6541c2148210327f5c
Author: Tor Lillqvist 
Date:   Wed Nov 25 11:24:56 2015 +0200

Remove code that has been commented out since 2003

Change-Id: I5975af2801560c61ca72ab25f5d1222cf847c4e3

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 23fd8be..7339fb7 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -651,7 +651,6 @@ public:
 int mnEndGlyphPos;
 int mnMinCharPos;
 int mnEndCharPos;
-//long  mnPixelWidth;
 int mnXOffset;
 ABC maABCWidths;
 boolmbHasKashidas;
@@ -1001,7 +1000,6 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
 rVisualItem.mnMinGlyphPos = mnGlyphCount;
 rVisualItem.mnEndGlyphPos = 0;
 rVisualItem.mnXOffset = nXOffset;
-//rVisualItem.mnPixelWidth  = 0;
 
 // shortcut ignorable items
 if( (rArgs.mnEndCharPos <= rVisualItem.mnMinCharPos)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-11-17 Thread Takeshi Abe
 vcl/win/source/gdi/gdiimpl.cxx |   21 +++--
 vcl/win/source/window/salframe.cxx |4 ++--
 2 files changed, 9 insertions(+), 16 deletions(-)

New commits:
commit 703f3f452b470687bdc3041abe4f3d75230ac8c1
Author: Takeshi Abe 
Date:   Tue Oct 20 15:42:33 2015 +0900

vcl: These can be static assertions

Change-Id: I220ae4732f221c7798f162653cad01717afb659f
Reviewed-on: https://gerrit.libreoffice.org/20011
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index ad5f22e..c888c2a 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -981,8 +981,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const 
SalPoint* pPtAry, Sal
 
 POINT* pWinPtAry;
 // for NT, we can handover the array directly
-DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolyLine(): POINT != SalPoint" );
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 pWinPtAry = (POINT*)pPtAry;
 // for Windows 95 and its maximum number of points
@@ -1648,8 +1647,7 @@ void WinSalGraphicsImpl::drawRect( long nX, long nY, long 
nWidth, long nHeight )
 void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* 
pPtAry )
 {
 // for NT, we can handover the array directly
-DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolyLine(): POINT != SalPoint" );
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 POINT* pWinPtAry = (POINT*)pPtAry;
 
@@ -1695,8 +1693,7 @@ void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 
nPoints, const SalPoint* pPtAr
 void WinSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* 
pPtAry )
 {
 // for NT, we can handover the array directly
-DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolygon(): POINT != SalPoint" );
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 POINT* pWinPtAry = (POINT*)pPtAry;
 // for Windows 95 and its maximum number of points
@@ -1732,8 +1729,7 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 
nPoly, const sal_uInt32* pP
 else
 pWinPointAryAry = new POINT[nPolyPolyPoints];
 // for NT, we can handover the array directly
-   DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolyPolygon(): POINT != SalPoint" );
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 UINTn = 0;
 for ( i = 0; i < (UINT)nPoly; i++ )
 {
@@ -1774,8 +1770,7 @@ bool WinSalGraphicsImpl::drawPolyLineBezier( sal_uInt32 
nPoints, const SalPoint*
 {
 #ifdef USE_GDI_BEZIERS
 // for NT, we can handover the array directly
-DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolyLineBezier(): POINT != SalPoint" 
);
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 ImplRenderPath( mrParent.getHDC(), nPoints, pPtAry, pFlgAry );
 
@@ -1789,8 +1784,7 @@ bool WinSalGraphicsImpl::drawPolygonBezier( sal_uInt32 
nPoints, const SalPoint*
 {
 #ifdef USE_GDI_BEZIERS
 // for NT, we can handover the array directly
-DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolygonBezier(): POINT != SalPoint" );
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 POINT   aStackAry1[SAL_POLY_STACKBUF];
 BYTEaStackAry2[SAL_POLY_STACKBUF];
@@ -1840,8 +1834,7 @@ bool WinSalGraphicsImpl::drawPolyPolygonBezier( 
sal_uInt32 nPoly, const sal_uInt
 {
 #ifdef USE_GDI_BEZIERS
 // for NT, we can handover the array directly
-DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
-"WinSalGraphicsImpl::DrawPolyPolygonBezier(): POINT != 
SalPoint" );
+static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
 sal_uLong nCurrPoly, nTotalPoints;
 const sal_uInt32* pCurrPoints = pPoints;
diff --git a/vcl/win/source/window/salframe.cxx 
b/vcl/win/source/window/salframe.cxx
index 705335f..697efae 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -1066,7 +1066,7 @@ bool WinSalFrame::PostEvent(ImplSVEvent* pData)
 
 void WinSalFrame::SetTitle( const OUString& rTitle )
 {
-DBG_ASSERT( sizeof( WCHAR ) == sizeof( sal_Unicode ), 
"WinSalFrame::SetTitle(): WCHAR != sal_Unicode" );
+static_assert( sizeof( WCHAR ) == sizeof( sal_Unicode ), "must be the same 
size" );
 
 SetWindowTextW( mhWnd, reinterpret_cast(rTitle.getStr()) );
 }
@@ -2297,7 +2297,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* 
pBuf,
   

[Libreoffice-commits] core.git: vcl/win

2015-11-16 Thread Takeshi Abe
 vcl/win/source/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f630b6d5f165c8c507b8904b99594936edfd8da0
Author: Takeshi Abe 
Date:   Thu Oct 15 18:16:53 2015 +0900

tdf#94008 Crash opening password protected file - CJK UI

This fixes a buffer overflow writing over the end of pCaretXArray,
which can happen e.g. when drawing mnemonics in the password dialog.
Based on a similar calculation of nCurrIdx found in
GenericSalLayout::GetCaretPositions().

Change-Id: I7d723cf8cfaeb66f340c7d9ea5b3bc728c6d6209
Reviewed-on: https://gerrit.libreoffice.org/19385
Tested-by: Jenkins 
Reviewed-by: jan iversen 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 0dfce84..2409d4b 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1986,7 +1986,7 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, 
long* pCaretXArray ) const
 for(; (i < rVisualItem.mnEndCharPos) && (i < mnEndCharPos); ++i )
 {
 int j = mpLogClusters[ i ] + rVisualItem.mnMinGlyphPos;
-int nCurrIdx = i * 2;
+int nCurrIdx = (i - mnMinCharPos) * 2;
 if( !rVisualItem.IsRTL() )
 {
 // normal positions for LTR case
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-11-12 Thread Juergen Funk
 vcl/win/source/window/salframe.cxx |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 3ac9942c624cb627c8b09122498b45b05cf455f6
Author: Juergen Funk 
Date:   Thu Nov 12 10:50:59 2015 +0100

tdf#95761 All Hotkeys with CTRL+ALT+ not worked

The problem was always masked out the combination ALT+CTRL, this only
needed when press the ALTGR key, but the other ALT-Key (left side) is
valid.

Change-Id: I8a6f953f519627418fb48ee8d1d68b3cbf797250
Reviewed-on: https://gerrit.libreoffice.org/19923
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/source/window/salframe.cxx 
b/vcl/win/source/window/salframe.cxx
index 0203b05..705335f 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -3399,8 +3399,10 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 nModCode |= KEY_SHIFT;
 if ( GetKeyState( VK_CONTROL ) & 0x8000 )
 nModCode |= KEY_MOD1;
-if ( GetKeyState( VK_MENU ) & 0x8000 )
+if ( GetKeyState( VK_LMENU ) & 0x8000 )
 nModCode |= KEY_MOD2;
+if ( GetKeyState( VK_RMENU ) & 0x8000 )  // this is the ALTGR-Key in this 
case
+nModCode &= ~KEY_MOD1;   // remove the Control flag
 
 if ( (nMsg == WM_CHAR) || (nMsg == WM_SYSCHAR) )
 {
@@ -3607,13 +3609,6 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 aKeyEvt.mnCode |= nModCode;
 aKeyEvt.mnRepeat= nRepeat;
 
-if( (nModCode & (KEY_MOD1|KEY_MOD2)) == (KEY_MOD1|KEY_MOD2) &&
-aKeyEvt.mnCharCode )
-{
- // this is actually AltGr and should not be handled as Alt
- aKeyEvt.mnCode &= ~(KEY_MOD1|KEY_MOD2);
-}
-
 bIgnoreCharMsg = bCharPeek ? TRUE : FALSE;
 long nRet = pFrame->CallCallback( nEvent,  );
 // independent part only reacts on keyup but Windows does not 
send
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-30 Thread Takeshi Abe
 vcl/win/source/app/salinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 227678102b8b1c861b88efd58979f2be78d5d906
Author: Takeshi Abe 
Date:   Fri Oct 30 16:25:03 2015 +0900

vcl: This is a constant

Change-Id: Id87952a5eafa6c4ddf2d58b694cadf1fbf5c45a1

diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 4f3a289..8321ecf 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -1099,7 +1099,7 @@ int 
WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POIN
 // Problem behind: user32.dll sometime consumes exceptions/process 
violations .-)
 // see also #112221#
 
-static DWORD EXCEPTION_MSC_CPP_EXCEPTION = 0xE06D7363;
+static const DWORD EXCEPTION_MSC_CPP_EXCEPTION = 0xE06D7363;
 
 if (pExceptionInfo->ExceptionRecord->ExceptionCode == 
EXCEPTION_MSC_CPP_EXCEPTION)
 return EXCEPTION_CONTINUE_SEARCH;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-28 Thread Takeshi Abe
 vcl/win/source/app/salinfo.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 90cdd9eea8be5ed44d17f34b2276e5f3b7542835
Author: Takeshi Abe 
Date:   Wed Oct 28 17:35:31 2015 +0900

vcl: This is constant

Change-Id: I27a83996031b9494ad736ad82a7fff5740fbaf30

diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx
index b175757..2e30910 100644
--- a/vcl/win/source/app/salinfo.cxx
+++ b/vcl/win/source/app/salinfo.cxx
@@ -174,7 +174,7 @@ Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( 
unsigned int nScreen )
The first dimension is the button combination, the second dimension
is the button identifier.
 */
-static int DEFAULT_BTN_MAPPING_TABLE[][8] =
+static const int DEFAULT_BTN_MAPPING_TABLE[][8] =
 {
 //  UndefinedOK CANCEL ABORT  RETRY
  IGNORE YES NO
 { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, 
MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //OK
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-22 Thread Takeshi Abe
 vcl/win/source/gdi/gdiimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4898efa1b7e6b4624a19cdb69b9bf70ac7c39e16
Author: Takeshi Abe 
Date:   Mon Oct 19 18:26:19 2015 +0900

vcl: Free memory by appropriate dtor

Change-Id: I863251d742374d0a60820d41fec9d467c9ff4bd4
Reviewed-on: https://gerrit.libreoffice.org/19446
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index 07d8f4e..408639c 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -1256,7 +1256,7 @@ bool WinSalGraphicsImpl::setClipRegion( const 
vcl::Region& i_rClip )
 }
 
 if ( mrParent.mpClipRgnData != mrParent.mpStdClipRgnData )
-delete [] mrParent.mpClipRgnData;
+delete [] (BYTE*)mrParent.mpClipRgnData;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-20 Thread Tor Lillqvist
 vcl/win/source/gdi/winlayout.cxx |   97 +++
 1 file changed, 97 insertions(+)

New commits:
commit 7323190456c2ed4ec9f092f8e69ba12ce41587cd
Author: Tor Lillqvist 
Date:   Wed Oct 21 00:10:07 2015 +0300

tdf#94897: Don't mess up spacing of combining diacritic glyphs

At least for the Cambria font, instead of a precombined glyph,
Uniscribe ends up using a separate diacritic glyph for some (all?)
accented Latin characters. That caused weird layout errors in
justified lines when an accented character was followed by space: The
diacritic got separated from the base character.

Fix that specific case. Be careful not to mess with any other cases.

While debugging this I added lots of temporary debugging
printouts. Leave some helper functions for that behind, inside #if
0. Maybe we should start collecting such functions, including ones for
most common Win32 structs, in some include file in some common
location?

Change-Id: Ib0198411f820cb8ba8456786869185a43628628c

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 0a6d806..34bde4f 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -701,6 +701,82 @@ UniscribeLayout::~UniscribeLayout()
 delete[] mpGlyphs2Chars;
 }
 
+#if 0 // Don't remove -- useful for temporary SAL_ DEBUG when hacking on this
+
+namespace {
+
+template
+OUString IntegerArrayToString(IntegerType *pWords, int n)
+{
+OUString result = "{";
+for (int i = 0; i < n; ++i)
+{
+if (i > 0)
+result += ",";
+if (i > 0 && i % 10 == 0)
+result += OUString::number(i) + ":";
+result += OUString::number(pWords[i]);
+}
+result += "}";
+
+return result;
+}
+
+OUString GoffsetArrayToString(GOFFSET *pGoffsets, int n)
+{
+OUString result = "{";
+for (int i = 0; i < n; ++i)
+{
+if (i > 0)
+result += ",";
+if (i > 0 && i % 10 == 0)
+result += OUString::number(i) + ":";
+result += "(" + OUString::number(pGoffsets[i].du) + "," + 
OUString::number(pGoffsets[i].dv) + ")";
+}
+result += "}";
+
+return result;
+}
+
+OUString VisAttrArrayToString(SCRIPT_VISATTR *pVisAttrs, int n)
+{
+static const OUString JUSTIFICATION_NAME[] = {
+"NONE",
+"ARABIC_BLANK",
+"CHARACTER",
+"RESERVED1",
+"BLANK",
+"RESERVED2",
+"RESERVED3",
+"ARABIC_NORMAL",
+"ARABIC_KASHIDA",
+"ARABIC_ALEF",
+"ARABIC_HA",
+"ARABIC_RA",
+"ARABIC_BA",
+"ARABIC_BARA",
+"ARABIC_SEEN",
+"ARABIC_SEEN_M"
+};
+
+OUString result = "{";
+for (int i = 0; i < n; ++i)
+{
+if (i > 0)
+result += ",";
+if (i > 0 && i % 10 == 0)
+result += OUString::number(i) + ":";
+result += OUString("{") + 
JUSTIFICATION_NAME[pVisAttrs[i].uJustification] + (pVisAttrs[i].fClusterStart ? 
OUString(",ClusterStart") : OUString()) + (pVisAttrs[i].fDiacritic ? 
OUString(",Diacritic") : OUString()) + OUString(pVisAttrs[i].fZeroWidth ? 
OUString(",ZeroWidth") : OUString()) + OUString("}");
+}
+result += "}";
+
+return result;
+}
+
+} // anonymous namespace
+
+#endif // 0
+
 bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
 {
 // for a base layout only the context glyphs have to be dropped
@@ -2085,6 +2161,27 @@ void UniscribeLayout::ApplyDXArray( const 
ImplLayoutArgs& rArgs )
 mpJustifications[i] -= nXOffsetAdjust;
 }
 }
+
+// tdf#94897: Don't add extra justification to chars with diacritics 
when the diacritic is a
+// separate glyph, followed by blank, in LTR
+if( !rVisualItem.IsRTL() )
+{
+for( i = nMinGlyphPos; i < nEndGlyphPos; ++i )
+{
+const int nXOffsetAdjust = mpJustifications[i] - 
mpGlyphAdvances[i];
+if( nXOffsetAdjust == 0 )
+continue;
+int nIdxAdd = i + 1;
+while( (nIdxAdd < nEndGlyphPos) && 
mpVisualAttrs[nIdxAdd].fDiacritic )
+++nIdxAdd;
+if( nIdxAdd == i + 1 )
+continue;
+if( nIdxAdd >= nEndGlyphPos || 
mpVisualAttrs[nIdxAdd].uJustification != SCRIPT_JUSTIFY_BLANK )
+continue;
+mpJustifications[nIdxAdd] += nXOffsetAdjust;
+mpJustifications[i] -= nXOffsetAdjust;
+}
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-19 Thread Takeshi Abe
 vcl/win/source/app/saldata.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4902be3e1bca72733ee41e6dee460834e83e012d
Author: Takeshi Abe 
Date:   Mon Oct 19 18:16:49 2015 +0900

vcl: Mark it as const

Change-Id: Ifc1e9e64f50aa916ef0667796a54a11dec9a0ea8

diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx
index 7c70bfa..18256ee 100644
--- a/vcl/win/source/app/saldata.cxx
+++ b/vcl/win/source/app/saldata.cxx
@@ -25,7 +25,7 @@
 
 rtl_TextEncoding ImplSalGetSystemEncoding()
 {
-static UINT nOldAnsiCodePage = 0;
+static const UINT nOldAnsiCodePage = 0;
 static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252;
 
 UINT nAnsiCodePage = GetACP();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-14 Thread Takeshi Abe
 vcl/win/source/gdi/salgdi.cxx|2 +-
 vcl/win/source/window/salobj.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a69a786b91048d69bbb47503e3720de613935e56
Author: Takeshi Abe 
Date:   Tue Oct 13 18:06:06 2015 +0900

vcl: Free memory by appropriate delete

Change-Id: Id39940563952a6791c63cc5c4621a28401ad5ebe
Reviewed-on: https://gerrit.libreoffice.org/19343
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 64bb1fc..5f29820 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -659,7 +659,7 @@ WinSalGraphics::~WinSalGraphics()
 }
 
 // delete cache data
-delete [] mpStdClipRgnData;
+delete [] (BYTE*)mpStdClipRgnData;
 }
 
 SalGraphicsImpl* WinSalGraphics::GetImpl() const
diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx
index 4877c53..033c798 100644
--- a/vcl/win/source/window/salobj.cxx
+++ b/vcl/win/source/window/salobj.cxx
@@ -568,7 +568,7 @@ WinSalObject::~WinSalObject()
 }
 
 // Cache-Daten zerstoeren
-delete mpStdClipRgnData;
+delete [] (BYTE*)mpStdClipRgnData;
 
 HWND hWndParent = ::GetParent( mhWnd );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-10-01 Thread Michael Meeks
 vcl/win/source/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cb81ca35d4d4db27f8bd3322fc16aa73d9cf38bb
Author: Michael Meeks 
Date:   Thu Oct 1 16:30:06 2015 +0100

tdf#94428 - don't use OpenGL font rendering when we're printing.

Change-Id: I212bb442bdffa38d77e7e7357199c39420fa7951

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 66c9dd6..8dace9e 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -2492,7 +2492,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& 
/*rArgs*/, int nFallba
 const ImplWinFontData& rFontFace = *mpWinFontData[ nFallbackLevel ];
 ImplWinFontEntry& rFontInstance = *mpWinFontEntry[ nFallbackLevel ];
 
-bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled();
+bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter;
 
 if (!bUspInited)
 InitUSP();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-09-29 Thread Michael Stahl
 vcl/win/source/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 106a96075da1f004da51e8103675e72e6e6d69b8
Author: Michael Stahl 
Date:   Tue Sep 29 15:02:45 2015 +0200

vcl: oops, fix windows build

Change-Id: I73135440321c7c9898f758cb7a921d62f2265bcb

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 0572b21..ac9ec6f 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1877,7 +1877,7 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, 
long* pCaretXArray ) const
 int i;
 for( i = 0; i < nMaxIdx; ++i )
 pCaretXArray[ i ] = -1;
-std::unique_ptr const pGlyphPos = new long[mnGlyphCount + 1];
+std::unique_ptr const pGlyphPos(new long[mnGlyphCount + 1]);
 for( i = 0; i <= mnGlyphCount; ++i )
 pGlyphPos[ i ] = -1;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/win

2015-09-07 Thread Miklos Vajna
 vcl/win/source/gdi/winlayout.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit b5df051cc5d734ef9fd77a5336d2bb8d1d4557c9
Author: Miklos Vajna 
Date:   Mon Sep 7 17:10:16 2015 +0200

windows opengl: fix CppunitTest_writerperfect_writer

Change-Id: I4a7199633d0d940ae009ac144989da7d6c9262ec
Reviewed-on: https://gerrit.libreoffice.org/18378
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 200c4ee..cad232b 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1763,6 +1763,10 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& 
rGraphics) const
 
 for (int i = nMinGlyphPos; i < nEndGlyphPos; i++)
 {
+// Ignore dropped glyphs.
+if (mpOutGlyphs[i] == DROPPED_OUTGLYPH)
+continue;
+
 assert(mrWinFontEntry.GlyphIsCached(mpOutGlyphs[i]));
 
 const OpenGLGlyphCacheChunk& rChunk = 
mrWinFontEntry.GetCachedGlyphChunkFor(mpOutGlyphs[i]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


<    1   2   3   4   >