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

2020-11-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salprn.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f813a5d68af4e856a260cc1b6ec8813ed99db3bf
Author: Stephan Bergmann 
AuthorDate: Fri Nov 27 10:56:25 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 27 13:49:14 2020 +0100

DocumentPropertiesW returns LONG

Change-Id: I1ee167ef1bca530be9399dd081d7d25bd4155794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106750
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 0deb814880e4..e7a6936364f5 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -281,7 +281,7 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter const * 
pPrinter,
 BYTE const * pDriverData = reinterpret_cast(pSalDriverData) + pSalDriverData->mnDriverOffset;
 pDevModeW = reinterpret_cast(pDriverData);
 
-long nSysJobSize = -1;
+LONG nSysJobSize = -1;
 if( pPrinter && pDevModeW )
 {
 // just too many driver crashes in that area -> check the 
dmSpecVersion and dmDriverVersion fields always !!!
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-11-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   12 ++--
 vcl/win/window/salframe.cxx   |2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit e99897ff2854c1f37bbbe3cc7bf8738495403f6e
Author: Stephan Bergmann 
AuthorDate: Fri Nov 27 11:01:35 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 27 13:48:47 2020 +0100

loplugin:toolslong (Library_vclplug_win)

Change-Id: I1e8c02a4fdb42a7bbc25764ceaf96972f175130a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106751
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 68a18b020733..95b95861586f 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1008,7 +1008,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 if( vsAPI.GetThemeBackgroundContentRect( hTheme, hDC, PP_BAR, iState, 
, ) != S_OK )
 return false;
 
-long nProgressWidth = aValue.getNumericVal();
+tools::Long nProgressWidth = aValue.getNumericVal();
 nProgressWidth *= (aProgressRect.right - aProgressRect.left);
 nProgressWidth /= (rc.right - rc.left);
 if( AllSettings::GetLayoutRTL() )
@@ -1028,13 +1028,13 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 RECT aTRect = rc;
 if( nPart == ControlPart::TrackHorzArea )
 {
-long nH = aTrackRect.GetHeight();
+tools::Long nH = aTrackRect.GetHeight();
 aTRect.top += (rc.bottom - rc.top - nH)/2;
 aTRect.bottom = aTRect.top + nH;
 }
 else
 {
-long nW = aTrackRect.GetWidth();
+tools::Long nW = aTrackRect.GetWidth();
 aTRect.left += (rc.right - rc.left - nW)/2;
 aTRect.right = aTRect.left + nW;
 }
@@ -1138,7 +1138,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 tools::Rectangle aRect( ImplGetThemeRect( hTheme, hDC,
 MENU_POPUPSEPARATOR, 0, tools::Rectangle( rc.left, rc.top, 
rc.right, rc.bottom ) ) );
 // center the separator inside the passed rectangle
-long nDY = ((rc.bottom - rc.top + 1) - aRect.GetHeight()) / 2;
+auto const nDY = ((rc.bottom - rc.top + 1) - 
aRect.GetHeight()) / 2;
 rc.top += nDY;
 rc.bottom = rc.top+aRect.GetHeight()-1;
 return ImplDrawTheme( hTheme, hDC, MENU_POPUPSEPARATOR, 0, rc, 
aCaption );
@@ -1478,7 +1478,7 @@ bool WinSalGraphics::getNativeControlRegion(  ControlType 
nType,
 tools::Rectangle aThumbRect = ImplGetThemeRect( hTheme, hDC, 
iPart, iState, tools::Rectangle() );
 if( nPart == ControlPart::ThumbHorz )
 {
-long nW = aThumbRect.GetWidth();
+tools::Long nW = aThumbRect.GetWidth();
 tools::Rectangle aRect( rControlRegion );
 aRect.SetRight( aRect.Left() + nW - 1 );
 rNativeContentRegion = aRect;
@@ -1486,7 +1486,7 @@ bool WinSalGraphics::getNativeControlRegion(  ControlType 
nType,
 }
 else
 {
-long nH = aThumbRect.GetHeight();
+tools::Long nH = aThumbRect.GetHeight();
 tools::Rectangle aRect( rControlRegion );
 aRect.SetBottom( aRect.Top() + nH - 1 );
 rNativeContentRegion = aRect;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index e016430611ad..34a569be39ab 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2580,7 +2580,7 @@ static void ImplSalUpdateStyleFontW( HDC hDC, const 
LOGFONTW& rLogFont, vcl::Fon
 
 static tools::Long ImplW2I( const wchar_t* pStr )
 {
-longn = 0;
+tools::Long n = 0;
 int nSign = 1;
 
 if ( *pStr == '-' )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-11-27 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salprn.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8a27fbebc5bcb69a1b2664a5ffa31e5d8bb7d225
Author: Stephan Bergmann 
AuthorDate: Fri Nov 27 10:54:48 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 27 13:20:14 2020 +0100

GetLastError returns DWORD

Change-Id: I4e886d1d5f94f8a25591c41e9f03300cfba641dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106729
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index d552d17ed96b..0deb814880e4 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1509,7 +1509,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
 
 if ( nRet <= 0 )
 {
-long nError = GetLastError();
+DWORD nError = GetLastError();
 if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == 
ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) )
 mnError = SalPrinterError::Abort;
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-19 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/winlayout.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a3f93ced82f8d4d122468cc4a1c4298141d67507
Author: Stephan Bergmann 
AuthorDate: Mon Oct 19 09:20:35 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Oct 19 11:48:41 2020 +0200

Simplify single-wchar_t LPCWSTR argument to ExtTextOutW

Change-Id: I5c66408297ab03da29494d00ce222b3ef1e0ef13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104515
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 884b1be6e670..3438e3b79deb 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -266,7 +266,7 @@ bool ExTextOutRenderer::operator ()(GenericSalLayout const 
,
 const GlyphItem* pGlyph;
 while (rLayout.GetNextGlyph(, aPos, nStart))
 {
-WORD glyphWStr[] = { pGlyph->glyphId() };
+wchar_t glyphWStr = pGlyph->glyphId();
 if (hAltFont && pGlyph->IsVertical() == bUseAltFont)
 {
 bUseAltFont = !bUseAltFont;
@@ -275,7 +275,7 @@ bool ExTextOutRenderer::operator ()(GenericSalLayout const 
,
 if (bShift && pGlyph->IsVertical())
 SetTextAlign(hDC, TA_TOP|TA_LEFT);
 
-ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(), 1, nullptr);
+ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, 
, 1, nullptr);
 
 if (bShift && pGlyph->IsVertical())
 SetTextAlign(hDC, nTextAlign);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-14 Thread Stephan Bergmann (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 0b9d1fd252e50a37a5091fd59b772256e7ca22dd
Author: Stephan Bergmann 
AuthorDate: Tue Oct 13 17:27:53 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Oct 14 09:05:33 2020 +0200

-Werror,-Wshadow (clang-cl)

Change-Id: I3f76ca202c38b42f55d669a0160fa8203b136031
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104246
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index de6ecb775838..f553ba3dd34e 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -93,7 +93,7 @@ uno::Reference SAL_CALL 
CWinClipboard::getContents(
 // use the shortcut or create a transferable from
 // system clipboard
 {
-osl::MutexGuard aGuard(m_ClipContentMutex);
+osl::MutexGuard aGuard2(m_ClipContentMutex);
 
 if (nullptr != m_pCurrentClipContent)
 return m_pCurrentClipContent->m_XTransferable;
@@ -121,7 +121,7 @@ uno::Reference SAL_CALL 
CWinClipboard::getContents(
 // remember pIDo destroys itself due to the smart pointer
 rClipContent = CDOTransferable::create(m_xContext, pIDo);
 
-osl::MutexGuard aGuard(m_ClipContentMutex);
+osl::MutexGuard aGuard2(m_ClipContentMutex);
 m_foreignContent = rClipContent;
 }
 
@@ -143,7 +143,7 @@ void SAL_CALL CWinClipboard::setContents(
 if (xTransferable.is())
 {
 {
-osl::MutexGuard aGuard(m_ClipContentMutex);
+osl::MutexGuard aGuard2(m_ClipContentMutex);
 
 m_foreignContent.clear();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-14 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 2f43642d5c6cc9662a1f7f50bf215609cee1f634
Author: Stephan Bergmann 
AuthorDate: Tue Oct 13 17:28:44 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Oct 14 08:34:28 2020 +0200

loplugin:unreffun (clang-cl)

Change-Id: I9e478c71662aa5a5347d11adae0435e737fced82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104247
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 0d7930d20e71..ea8bccfdd1f4 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1546,7 +1546,6 @@ public:
 SFErrCodes open(void const * pBuffer, sal_uInt32 nLen, sal_uInt32 
nFaceNum, const FontCharMapRef xCharMap = nullptr);
 
 TrueTypeFont * get() const { return m_pFont; }
-TrueTypeFont* operator->() { return m_pFont; }
 
 private:
 TrueTypeFont * m_pFont;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-24 Thread Andrea Gelmini (via logerrit)
 vcl/win/dtrans/target.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f90da5211abb470982b2070237c7758556a70145
Author: Andrea Gelmini 
AuthorDate: Wed Sep 23 08:24:44 2020 +0200
Commit: Julien Nabet 
CommitDate: Thu Sep 24 18:35:32 2020 +0200

Fix typo

Change-Id: Ieb59e035d6454536db44a1aeb3ffdbb25e6bba08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103226
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/dtrans/target.cxx b/vcl/win/dtrans/target.cxx
index 0aa04ea1f7ab..adddabab7038 100644
--- a/vcl/win/dtrans/target.cxx
+++ b/vcl/win/dtrans/target.cxx
@@ -343,7 +343,7 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj,
 fire_dragEnter( e);
 // Check if the action derived from grfKeyState 
(m_nCurrentDropAction) or the action set
 // by the listener (m_nCurrentDropAction) is allowed by the 
source. Only an allowed action is set
-// in pdwEffect. The listener notification is asynchron, that is 
we cannot expect that the listener
+// in pdwEffect. The listener notification is asynchronous, that 
is we cannot expect that the listener
 // has already reacted to the notification.
 // If there is more than one valid action which is the case when 
ALT or RIGHT MOUSE BUTTON is pressed
 // then getDropEffect returns DROPEFFECT_MOVE which is the default 
value if no other modifier is pressed.
@@ -391,7 +391,7 @@ HRESULT DropTarget::DragOver( DWORD grfKeyState,
 fire_dragOver( e);
 // Check if the action derived from grfKeyState 
(m_nCurrentDropAction) or the action set
 // by the listener (m_nCurrentDropAction) is allowed by the 
source. Only an allowed action is set
-// in pdwEffect. The listener notification is asynchron, that is 
we cannot expect that the listener
+// in pdwEffect. The listener notification is asynchronous, that 
is we cannot expect that the listener
 // has already reacted to the notification.
 // If there is more than one valid action which is the case when 
ALT or RIGHT MOUSE BUTTON is pressed
 // then getDropEffect returns DROPEFFECT_MOVE which is the default 
value if no other modifier is pressed.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-24 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |   35 +++
 1 file changed, 31 insertions(+), 4 deletions(-)

New commits:
commit 9771e61666455c969de751e4d8f27c1c160780e1
Author: Stephan Bergmann 
AuthorDate: Thu Sep 24 13:27:17 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 24 18:03:40 2020 +0200

Revert "Directly acquire m_aMutex, instead of looping on m_condition.wait()"

This reverts commit e9a16702ba025ca340bcded4fda37235d22410a1.  My 
understanding
that the code was pointless was apparently wrong (the relevant part being 
hidden
in m_condition.wait() internally doing the call to 
MsgWaitForMultipleObjects;
I've improved the relevant comment now).  (And my fears that the code using
osl::Condition might be broken by design were hopefully unfounded.)

Change-Id: Icb244ec9df8a2b0dacf115700ed850d471446f3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103310
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3af78712b1d2..476b6350147a 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -99,6 +99,9 @@ static LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, 
WPARAM wParam, LPA
 
 class SalYieldMutex : public comphelper::SolarMutex
 {
+public: // for ImplSalYield() and ImplSalYieldMutexAcquireWithWait()
+osl::Conditionm_condition; /// for MsgWaitForMultipleObjects()
+
 protected:
 virtual void  doAcquire( sal_uInt32 nLockCount ) override;
 virtual sal_uInt32doRelease( bool bUnlockAll ) override;
@@ -135,11 +138,31 @@ void SalYieldMutex::BeforeReleaseHandler()
 void SalYieldMutex::doAcquire( sal_uInt32 nLockCount )
 {
 WinSalInstance* pInst = GetSalData()->mpInstance;
-if ( pInst && pInst->IsMainThread() && pInst->m_nNoYieldLock )
+if ( pInst && pInst->IsMainThread() )
 {
-return;
+if ( pInst->m_nNoYieldLock )
+return;
+// tdf#96887 If this is the main thread, then we must wait for two 
things:
+// - the yield mutex being unlocked
+// - SendMessage() being triggered
+// This can nicely be done using MsgWaitForMultipleObjects, which is 
called in
+// m_condition.wait(). The 2nd one is
+// needed because if we don't reschedule, then we create deadlocks if a
+// Window's create/destroy is called via SendMessage() from another 
thread.
+// Have a look at the osl_waitCondition implementation for more info.
+do {
+// reset condition *before* acquiring!
+m_condition.reset();
+if (m_aMutex.tryToAcquire())
+break;
+// wait for SalYieldMutex::release() to set the condition
+osl::Condition::Result res = m_condition.wait();
+assert(osl::Condition::Result::result_ok == res);
+}
+while ( true );
 }
-m_aMutex.acquire();
+else
+m_aMutex.acquire();
 ++m_nCount;
 --nLockCount;
 
@@ -152,7 +175,11 @@ sal_uInt32 SalYieldMutex::doRelease( const bool bUnlockAll 
)
 if ( pInst && pInst->m_nNoYieldLock && pInst->IsMainThread() )
 return 1;
 
-return comphelper::SolarMutex::doRelease( bUnlockAll );
+sal_uInt32 nCount = comphelper::SolarMutex::doRelease( bUnlockAll );
+// wake up ImplSalYieldMutexAcquireWithWait() after release
+if ( 0 == m_nCount )
+m_condition.set();
+return nCount;
 }
 
 bool SalYieldMutex::tryToAcquire()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-23 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |   34 --
 1 file changed, 4 insertions(+), 30 deletions(-)

New commits:
commit e9a16702ba025ca340bcded4fda37235d22410a1
Author: Stephan Bergmann 
AuthorDate: Wed Sep 23 15:38:27 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 23 17:07:32 2020 +0200

Directly acquire m_aMutex, instead of looping on m_condition.wait()

The code had been introduced with 9c9970952b0adec4a8c6de9a4cd54d0980cd47ec
"tdf#96887 enhance SolarMutex AcquireWithWait for Windows", which mentions
MsgWaitForMultipleObjects in multiple comments as if it had intended to 
make use
of it somewhere, but no such use can be found in that commit.

(I had come across this code when on Windows some CppunitTest had
deadlocked for me during DeInitVCL when re-acquiring the released 
SolarMutex at
the end of

> #if defined _WIN32
> // See GetSystemClipboard (vcl/source/treelist/transfer2.cxx):
> if (auto const comp = css::uno::Reference(
> pSVData->m_xSystemClipboard, css::uno::UNO_QUERY))
> {
> SolarMutexReleaser r; // unblock pending "clipboard content 
changed" notifications
> comp->dispose(); // will use CWinClipbImpl::s_aMutex
> }
> #endif

at vcl/source/app/svmain.cxx:490--498, and SalYieldMutex::doAcquire was 
waiting
in m_condition.wait() for an m_condition.set() from some other thread that 
would
never come---there were not even any other relevant threads left.  At first 
I
thought this might be an issue with broken-by-design osl::Condition, where 
some
other, meanwhile gone thread's m_condition.set() had been cancelled by this
thread's m_condition.reset() in SalYieldMutex::doAcquire, but then its
m_aMutex.tryToAcquire() should probably have succeeded so that it wouldn't 
have
ended up in m_codition.wait().  But even if the use of m_condition might 
not be
broken after all and the deadlock I observed would be caused by something 
else,
it nevertheless looks pointless, so better clean it up.)

Change-Id: Ia6c1aa133c14e19224d0f24c810f43363cb5898c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103253
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 5ebb6eff..3af78712b1d2 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -99,9 +99,6 @@ static LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, 
WPARAM wParam, LPA
 
 class SalYieldMutex : public comphelper::SolarMutex
 {
-public: // for ImplSalYield() and ImplSalYieldMutexAcquireWithWait()
-osl::Conditionm_condition; /// for MsgWaitForMultipleObjects()
-
 protected:
 virtual void  doAcquire( sal_uInt32 nLockCount ) override;
 virtual sal_uInt32doRelease( bool bUnlockAll ) override;
@@ -138,30 +135,11 @@ void SalYieldMutex::BeforeReleaseHandler()
 void SalYieldMutex::doAcquire( sal_uInt32 nLockCount )
 {
 WinSalInstance* pInst = GetSalData()->mpInstance;
-if ( pInst && pInst->IsMainThread() )
+if ( pInst && pInst->IsMainThread() && pInst->m_nNoYieldLock )
 {
-if ( pInst->m_nNoYieldLock )
-return;
-// tdf#96887 If this is the main thread, then we must wait for two 
things:
-// - the yield mutex being unlocked
-// - SendMessage() being triggered
-// This can nicely be done using MsgWaitForMultipleObjects. The 2nd 
one is
-// needed because if we don't reschedule, then we create deadlocks if a
-// Window's create/destroy is called via SendMessage() from another 
thread.
-// Have a look at the osl_waitCondition implementation for more info.
-do {
-// reset condition *before* acquiring!
-m_condition.reset();
-if (m_aMutex.tryToAcquire())
-break;
-// wait for SalYieldMutex::release() to set the condition
-osl::Condition::Result res = m_condition.wait();
-assert(osl::Condition::Result::result_ok == res);
-}
-while ( true );
+return;
 }
-else
-m_aMutex.acquire();
+m_aMutex.acquire();
 ++m_nCount;
 --nLockCount;
 
@@ -174,11 +152,7 @@ sal_uInt32 SalYieldMutex::doRelease( const bool bUnlockAll 
)
 if ( pInst && pInst->m_nNoYieldLock && pInst->IsMainThread() )
 return 1;
 
-sal_uInt32 nCount = comphelper::SolarMutex::doRelease( bUnlockAll );
-// wake up ImplSalYieldMutexAcquireWithWait() after release
-if ( 0 == m_nCount )
-m_condition.set();
-return nCount;
+return comphelper::SolarMutex::doRelease( bUnlockAll );
 }
 
 bool SalYieldMutex::tryToAcquire()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

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

2020-09-23 Thread Andrea Gelmini (via logerrit)
 vcl/win/dtrans/WinClipboard.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit eed7c2f215173bf3799e4ee34771a3f64bf06f74
Author: Andrea Gelmini 
AuthorDate: Wed Sep 23 08:23:09 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 23 11:47:01 2020 +0200

Removed duplicated include

Change-Id: I3f672cbf7fa6c92580abb629575d2eb46700bd4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103225
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index c1e4dde81c82..7317d8467827 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -41,8 +41,6 @@
 #include 
 #include 
 
-#include "WinClipboard.hxx"
-
 using namespace com::sun::star;
 
 // definition of static members
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-21 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salprn.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 10c65afcdad46ed02e377824bc43dbc384d52340
Author: Stephan Bergmann 
AuthorDate: Fri Aug 21 09:19:00 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 21 10:24:33 2020 +0200

loplugin:simplifybool (clang-cl)

Change-Id: I88f659da3d80bf83f544edd89933b582f06b2556
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101130
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 053c503b1671..3f27d999d845 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1470,7 +1470,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
 
 // bring up a file chooser if printing to file port but no file name given
 OUString aOutFileName;
-if( mpInfoPrinter->maPortName.equalsIgnoreAsciiCase( "FILE:" ) && 
!(pFileName && !pFileName->isEmpty()) )
+if( mpInfoPrinter->maPortName.equalsIgnoreAsciiCase( "FILE:" ) && 
(!pFileName || pFileName->isEmpty()) )
 {
 
 uno::Reference< uno::XComponentContext > xContext( 
::comphelper::getProcessComponentContext() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-05 Thread Mike Kaganski (via logerrit)
 vcl/win/window/salframe.cxx |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit b094741e1d04f4e377c4a7d5c564e38d2f84c377
Author: Mike Kaganski 
AuthorDate: Sun Aug 2 00:19:42 2020 +0300
Commit: Mike Kaganski 
CommitDate: Wed Aug 5 12:04:40 2020 +0200

tdf#135330: avoid replacing all settings when enabling IA2

Call to ImplHandleGetObject may happen in the middle of any UI operation,
including those that make use of references to parts of global settings,
like this:

const LocaleDataWrapper& rLocaleData = 
Application::GetSettings().GetUILocaleDataWrapper();
setValue(*m_xCurrentWordFT, rCurrent.nWord, rLocaleData); // < here 
ImplHandleGetObject may be called
setValue(*m_xCurrentCharacterFT, rCurrent.nChar, rLocaleData);

If all settings get replaced, then LocaleDataWrapper gets destroyed, and
the reference becomes invalid, and crashes in the next line.

So first, the change makes the call only modify settings when it's needed;
and second, it makes use of the implementation detail that aMisc modifies
the shared data. The check after the change will catch if implementation
changes so that this is no more true.

Yet, the problem stays that using any references to global settings objects
is unsafe, since any call to Application::SetSettings will invalidate them.

Change-Id: I96d237ee57e80465fe52bc6bb6c149b087c89af9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99947
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 287863129a9f..c433de48216d 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5291,15 +5291,18 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM 
wParam )
 static bool
 ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet)
 {
-// IA2 should be enabled automatically
-AllSettings aSettings = Application::GetSettings();
-MiscSettings aMisc = aSettings.GetMiscSettings();
-aMisc.SetEnableATToolSupport( true );
-aSettings.SetMiscSettings( aMisc );
-Application::SetSettings( aSettings );
-
 if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
-return false; // locked down somehow ?
+{
+// IA2 should be enabled automatically
+AllSettings aSettings = Application::GetSettings();
+MiscSettings aMisc = aSettings.GetMiscSettings();
+aMisc.SetEnableATToolSupport(true);
+// The above is enough, since aMisc changes the same shared 
ImplMiscData as used in global
+// gettings, so no need to call aSettings.SetMiscSettings and 
Application::SetSettings
+
+if 
(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+return false; // locked down somehow ?
+}
 
 ImplSVData* pSVData = ImplGetSVData();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-29 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 917fadedee4459ff75e78e1b746ba320503301e0
Author: Caolán McNamara 
AuthorDate: Wed Jul 29 14:00:09 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 29 16:48:22 2020 +0200

drop lines that don't do anything

since...

commit 9a4d0581c72653e60562d1b8e2121772d21f8a9e
Date:   Mon Oct 12 11:49:13 2009 +0200

#i103496#: move SysLocale stuff to unotools

Change-Id: I6a7c3d71af7e91f873a2cab3393e8cefdcdff28d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99693
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 789df0dd2796..55ddad83b743 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2819,9 +2819,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
 nValue = static_cast(ImplW2I( aValueBuf ));
 if ( (nValue > 1000) && (nValue < 1) )
 {
-MiscSettings aMiscSettings = rSettings.GetMiscSettings();
 utl::MiscCfg().SetYear2000( 
static_cast(nValue-99) );
-rSettings.SetMiscSettings( aMiscSettings );
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-18 Thread Luboš Luňák (via logerrit)
 vcl/win/gdi/salfont.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 2ff6fce634ff173b9eb8a703b7f2f265f6e3ecb1
Author: Luboš Luňák 
AuthorDate: Mon Mar 16 16:51:51 2020 +0100
Commit: Luboš Luňák 
CommitDate: Wed Mar 18 10:48:04 2020 +0100

use DEFAULT_QUALITY for font rendering with Skia on Windows

I don't know why tdf#98380 explicitly forced ANTIALIASED_QUALITY,
for OpenGL, but with Skia this breaks subpixel AA on LCDs,
where the actual value should be CLEARTYPE_QUALITY. But
DEFAULT_QUALITY simply seems to do the job no matter what.
Maybe the problem with OpenGL was that our code there handles
glyphs as monochrome, but Skia can handle colors, which is
necessary for subpixel AA.

Change-Id: Id7081b120f8e754deb4793423d157a8837e959aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90581
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 73c0bf7f2eb9..774178b683f8 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -796,9 +796,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
 static BYTE nDefaultQuality = NONANTIALIASED_QUALITY;
 if (nDefaultQuality == NONANTIALIASED_QUALITY)
 {
-if (SkiaHelper::isVCLSkiaEnabled())
-nDefaultQuality = ANTIALIASED_QUALITY;
-else if (OpenGLWrapper::isVCLOpenGLEnabled())
+if (OpenGLWrapper::isVCLOpenGLEnabled())
 nDefaultQuality = ANTIALIASED_QUALITY;
 else
 nDefaultQuality = DEFAULT_QUALITY;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-10 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |   57 ++--
 1 file changed, 55 insertions(+), 2 deletions(-)

New commits:
commit cba20762aba9abf17e94790e1bd99e1293050385
Author: Jan-Marek Glogowski 
AuthorDate: Mon Mar 9 15:25:20 2020 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Mar 11 00:55:13 2020 +0100

WIN add bootstrap var to re-enable foreground hack

We already found a regressed installation from commit
518c0265efebf39ab6d1e90c4ec4e7cf52b701c6 ("WIN prevent deadlock
in SetForegroundWindow").

Finding a real fix might be impossible, so this just adds the
bootstrap.ini boolean variable Win32.EnableAttachThreadInputHack
to re-enable the previous AttachThreadInput hack on demand.

Change-Id: I3b6d770b060b5dee60e02a5aa85efb8a51518c82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90235
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index a9a30b71086d..789df0dd2796 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -33,6 +33,12 @@
 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -1926,16 +1932,63 @@ void WinSalFrame::SetAlwaysOnTop( bool bOnTop )
 SetWindowPos( mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | 
SWP_NOACTIVATE );
 }
 
+static bool EnableAttachThreadInputHack()
+{
+OUString aBootstrapUri;
+if (osl_getProcessWorkingDir() != osl_Process_E_None)
+return false;
+aBootstrapUri += "/bootstrap.ini";
+
+OUString aSystemFileName;
+if (osl::FileBase::getSystemPathFromFileURL(aBootstrapUri, 
aSystemFileName) != osl::FileBase::E_None)
+return false;
+if (aSystemFileName.getLength() > MAX_PATH)
+return false;
+
+// this uses the Boost ini parser, instead of tools::Config, as we already 
use it to read other
+// values from bootstrap.ini in desktop/win32/source/loader.cxx, because 
that watchdog process
+// can't access LO libs. This way the handling is consistent.
+try
+{
+boost::property_tree::ptree pt;
+std::ifstream aFile(o3tl::toW(aSystemFileName.getStr()));
+boost::property_tree::ini_parser::read_ini(aFile, pt);
+const bool bEnabled = pt.get("Win32.EnableAttachThreadInputHack", 
false);
+SAL_WARN_IF(bEnabled, "vcl", "AttachThreadInput hack is enabled. Watch 
out for deadlocks!");
+return bEnabled;
+}
+catch (...)
+{
+return false;
+}
+}
+
 static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
 {
+static const bool bEnableAttachThreadInputHack = 
EnableAttachThreadInputHack();
+
 WinSalFrame* pToTopFrame = GetWindowPtr( hWnd );
 if( pToTopFrame && (pToTopFrame->mnStyle & 
SalFrameStyleFlags::SYSTEMCHILD) )
 BringWindowToTop( hWnd );
 
 if ( nFlags & SalFrameToTop::ForegroundTask )
 {
-// LO used to call AttachThreadInput here, which resulted in deadlocks!
-SetForegroundWindow_Impl(hWnd);
+// LO used to always call AttachThreadInput here, which resulted in 
deadlocks
+// in some installations for unknown reasons!
+if (bEnableAttachThreadInputHack)
+{
+// This magic code is necessary to connect the input focus of the
+// current window thread and the thread which owns the window that
+// should be the new foreground window.
+HWND hCurrWnd = GetForegroundWindow();
+DWORD myThreadID = GetCurrentThreadId();
+DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
+AttachThreadInput(myThreadID, currThreadID, TRUE);
+SetForegroundWindow_Impl(hWnd);
+AttachThreadInput(myThreadID, currThreadID, FALSE);
+}
+else
+SetForegroundWindow_Impl(hWnd);
 }
 
 if ( nFlags & SalFrameToTop::RestoreWhenMin )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-26 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit 518c0265efebf39ab6d1e90c4ec4e7cf52b701c6
Author: Jan-Marek Glogowski 
AuthorDate: Tue Feb 25 10:02:25 2020 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Wed Feb 26 17:02:32 2020 +0100

WIN prevent deadlock in SetForegroundWindow

As mentioned in various blogs, like Raymon Chens "The old new
thing", 2008-08-01, "I warned you: The dangers of attaching input
queues", using AttachThreadInput to steal the input from an other
thread, so SetForegroundWindow becomes more reliable, can
deadlock in that call in win32u.dll!NtUserCallHwndLock.

Stackoverflow also has a multitude of suggestions and links in
"Win32 SetForegroundWindow unreliable", to circumvent Windows
focus-stealing prevention mechanisms.

A customer is experiencing these hangs reliably and often when
opening LO windows via Java UNO, because the Window and the UNO
thread are different and trigger this code path. Removing the
calls to AttachThreadInput fixes the problem for them. This has
started lately and nobody really knows why.
I also know other customers with a similar Java UNO setup, which
don't experience them.

For better foreground handling, the calling app eventually should
either use AllowSetForegroundWindow or CoAllowSetForegroundWindow
(for COM servers), to give up the foreground / input handling.

So this just drops the AttachThreadInput calls.

Change-Id: I8de0a1744c24b1ee728b2ef6ec3aea951c54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89527
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 0321dd731a35..2a125deeddab 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1934,15 +1934,8 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop 
nFlags )
 
 if ( nFlags & SalFrameToTop::ForegroundTask )
 {
-// This magic code is necessary to connect the input focus of the
-// current window thread and the thread which owns the window that
-// should be the new foreground window.
-HWND   hCurrWnd = GetForegroundWindow();
-DWORD  myThreadID   = GetCurrentThreadId();
-DWORD  currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
-AttachThreadInput(myThreadID, currThreadID,TRUE);
+// LO used to call AttachThreadInput here, which resulted in deadlocks!
 SetForegroundWindow_Impl(hWnd);
-AttachThreadInput(myThreadID,currThreadID,FALSE);
 }
 
 if ( nFlags & SalFrameToTop::RestoreWhenMin )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-11 Thread Armin Le Grand (Collabora) (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |   61 +---
 1 file changed, 58 insertions(+), 3 deletions(-)

New commits:
commit c3e098483f4db12e9502c6cbc056e3d7498b7b6c
Author: Armin Le Grand (Collabora) 
AuthorDate: Tue Feb 11 16:33:28 2020 +0100
Commit: Armin Le Grand 
CommitDate: Tue Feb 11 21:09:33 2020 +0100

tdf#130478 add direct dash paint in GDIPlus (win)

Not as easy as hoped, see more info in the adapted
file vcl\win\gdi\gdiimpl.cxx itself.

Change-Id: I265888c65658d5e8a2a04b6f064d2baf3e1d9bad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88463
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index f15f13a94370..a26d85d1e378 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2309,7 +2309,62 @@ bool WinSalGraphicsImpl::drawPolyLine(
 const bool bStrokeUsed(0.0 != fDotDashLength);
 assert(!bStrokeUsed || (bStrokeUsed && pStroke));
 
-if(pSystemDependentData_GraphicsPath)
+// MM01 decide if to stroke directly
+static bool bDoDirectGDIPlusStroke(true);
+
+// activate to stroke directly
+if(bDoDirectGDIPlusStroke && bStrokeUsed)
+{
+// tdf#130478
+// Unfortunately GDIPlus wants to have the dash pattern relative to 
line width
+// which gets problematic due to the good old office's hairline 
definition. This
+// means that we do not *have* the real line width here, but 0.0 - or 
in the case
+// of GDIPlus (here) 1.0.
+// This is 'corrected' in several locations, e.g. 
OutputDevice::DrawPolyLineDirect
+// to 1.0 and 
VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect to 0.0.
+// This would need some cleanup what will be highly problematic due to 
the usage
+// of hairlines with line width of 0.0 being a pixel always and 
leading to different
+// visualizations. More bad - the potential of having pretty 
'invisible' lines
+// in unexpected places when zooming far out. Another problematic 
aspect of that hairline
+// definition is that this makes hairlines per definition 
view-transformation dependent
+// regarding their 'core' line width and the area they cover - handled 
in Primitives,
+// but not easy to do.
+// The way out here is to calculate back a single pixel from device to 
logic
+// (Object coordinates) to have the 'logic', view-dependent line width 
and use it.
+// That works for the cost of a matrix inversion - sigh.
+std::vector aDashArray(pStroke->size());
+double fFactor(1.0);
+
+if(rLineWidths.getX() <= 1.0)
+{
+// no 'real' line width, need to calculate back the logic line 
width
+// for a one pixel hairline
+basegfx::B2DHomMatrix aObjectToDeviceInv(rObjectToDevice);
+aObjectToDeviceInv.invert();
+const basegfx::B2DVector aOnePixel(aObjectToDeviceInv * 
basegfx::B2DVector(1.0, 1.0));
+
+if(aOnePixel.getX() > 0.0)
+{
+fFactor = 1.0 / aOnePixel.getX();
+}
+}
+else
+{
+// use logic line width
+fFactor = 1.0 / rLineWidths.getX();
+}
+
+for(size_t a(0); a < pStroke->size(); a++)
+{
+aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+}
+
+aPen.SetDashCap(Gdiplus::DashCapFlat);
+aPen.SetDashOffset(Gdiplus::REAL(0.0));
+aPen.SetDashPattern(aDashArray.data(), aDashArray.size());
+}
+
+if(!bDoDirectGDIPlusStroke && pSystemDependentData_GraphicsPath)
 {
 // MM01 - check on stroke change. Used against not used, or if oth 
used,
 // equal or different? Triangulation geometry creation depends heavily
@@ -2345,7 +2400,7 @@ bool WinSalGraphicsImpl::drawPolyLine(
 // fill data of buffered data
 pGraphicsPath = std::make_shared();
 
-if(bStrokeUsed)
+if(!bDoDirectGDIPlusStroke && bStrokeUsed)
 {
 // MM01 need to do line dashing as fallback stuff here now
 basegfx::B2DPolyPolygon aPolyPolygonLine;
@@ -2373,7 +2428,7 @@ bool WinSalGraphicsImpl::drawPolyLine(
 }
 else
 {
-// no line dashing, just copy
+// no line dashing or direct stroke, just copy
 impAddB2DPolygonToGDIPlusGraphicsPathReal(
 *pGraphicsPath,
 rPolygon,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-09 Thread Andrea Gelmini (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 121fb94b7857c8bcba27c9715374328e965bece2
Author: Andrea Gelmini 
AuthorDate: Sun Feb 9 11:10:28 2020 +0100
Commit: Julien Nabet 
CommitDate: Sun Feb 9 12:18:42 2020 +0100

Fix typo

Change-Id: I931ac89553f5025d7729274c9e00a095ae65e7cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88325
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index f05ac71dd136..4e330d5df0fe 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2438,7 +2438,7 @@ static void paintToGdiPlus(
 Gdiplus::PointF aDestPoints[3];
 Gdiplus::ImageAttributes aAttributes;
 
-// define target region as paralellogram
+// define target region as parallelogram
 aDestPoints[0].X = Gdiplus::REAL(rTR.mnDestX);
 aDestPoints[0].Y = Gdiplus::REAL(rTR.mnDestY);
 aDestPoints[1].X = Gdiplus::REAL(rTR.mnDestX + rTR.mnDestWidth);
@@ -2610,7 +2610,7 @@ bool WinSalGraphicsImpl::drawTransformedBitmap(
 nSrcHeight,
 nDestHeight);
 
-// this mode is only capable of drawing the whole bitmap to a 
paralellogram
+// this mode is only capable of drawing the whole bitmap to a 
parallelogram
 aDestPoints[0].X = Gdiplus::REAL(rNull.getX());
 aDestPoints[0].Y = Gdiplus::REAL(rNull.getY());
 aDestPoints[1].X = Gdiplus::REAL(rX.getX());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-08 Thread Andrea Gelmini (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5857124f227e1591df8984c23e5106a5db10b2a5
Author: Andrea Gelmini 
AuthorDate: Fri Feb 7 22:05:23 2020 +0100
Commit: Julien Nabet 
CommitDate: Sat Feb 8 09:31:14 2020 +0100

Fix typo

Change-Id: I99333fab507d9a7dc7583bfab20388afffd3ec20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88249
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 919395f48304..f05ac71dd136 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2353,7 +2353,7 @@ bool WinSalGraphicsImpl::drawPolyLine(
 basegfx::utils::applyLineDashing(
 rPolygon, // source
 *pStroke, // pattern
-, // traget for lines
+, // target for lines
 nullptr, // target for gaps
 fDotDashLength); // full length if available
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-03 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit e23f811c7d0f956467d359990298222cf8d2c26d
Author: Stephan Bergmann 
AuthorDate: Mon Feb 3 16:53:26 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Feb 3 23:46:14 2020 +0100

Avoid loplugin:unsignedcompare (clang-cl)

Change-Id: I95f348cc8b69b6c865ad0038b9ee0017def01e43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87896
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 26ce820a1b67..e97e8cbe4cdc 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -578,9 +578,10 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM 
wParam, LPARAM lParam, b
 
 case SAL_MSG_STARTTIMER:
 {
+auto const nParam = static_cast( lParam );
 sal_uInt64 nTime = tools::Time::GetSystemTicks();
-if ( nTime < static_cast( lParam ) )
-nTime = static_cast( lParam ) - nTime;
+if ( nTime < nParam )
+nTime = nParam - nTime;
 else
 nTime = 0;
 assert( pTimer != nullptr );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-03 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/salfont.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit b5bec747cc9af01167431f35339eff4085693ebc
Author: Stephan Bergmann 
AuthorDate: Mon Feb 3 16:49:45 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Feb 3 20:40:11 2020 +0100

Silence -Werror,-Wunused-variable (clang-cl)

Change-Id: Icbf3b6f8f1259e7e50f64e2885b1604f1a98f485
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87894
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index ccc1138e6d54..73c0bf7f2eb9 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1210,7 +1211,8 @@ bool 
WinSalGraphics::AddTempDevFont(PhysicalFontCollection* pFontCollection,
 void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
 {
 // make sure all LO shared fonts are registered temporarily
-static bool bOnce = []()
+static std::once_flag init;
+std::call_once(init, []()
 {
 auto registerFontsIn = [](const OUString& dir) {
 // collect fonts in font path that could not be registered
@@ -1246,7 +1248,7 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 registerFontsIn(aPath + "/" LIBO_SHARE_FOLDER "/fonts/truetype");
 
 return true;
-}();
+});
 
 ImplEnumInfo aInfo;
 aInfo.mhDC  = getHDC();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-05 Thread Stephan Bergmann (via logerrit)
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d5acf921efbd3170e487d4656e38c23c3f835094
Author: Stephan Bergmann 
AuthorDate: Thu Dec 5 09:43:29 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 5 16:24:24 2019 +0100

loplugin:redundantpointerops (clang-cl)

Change-Id: Ibba507b6c2986a529ae75ad84781825f161f2be5
Reviewed-on: https://gerrit.libreoffice.org/84511
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 935aeb84d2a4..842c2f51d77d 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -211,7 +211,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex,
 
 if (!GlobalWinGlyphCache::get()->AllocateTexture(aElement, nBitmapWidth, 
nBitmapHeight))
 return false;
-if (!aDC->copyToTexture(*aElement.maTexture.get()))
+if (!aDC->copyToTexture(*aElement.maTexture))
 return false;
 
 maWinGlyphCache.PutDrawElementInCache(std::move(aElement), nGlyphIndex);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-21 Thread Caolán McNamara (via logerrit)
 vcl/win/window/salframe.cxx |   12 
 1 file changed, 12 deletions(-)

New commits:
commit 06be436363f1b9d72a19aba7c1e6df3fcf6c7844
Author: Caolán McNamara 
AuthorDate: Mon Oct 21 11:09:06 2019 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 21 12:50:36 2019 +0200

ditch archaic Russian-only ui font tweak

Change-Id: Ib45ea8cebe5f4069e05353bc5f1be6b67045a18c
Reviewed-on: https://gerrit.libreoffice.org/81216
Tested-by: Jenkins
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 bb6a6fed2e44..efb9f2a5c301 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2724,18 +2724,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
 aStyleSettings.SetFloatTitleFont( aFloatTitleFont );
 aStyleSettings.SetHelpFont( aHelpFont );
 aStyleSettings.SetIconFont( aIconFont );
-// We prefer Arial in the russian version, because MS Sans Serif
-// is too wide for the dialogs
-if ( rSettings.GetLanguageTag().getLanguageType() == LANGUAGE_RUSSIAN )
-{
-OUString aFontName = aAppFont.GetFamilyName();
-OUString aFirstName = aFontName.getToken( 0, ';' );
-if ( aFirstName.equalsIgnoreAsciiCase( "MS Sans Serif" ) )
-{
-aFontName = "Arial;" + aFontName;
-aAppFont.SetFamilyName( aFontName );
-}
-}
 
 if ( aAppFont.GetWeight() > WEIGHT_NORMAL )
 aAppFont.SetWeight( WEIGHT_NORMAL );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-12 Thread Mike Kaganski (via logerrit)
 vcl/win/app/salinst.cxx |   51 
 1 file changed, 39 insertions(+), 12 deletions(-)

New commits:
commit b7e4e85170e383ecd1cba56913c901783cb8d1d6
Author: Mike Kaganski 
AuthorDate: Sat Oct 12 13:06:41 2019 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 12 13:36:06 2019 +0200

tdf#128100: add explicit service pack and build info to Windows version

Change-Id: I7cedb51f52315b006506bb37fb3562a48c7f0f3d
Reviewed-on: https://gerrit.libreoffice.org/80712
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index cc4fd65d7719..2c68ec354bf2 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -988,20 +988,25 @@ int 
WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POIN
 return UnhandledExceptionFilter( pExceptionInfo );
 }
 
+typedef LONG NTSTATUS;
+typedef NTSTATUS(WINAPI* RtlGetVersion_t)(PRTL_OSVERSIONINFOW);
+constexpr NTSTATUS STATUS_SUCCESS = 0x;
+
 OUString WinSalInstance::getOSVersion()
 {
+OUStringBuffer aVer(50); // capacity for string like "Windows 6.1 Service 
Pack 1 build 7601"
+aVer.append("Windows ");
 // GetVersion(Ex) and VersionHelpers (based on VerifyVersionInfo) API are
 // subject to manifest-based behavior since Windows 8.1, so give wrong 
results.
 // Another approach would be to use NetWkstaGetInfo, but that has some 
small
 // reported delays (some milliseconds), and might get slower in domains 
with
 // poor network connections.
 // So go with a solution described at 
https://msdn.microsoft.com/en-us/library/ms724429
-HINSTANCE hLibrary = LoadLibraryW(L"kernel32.dll");
-if (hLibrary != nullptr)
+bool bHaveVerFromKernel32 = false;
+if (HMODULE h_kernel32 = GetModuleHandleW(L"kernel32.dll"))
 {
 wchar_t szPath[MAX_PATH];
-DWORD dwCount = GetModuleFileNameW(hLibrary, szPath, 
SAL_N_ELEMENTS(szPath));
-FreeLibrary(hLibrary);
+DWORD dwCount = GetModuleFileNameW(h_kernel32, szPath, 
SAL_N_ELEMENTS(szPath));
 if (dwCount != 0 && dwCount < SAL_N_ELEMENTS(szPath))
 {
 dwCount = GetFileVersionInfoSizeW(szPath, nullptr);
@@ -1014,19 +1019,41 @@ OUString WinSalInstance::getOSVersion()
 UINT dwBlockSz = 0;
 if (VerQueryValueW(ver.get(), L"\\", , ) 
!= FALSE && dwBlockSz >= sizeof(VS_FIXEDFILEINFO))
 {
-VS_FIXEDFILEINFO *vinfo = static_cast(pBlock);
-OUStringBuffer aVer;
-aVer.append("Windows ");
-
aVer.append(static_cast(HIWORD(vinfo->dwProductVersionMS)));
-aVer.append(".");
-
aVer.append(static_cast(LOWORD(vinfo->dwProductVersionMS)));
-return aVer.makeStringAndClear();
+VS_FIXEDFILEINFO* vi1 = 
static_cast(pBlock);
+
aVer.append(OUString::number(HIWORD(vi1->dwProductVersionMS)) + "."
++ 
OUString::number(LOWORD(vi1->dwProductVersionMS)));
+bHaveVerFromKernel32 = true;
 }
 }
 }
 }
 }
-return "unknown";
+// Now use RtlGetVersion (which is not subject to deprecation for 
GetVersion(Ex) API)
+// to get build number and SP info
+bool bHaveVerFromRtlGetVersion = false;
+if (HMODULE h_ntdll = GetModuleHandleW(L"ntdll.dll"))
+{
+if (auto RtlGetVersion
+= reinterpret_cast(GetProcAddress(h_ntdll, 
"RtlGetVersion")))
+{
+RTL_OSVERSIONINFOW vi2{}; // initialize with zeroes - a better 
alternative to memset
+vi2.dwOSVersionInfoSize = sizeof(vi2);
+if (STATUS_SUCCESS == RtlGetVersion())
+{
+if (!bHaveVerFromKernel32) // we failed above; let's hope this 
would be useful
+aVer.append(OUString::number(vi2.dwMajorVersion) + "."
++ OUString::number(vi2.dwMinorVersion));
+aVer.append(" ");
+if (vi2.szCSDVersion[0])
+aVer.append(o3tl::toU(vi2.szCSDVersion)).append(" ");
+aVer.append("Build " + OUString::number(vi2.dwBuildNumber));
+bHaveVerFromRtlGetVersion = true;
+}
+}
+}
+if (!bHaveVerFromKernel32 && !bHaveVerFromRtlGetVersion)
+aVer.append("unknown");
+return aVer.makeStringAndClear();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-28 Thread Juergen Funk (via logerrit)
 vcl/win/gdi/salprn.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit c16bfef0d51ad903defdb2bacb4550de481d3074
Author: Juergen Funk 
AuthorDate: Tue Aug 27 09:22:17 2019 +0200
Commit: Juergen Funk (CIB) 
CommitDate: Wed Aug 28 14:23:11 2019 +0200

tdf#127192 Printing in main thread

the wollmux has change the dialogs form swing to the LO-Dialogs,
and when printig with MS-PDF then LO hang on this line.
The reason is wollmux run in it own thread, but this thread has
no win-message-pump, when the printer-driver would open the
FileSave-Dialog then it hangs, because the message-pump
is missing in this thread.

The swing has made it own win-message-pump for this
thread.

Change-Id: Ia5131464dcc5f166133a3302d29550e945dd1026
Reviewed-on: https://gerrit.libreoffice.org/78170
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Juergen Funk (CIB) 
Tested-by: Juergen Funk (CIB) 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 8119bad8cdb7..73ade5080c55 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -52,6 +52,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -1502,8 +1504,8 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
 else
 aInfo.lpszOutput = nullptr;
 
-// start Job
-int nRet = lcl_StartDocW( hDC, , this );
+// start Job, in the main thread
+int nRet = vcl::solarthread::syncExecute([hDC, this, ]() -> int { 
return lcl_StartDocW(hDC, , this); });
 
 if ( nRet <= 0 )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-06 Thread Andrea Gelmini (via logerrit)
 vcl/win/gdi/salfont.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fba2fe825e8dfb9fd084186e3171bbea35297c28
Author: Andrea Gelmini 
AuthorDate: Fri Jul 5 21:19:05 2019 +
Commit: Julien Nabet 
CommitDate: Sat Jul 6 12:45:57 2019 +0200

Fix typo

Change-Id: Id8f72781d0338344bc96efb5cf62b67174aa80eb
Reviewed-on: https://gerrit.libreoffice.org/75152
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 56685cda8eb9..5a866092bf30 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1125,7 +1125,7 @@ static OUString lcl_GetFontFamilyName(const OUString& 
rFontFileURL)
 // TODO: use TTLoadEmbeddedFont (needs an EOT as input, so we have to add 
a header to the TTF)
 // TODO: forward the EOT from the AddTempDevFont call side, if VCL 
supports it
 INetURLObject aTTFUrl(rFontFileURL);
-// GetBase() stripts the extension
+// GetBase() strips the extension
 OUString aFilename = 
aTTFUrl.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
 if (!CreateScalableFontResourceW(0, o3tl::toW(aResSystemPath.getStr()),
 o3tl::toW(aFilename.getStr()), 
o3tl::toW(aTTFUrl.GetPath().getStr(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-05 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/gdi/salfont.cxx |  167 ++--
 1 file changed, 64 insertions(+), 103 deletions(-)

New commits:
commit 5111baa39117f6e16909566e28a8663a32e25269
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jul 4 19:27:31 2019 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jul 5 19:39:55 2019 +0200

WIN get embedded font info from EnumFontFamiliesEx

Instead of some manual decoding of the .fot file, this extracts
all the relevant information of the registered font using the
default routines already used when enumerating the system fonts.

We still have to extract the font family from the .fot file to
know the registered family name of the embedded font.

And it uses the OSL functions to create the temporary font resource
file name and generally adds more SAL_WARNs when some part of the
private font registration fails.

Change-Id: I5e118bf1f3bc1fb7bbf4c68a383a45892dffaf98
Reviewed-on: https://gerrit.libreoffice.org/75102
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 0dfd4fdc62a1..56685cda8eb9 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1105,111 +1106,71 @@ void ImplReleaseTempFonts(SalData& rSalData, bool bAll)
 }
 }
 
-static bool ImplGetFontAttrFromFile( const OUString& rFontFileURL,
-FontAttributes& rDFA )
+static OUString lcl_GetFontFamilyName(const OUString& rFontFileURL)
 {
-OUString aUSytemPath;
-OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, 
aUSytemPath ) );
-
-// get FontAttributes from a *fot file
-// TODO: use GetTTGlobalFontInfo() to access the font directly
-rDFA.SetQuality( 1000 );
-rDFA.SetFamilyType(FAMILY_DONTKNOW);
-rDFA.SetWidthType(WIDTH_DONTKNOW);
-rDFA.SetWeight(WEIGHT_DONTKNOW);
-rDFA.SetItalic(ITALIC_DONTKNOW);
-rDFA.SetPitch(PITCH_DONTKNOW);
-
 // Create temporary file name
-wchar_t aResourceName[512];
-int nMaxLen = SAL_N_ELEMENTS(aResourceName) - 16;
-int nLen = GetTempPathW( nMaxLen, aResourceName );
-wcsncpy( aResourceName + nLen, L"soAAT.fot", std::max( 0, nMaxLen - nLen 
));
-DeleteFileW( aResourceName );
-
-// Create font resource file (typically with a .fot file name extension).
-CreateScalableFontResourceW( 0, aResourceName, 
o3tl::toW(aUSytemPath.getStr()), nullptr );
+OUString aTempFileURL;
+if (osl::File::E_None != osl::File::createTempFile(nullptr, nullptr, 
))
+return OUString();
+osl::File::remove(aTempFileURL);
+OUString aResSystemPath;
+osl::FileBase::getSystemPathFromFileURL(aTempFileURL, aResSystemPath);
+
+// Create font resource file (.fot)
+// There is a limit of 127 characters for the full path passed via 
lpszFile, so we have to
+// split the font URL and pass it as two parameters. As a result we can't 
use
+// CreateScalableFontResource for renaming, as it now expects the font in 
the system path.
+// But it's still good to use it for family name extraction, we're 
currently after.
+// BTW: it doesn't help to prefix the lpszFile with \\?\ to support larger 
paths.
+// TODO: use TTLoadEmbeddedFont (needs an EOT as input, so we have to add 
a header to the TTF)
+// TODO: forward the EOT from the AddTempDevFont call side, if VCL 
supports it
+INetURLObject aTTFUrl(rFontFileURL);
+// GetBase() stripts the extension
+OUString aFilename = 
aTTFUrl.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
+if (!CreateScalableFontResourceW(0, o3tl::toW(aResSystemPath.getStr()),
+o3tl::toW(aFilename.getStr()), 
o3tl::toW(aTTFUrl.GetPath().getStr(
+{
+sal_uInt32 nError = GetLastError();
+SAL_WARN("vcl.fonts", "CreateScalableFontResource failed for " << 
aResSystemPath << " "
+  << aFilename << " " << aTTFUrl.GetPath() << " " 
<< nError);
+return OUString();
+}
 
 // Open and read the font resource file
-OUString aFotFileName = o3tl::toU( aResourceName );
-osl::FileBase::getFileURLFromSystemPath( aFotFileName, aFotFileName );
-osl::File aFotFile( aFotFileName );
-osl::FileBase::RC aError = aFotFile.open( osl_File_OpenFlag_Read );
-if( aError != osl::FileBase::E_None )
-return false;
+osl::File aFotFile(aTempFileURL);
+if (osl::FileBase::E_None != aFotFile.open(osl_File_OpenFlag_Read))
+return OUString();
 
 sal_uInt64  nBytesRead = 0;
 charaBuffer[4096];
 aFotFile.read( aBuffer, sizeof( aBuffer ), nBytesRead );
 // clean up temporary resource file
 aFotFile.close();
-DeleteFileW( aResourceName );
+osl::File::remove(aTempFileURL);
 
 // retrieve font family name from byte offset 0x4F6
-sal_uInt64 i = 0x4F6;
-sal_uInt64 

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

2019-05-06 Thread Miklos Vajna (via logerrit)
 vcl/win/gdi/DWriteTextRenderer.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit e9813126b7648b735d2231a703190ee48b8bbe42
Author: Miklos Vajna 
AuthorDate: Mon May 6 16:44:56 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 6 18:57:51 2019 +0200

Related: tdf#114209 vcl DirectWrite rotation: don't truncate to int degrees

Pointed out in the post-commit review of
, thanks Mike.

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

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 98daff12c4a4..93f877d2aea9 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -401,8 +401,9 @@ 
WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, f
 {
 // DWrite angle is in clockwise degrees, our orientation is in 
counter-clockwise 10th
 // degrees.
-aTransform
-= aTransform * 
D2D1::Matrix3x2F::Rotation(-rLayout.GetOrientation() / 10, rBaseline);
+aTransform = aTransform
+ * D2D1::Matrix3x2F::Rotation(
+   -static_cast(rLayout.GetOrientation()) / 10, 
rBaseline);
 }
 mpRenderTarget->SetTransform(aTransform);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-26 Thread Stephan Bergmann (via logerrit)
 vcl/win/app/salinst.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit ec3916d424f828b5b2459efb4097abf95835a2ae
Author: Stephan Bergmann 
AuthorDate: Fri Apr 26 08:45:54 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 26 11:30:00 2019 +0200

Reuse base class IsCurrentThread

Change-Id: Ie185983d7cf546def5e310493c7b26f520bbe08d
Reviewed-on: https://gerrit.libreoffice.org/71344
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index b754dd35d362..c4a290adb092 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -213,8 +213,7 @@ void ImplSalYieldMutexRelease()
 bool SalYieldMutex::IsCurrentThread() const
 {
 if ( !GetSalData()->mpInstance->m_nNoYieldLock )
-// For the Windows backend, the LO identifier is the system thread ID
-return m_nThreadId == GetCurrentThreadId();
+return SolarMutex::IsCurrentThread();
 else
 return GetSalData()->mpInstance->IsMainThread();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-23 Thread Miklos Vajna (via logerrit)
 vcl/win/gdi/winlayout.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4657335fa5bcbe7980f229ca41ddd82d93c355eb
Author: Miklos Vajna 
AuthorDate: Thu Apr 18 18:03:36 2019 +0200
Commit: Miklos Vajna 
CommitDate: Tue Apr 23 10:26:16 2019 +0200

tdf#113076 vcl windows opengl: specific italic set font was clipped on ...

... right edge in presentation mode.

This seems to be a problem since commit
a51b7a1c3a7e7cf7b0c733e1dec40288278c1884 (tdf#103831, tdf#100986: Force
using GDI when needed, 2017-03-03), which blacklisted DirectWrite in the
OpenGL case for both vertical text and horizontally stretched text.

I tested that the overlapping characters problem from tdf#103831 is not
re-introduced, and switching to DW (in the horizontal stretching &&
OpenGL case) fixes the unwanted clipping of glyphs for the tdf#113076
bugdoc.

This also simplifies the situation, since the general rule since commit
d436065bc1c68fc2d90e73253d8c00503c72dfd0 (tdf#103725: Default to GDI
even with the new layout engine, 2016-11-15) is that non-OpenGL defaults
to GDI rendering and OpenGL defaults to DirectWrite rendering.

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

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 797ce2eb8ffc..b3fe0132b7df 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -458,12 +458,12 @@ void WinSalGraphics::DrawTextLayout(const 
GenericSalLayout& rLayout)
 
 const WinFontInstance* pWinFont = static_cast(());
 const HFONT hLayoutFont = pWinFont->GetHFONT();
+bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter;
 
 // Our DirectWrite renderer is incomplete, skip it for non-horizontal or
 // stretched text.
-bool bForceGDI = rLayout.GetOrientation() || pWinFont->hasHScale();
+bool bForceGDI = rLayout.GetOrientation() || (pWinFont->hasHScale() && 
!bUseOpenGL);
 
-bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter;
 if (!bUseOpenGL)
 {
 // no OpenGL, just classic rendering
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-07 Thread Libreoffice Gerrit user
 vcl/win/gdi/salnativewidgets-luna.cxx |   27 +--
 1 file changed, 17 insertions(+), 10 deletions(-)

New commits:
commit 5f2b67e7c1aa4ea7bb66292207ed8c9b20a6f78f
Author: Miklos Vajna 
AuthorDate: Thu Mar 7 18:05:11 2019 +0100
Commit: Miklos Vajna 
CommitDate: Thu Mar 7 21:45:49 2019 +0100

tdf#119947 vcl opengl win: fix fontwork popup menu

Regression from commit b160db926b574b7e9d6696d49dbbce8dd289aade
(tdf#96947 vcl opengl win: fix background of menu items w/ check/radio
marks, 2018-05-14), the problem was that GetMenuPopupMarkRegion() did an
unconditional downcast from ImplControlValue to MenupopupValue.  This
looked safe, but when the extracted function was used in
WinSalGraphics::drawNativeControl(), then that argument was not safe to
downcast.

Fix the problem by switching to safe downcast, and returning an empty
rectangle (instead of a bogus one) on error.

This way the old bug stays fixed but fontwork popup menu works again as
well.

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

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index efa69457c083..422a86c27045 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -496,18 +496,21 @@ static tools::Rectangle GetMenuPopupMarkRegion(const 
ImplControlValue& rValue)
 {
 tools::Rectangle aRet;
 
-const MenupopupValue& rMVal(static_cast(rValue));
-aRet.SetTop(rMVal.maItemRect.Top());
-aRet.SetBottom(rMVal.maItemRect.Bottom() + 1); // see below in 
drawNativeControl
+auto pMVal = dynamic_cast();
+if (!pMVal)
+return aRet;
+
+aRet.SetTop(pMVal->maItemRect.Top());
+aRet.SetBottom(pMVal->maItemRect.Bottom() + 1); // see below in 
drawNativeControl
 if (AllSettings::GetLayoutRTL())
 {
-aRet.SetRight(rMVal.maItemRect.Right() + 1);
-aRet.SetLeft(aRet.Right() - (rMVal.getNumericVal() - 
rMVal.maItemRect.Left()));
+aRet.SetRight(pMVal->maItemRect.Right() + 1);
+aRet.SetLeft(aRet.Right() - (pMVal->getNumericVal() - 
pMVal->maItemRect.Left()));
 }
 else
 {
-aRet.SetRight(rMVal.getNumericVal());
-aRet.SetLeft(rMVal.maItemRect.Left());
+aRet.SetRight(pMVal->getNumericVal());
+aRet.SetLeft(pMVal->maItemRect.Left());
 }
 
 return aRet;
@@ -1173,9 +1176,13 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 
 if (pImpl && nType == ControlType::MenuPopup && (nPart == 
ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark))
 {
-cacheRect = GetMenuPopupMarkRegion(aValue);
-buttonRect = cacheRect;
-keySize = cacheRect.GetSize();
+tools::Rectangle aRectangle = GetMenuPopupMarkRegion(aValue);
+if (!aRectangle.IsEmpty())
+{
+cacheRect = GetMenuPopupMarkRegion(aValue);
+buttonRect = cacheRect;
+keySize = cacheRect.GetSize();
+}
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-26 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8e9a2c860eadfd429a24a0cb98bf5c2aa4a60e61
Author: Noel Grandin 
AuthorDate: Tue Feb 26 10:23:45 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 26 10:23:45 2019 +0200

fix windows build

after
commit b792e4ee22d7b625a214f6eceb1c223f35b9a606
sal_uLong->sal_uInt32 in drawEPS

Change-Id: Ic35c165cd9dd756e229c33f643355150d6249688

diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index f1cd729daf1b..bc4a6ac27414 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -186,7 +186,7 @@ public:
 long nX, long nY,
 long nWidth, long nHeight,
 void* pPtr,
-sal_uLong nSize ) override;
+sal_uInt32 nSize ) override;
 
 virtual bool blendBitmap(
 const SalTwoRect&,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-18 Thread Libreoffice Gerrit user
 vcl/win/window/salframe.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit dd199ccb46c036713c704a23e137d04623936e47
Author: Mike Kaganski 
AuthorDate: Sun Feb 17 16:30:55 2019 +0300
Commit: Mike Kaganski 
CommitDate: Mon Feb 18 09:28:19 2019 +0100

tdf#98896: GetWidth/GetHeight vs getWidth/getHeight strikes back!

Regression from commit d04ee940a04922f6fc511882cff956a03b39583b

Before commit 73f89b5d36dbae26072a1e749f10dfd6ffb6dd6e, the code to
calculate full-screen rectangle only had one mode, and used
Rectangle::Width+1/Rectangle::Height+1, with a comment "difference
between java/awt convention and vcl".

Commit 73f89b5d36dbae26072a1e749f10dfd6ffb6dd6e added another calc
mode, and used Rectangle::GetWidth()/Rectangle::GetHeight(), which
compensate for the +1 themselves.

Then, in commit 6b5059c7b7129c3b9f00d784b6fa5248a24a6d4b, the original
mode was changed to Rectangle::GetWidth()+1/Rectangle::GetHeight()+1,
which was incorrect (resulting in an extra +1 for that code path).

And last, in commit d04ee940a04922f6fc511882cff956a03b39583b, both
the original mode, and the new mode were changed from GetWidth()/
GetHeight() to getWidth()/getHeight(), which fixed the original
mode, but broke second mode (the +1 wasn't added there, so it got
lost).

This change stangardises both modes to use the GetWidth()/GetHeight()
pair. Yay for more functions differing by case and meaning!

Change-Id: Id64684d01a55849d18557d06c59e91b5cb93385d
Reviewed-on: https://gerrit.libreoffice.org/67941
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index c6d4d9057981..4fcb4947bc89 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -762,8 +762,8 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* 
pFrame,
 tools::Rectangle aRect = Application::GetScreenPosSizePixel( 
pFrame->mnDisplay );
 nScreenX = aRect.Left();
 nScreenY = aRect.Top();
-nScreenDX = aRect.getWidth()+1;  // difference between java/awt 
convention and vcl
-nScreenDY = aRect.getHeight()+1; // difference between java/awt 
convention and vcl
+nScreenDX = aRect.GetWidth();
+nScreenDY = aRect.GetHeight();
 }
 else
 {
@@ -774,8 +774,8 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* 
pFrame,
 }
 nScreenX  = aCombined.Left();
 nScreenY  = aCombined.Top();
-nScreenDX = aCombined.getWidth();
-nScreenDY = aCombined.getHeight();
+nScreenDX = aCombined.GetWidth();
+nScreenDY = aCombined.GetHeight();
 }
 }
 catch( Exception& )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-06 Thread Libreoffice Gerrit user
 vcl/win/gdi/salvd.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 48f1451407443450e49b1253e95671d9513021b8
Author: Dmitriy Shilin 
AuthorDate: Tue Feb 5 22:01:10 2019 -0800
Commit: Mike Kaganski 
CommitDate: Wed Feb 6 11:14:09 2019 +0100

tdf#107792 vcl/win: simplify WinSalVirtualDevice::~WinSalVirtualDevice()

Change-Id: I61c2ee1e8363a022239d5572e3506df9da0d5e1d
Reviewed-on: https://gerrit.libreoffice.org/67433
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index bd6310b38759..695ee68d56f1 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -179,9 +179,6 @@ WinSalVirtualDevice::~WinSalVirtualDevice()
 SelectBitmap( mpGraphics->getHDC(), mhDefBmp );
 if( !mbForeignDC )
 DeleteDC( mpGraphics->getHDC() );
-
-mhBmp.reset();
-mpGraphics.reset();
 }
 
 SalGraphics* WinSalVirtualDevice::AcquireGraphics()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-02-05 Thread Libreoffice Gerrit user
 vcl/win/gdi/salvd.cxx |   68 ++
 1 file changed, 31 insertions(+), 37 deletions(-)

New commits:
commit d3e888cf9e053259076671e8bea0d667c1f92357
Author: Dmitriy Shilin 
AuthorDate: Wed Jan 30 22:48:07 2019 -0800
Commit: Mike Kaganski 
CommitDate: Wed Feb 6 08:29:41 2019 +0100

tdf#107792 vcl/win: simplify WinSalInstance::CreateVirtualDevice

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

diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 6dc94f0b12a2..bd6310b38759 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -78,25 +78,11 @@ std::unique_ptr 
WinSalInstance::CreateVirtualDevice( SalGraphi
const 
SystemGraphicsData* pData )
 {
 WinSalGraphics* pGraphics = static_cast(pSGraphics);
-
-sal_uInt16 nBitCount;
-switch (eFormat)
-{
-case DeviceFormat::BITMASK:
-nBitCount = 1;
-break;
-default:
-nBitCount = 0;
-break;
-}
-
-HDC hDC = nullptr;
-HBITMAP hBmp = nullptr;
+HDC hDC = nullptr;
 
 if( pData )
 {
 hDC = (pData->hDC) ? pData->hDC : GetDC(pData->hWnd);
-hBmp = nullptr;
 if (hDC)
 {
 nDX = GetDeviceCaps( hDC, HORZRES );
@@ -112,39 +98,47 @@ std::unique_ptr 
WinSalInstance::CreateVirtualDevice( SalGraphi
 {
 hDC = CreateCompatibleDC( pGraphics->getHDC() );
 SAL_WARN_IF( !hDC, "vcl", "CreateCompatibleDC failed: " << 
WindowsErrorString( GetLastError() ) );
+}
+
+if (!hDC)
+return nullptr;
 
-void *pDummy;
-hBmp = 
WinSalVirtualDevice::ImplCreateVirDevBitmap(pGraphics->getHDC(), nDX, nDY, 
nBitCount, );
+sal_uInt16 nBitCount = (eFormat == DeviceFormat::BITMASK) ? 1 : 0;
 
+HBITMAP hBmp = nullptr;
+if (!pData)
+{
 // #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
+hBmp = WinSalVirtualDevice::ImplCreateVirDevBitmap(pGraphics->getHDC(),
+   nDX, nDY, nBitCount,
+   
::temporary(nullptr));
 }
 
-if (hDC)
-{
-WinSalVirtualDevice*pVDev = new WinSalVirtualDevice(hDC, hBmp, 
nBitCount, (pData != nullptr && pData->hDC != nullptr ), nDX, nDY);
-SalData*pSalData = GetSalData();
-WinSalGraphics* pVirGraphics = new 
WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), nullptr, 
pVDev);
-pVirGraphics->SetLayout( SalLayoutFlags::NONE );   // by default no! 
mirroring for VirtualDevices, can be enabled with EnableRTL()
-pVirGraphics->setHDC(hDC);
-if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
-{
-pVirGraphics->setDefPal(SelectPalette( hDC, pSalData->mhDitherPal, 
TRUE ));
-RealizePalette( hDC );
-}
-pVirGraphics->InitGraphics();
+const bool bForeignDC = pData != nullptr && pData->hDC != nullptr;
+const SalData* pSalData = GetSalData();
 
-pVDev->setGraphics(pVirGraphics);
+WinSalVirtualDevice* pVDev = new WinSalVirtualDevice(hDC, hBmp, nBitCount,
+ bForeignDC, nDX, nDY);
 
-return std::unique_ptr(pVDev);
-}
-else
+WinSalGraphics* pVirGraphics = new 
WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE,
+  pGraphics->isScreen(), 
nullptr, pVDev);
+
+// by default no! mirroring for VirtualDevices, can be enabled with 
EnableRTL()
+pVirGraphics->SetLayout( SalLayoutFlags::NONE );
+pVirGraphics->setHDC(hDC);
+
+if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
 {
-if ( hBmp )
-DeleteBitmap( hBmp );
-return nullptr;
+pVirGraphics->setDefPal(SelectPalette( hDC, pSalData->mhDitherPal, 
TRUE ));
+RealizePalette( hDC );
 }
+
+pVirGraphics->InitGraphics();
+pVDev->setGraphics(pVirGraphics);
+
+return std::unique_ptr(pVDev);
 }
 
 WinSalVirtualDevice::WinSalVirtualDevice(HDC hDC, HBITMAP hBMP, sal_uInt16 
nBitCount, bool bForeignDC, long nWidth, long nHeight)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-02-01 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx   |8 
 vcl/win/gdi/salnativewidgets-luna.cxx |4 ++--
 vcl/win/gdi/winlayout.cxx |2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 77c9bcb1af09d20a813cc3a16c50a57ab09eb0b5
Author: Dmitriy Shilin 
AuthorDate: Wed Jan 30 21:40:28 2019 -0800
Commit: Mike Kaganski 
CommitDate: Fri Feb 1 09:14:30 2019 +0100

tdf#122820 vcl/win: do not use un-named C++ objects

Change-Id: Ifbaf53ff002f8f61f9f49ab9bb14e7598e006402
Reviewed-on: https://gerrit.libreoffice.org/67187
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 432d5add15a5..f4af3a06fecb 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -766,9 +766,9 @@ void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry,
 SalTwoRect  aPosAry = rPosAry;
 const HDC hDC = mrParent.getHDC();
 
-ScopedSelectedHBRUSH(hDC, CreateSolidBrush(RGB(nMaskColor.GetRed(),
-   nMaskColor.GetGreen(),
-   nMaskColor.GetBlue(;
+ScopedSelectedHBRUSH hBrush(hDC, CreateSolidBrush(RGB(nMaskColor.GetRed(),
+  
nMaskColor.GetGreen(),
+  
nMaskColor.GetBlue(;
 
 // WIN/WNT seems to have a minor problem mapping the correct color of the
 // mask to the palette if we draw the DIB directly ==> draw DDB
@@ -1563,7 +1563,7 @@ void WinSalGraphicsImpl::DrawPixelImpl( long nX, long nY, 
COLORREF crColor )
 return;
 }
 
-ScopedSelectedHBRUSH(hDC, CreateSolidBrush(crColor));
+ScopedSelectedHBRUSH hBrush(hDC, CreateSolidBrush(crColor));
 PatBlt(hDC, static_cast(nX), static_cast(nY), int(1), int(1), 
PATINVERT);
 }
 
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 7f5a33737d15..9066a21ca884 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -459,7 +459,7 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 GdiGradientFill( hDC, vert, 2, g_rect, 1, GRADIENT_FILL_RECT_V );
 
 // and a darker horizontal line under that
-ScopedSelectedHPEN(hDC, CreatePen(PS_SOLID, 1, RGB( 0xb0, 0xb0, 
0xb0)));
+ScopedSelectedHPEN hPen(hDC, CreatePen(PS_SOLID, 1, RGB( 0xb0, 0xb0, 
0xb0)));
 
 MoveToEx( hDC, rc.left, gradient_bottom, nullptr );
 LineTo( hDC, rc.right, gradient_bottom );
@@ -480,7 +480,7 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 to_x = rc.right;
 from_y = to_y = rc.top;
 
-ScopedSelectedHPEN(hDC, CreatePen(PS_SOLID, 1, RGB( 0xb0, 0xb0, 
0xb0)));
+ScopedSelectedHPEN hPen(hDC, CreatePen(PS_SOLID, 1, RGB( 0xb0, 
0xb0, 0xb0)));
 
 MoveToEx( hDC, from_x, from_y, nullptr );
 LineTo( hDC, to_x, to_y );
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 24dbcb1b9815..9b63fc583516 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -368,7 +368,7 @@ hb_font_t* WinFontInstance::ImplInitHbFont()
 {
 // Get the font metrics.
 HDC hDC = m_pGraphics->getHDC();
-ScopedSelectedHFONT(hDC, CreateFontIndirectW());
+ScopedSelectedHFONT hFont(hDC, CreateFontIndirectW());
 GetTextMetricsW(hDC, );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-22 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   46 --
 vcl/win/gdi/gdiimpl.hxx |2 ++
 2 files changed, 42 insertions(+), 6 deletions(-)

New commits:
commit 81ab8e736fafbe826008939568e2d446204ae080
Author: Xisco Faulí 
AuthorDate: Tue Jan 22 14:04:22 2019 +0100
Commit: Xisco Faulí 
CommitDate: Tue Jan 22 17:09:46 2019 +0100

Revert "tdf#107792 vcl/win: do not afraid to delete stock objects"

This reverts commit b940eb5903f583089e99042d60ceae635ae2af83.

So far tdf#122877, tdf#122867 and tdf#122851 have been found

Change-Id: Id69db9e705001aa8b561642b4bb9e70a2fc3fcbd
Reviewed-on: https://gerrit.libreoffice.org/66737
Reviewed-by: Dmitriy Shilin 
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b3f5b0735bb0..a9406729fa21 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -210,7 +210,9 @@ WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& 
rParent):
 mbXORMode(false),
 mbPen(false),
 mhPen(nullptr),
+mbStockPen(false),
 mbBrush(false),
+mbStockBrush(false),
 mhBrush(nullptr)
 {
 }
@@ -218,10 +220,16 @@ WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& 
rParent):
 WinSalGraphicsImpl::~WinSalGraphicsImpl()
 {
 if ( mhPen )
-DeletePen( mhPen );
+{
+if ( !mbStockPen )
+DeletePen( mhPen );
+}
 
 if ( mhBrush )
-DeleteBrush( mhBrush );
+{
+if ( !mbStockBrush )
+DeleteBrush( mhBrush );
+}
 }
 
 void WinSalGraphicsImpl::Init()
@@ -1278,6 +1286,7 @@ void WinSalGraphicsImpl::SetLineColor()
 
 // set new data
 mbPen   = FALSE;
+mbStockPen  = TRUE;
 }
 
 void WinSalGraphicsImpl::SetLineColor(Color nColor)
@@ -1285,8 +1294,12 @@ void WinSalGraphicsImpl::SetLineColor(Color nColor)
 COLORREF nPenColor = PALETTERGB(nColor.GetRed(),
 nColor.GetGreen(),
 nColor.GetBlue());
+bool bStockPen = false;
+
 HPEN hNewPen = SearchStockPen(nPenColor);
-if (!hNewPen)
+if (hNewPen)
+bStockPen = true;
+else
 hNewPen = MakePen(nColor);
 
 ResetPen(hNewPen);
@@ -1295,6 +1308,7 @@ void WinSalGraphicsImpl::SetLineColor(Color nColor)
 mnPenColor  = nPenColor;
 maLineColor = nColor;
 mbPen   = TRUE;
+mbStockPen  = bStockPen;
 }
 
 HPEN WinSalGraphicsImpl::SearchStockPen(COLORREF nPenColor)
@@ -1336,9 +1350,16 @@ void WinSalGraphicsImpl::ResetPen(HPEN hNewPen)
 HPEN hOldPen = SelectPen(mrParent.getHDC(), hNewPen);
 
 if (mhPen)
-DeletePen(mhPen);
+{
+if (!mbStockPen)
+{
+DeletePen(mhPen);
+}
+}
 else
+{
 mrParent.mhDefPen = hOldPen;
+}
 
 mhPen = hNewPen;
 }
@@ -1349,6 +1370,7 @@ void WinSalGraphicsImpl::SetFillColor()
 
 // set new data
 mbBrush = FALSE;
+mbStockBrush = TRUE;
 }
 
 void WinSalGraphicsImpl::SetFillColor(Color nColor)
@@ -1356,8 +1378,12 @@ void WinSalGraphicsImpl::SetFillColor(Color nColor)
 COLORREF nBrushColor = PALETTERGB(nColor.GetRed(),
   nColor.GetGreen(),
   nColor.GetBlue());
+bool bStockBrush = false;
+
 HBRUSH hNewBrush = SearchStockBrush(nBrushColor);
-if (!hNewBrush)
+if (hNewBrush)
+bStockBrush = true;
+else
 hNewBrush = MakeBrush(nColor);
 
 ResetBrush(hNewBrush);
@@ -1366,6 +1392,7 @@ void WinSalGraphicsImpl::SetFillColor(Color nColor)
 mnBrushColor = nBrushColor;
 maFillColor = nColor;
 mbBrush = TRUE;
+mbStockBrush = bStockBrush;
 }
 
 HBRUSH WinSalGraphicsImpl::SearchStockBrush(COLORREF nBrushColor)
@@ -1498,9 +1525,16 @@ void WinSalGraphicsImpl::ResetBrush(HBRUSH hNewBrush)
 HBRUSH hOldBrush = SelectBrush(mrParent.getHDC(), hNewBrush);
 
 if (mhBrush)
-DeleteBrush(mhBrush);
+{
+if (!mbStockBrush)
+{
+DeleteBrush(mhBrush);
+}
+}
 else
+{
 mrParent.mhDefBrush = hOldBrush;
+}
 
 mhBrush = hNewBrush;
 }
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index e96b226457f7..f1cd729daf1b 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -38,7 +38,9 @@ private:
 bool mbXORMode : 1; // _every_ output with RasterOp XOR
 bool mbPen : 1; // is Pen (FALSE == NULL_PEN)
 HPEN mhPen; // Pen
+bool mbStockPen : 1; // is Pen a stockpen
 bool mbBrush : 1; // is Brush (FALSE == NULL_BRUSH)
+bool mbStockBrush : 1; // is Brush a stockbrush
 HBRUSH mhBrush; // Brush
 COLORREF mnPenColor; // PenColor
 COLORREF mnBrushColor; // BrushColor
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-20 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   46 ++
 vcl/win/gdi/gdiimpl.hxx |2 --
 2 files changed, 6 insertions(+), 42 deletions(-)

New commits:
commit b940eb5903f583089e99042d60ceae635ae2af83
Author: Dmitriy Shilin 
AuthorDate: Sat Jan 19 22:52:35 2019 -0800
Commit: Mike Kaganski 
CommitDate: Sun Jan 20 11:12:29 2019 +0100

tdf#107792 vcl/win: do not afraid to delete stock objects

Calling the DeleteObject function with a stock object does nothing [1].

1. https://docs.microsoft.com/en-us/previous-versions/ms969928(v=msdn.10)

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index a9406729fa21..b3f5b0735bb0 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -210,9 +210,7 @@ WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& 
rParent):
 mbXORMode(false),
 mbPen(false),
 mhPen(nullptr),
-mbStockPen(false),
 mbBrush(false),
-mbStockBrush(false),
 mhBrush(nullptr)
 {
 }
@@ -220,16 +218,10 @@ WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& 
rParent):
 WinSalGraphicsImpl::~WinSalGraphicsImpl()
 {
 if ( mhPen )
-{
-if ( !mbStockPen )
-DeletePen( mhPen );
-}
+DeletePen( mhPen );
 
 if ( mhBrush )
-{
-if ( !mbStockBrush )
-DeleteBrush( mhBrush );
-}
+DeleteBrush( mhBrush );
 }
 
 void WinSalGraphicsImpl::Init()
@@ -1286,7 +1278,6 @@ void WinSalGraphicsImpl::SetLineColor()
 
 // set new data
 mbPen   = FALSE;
-mbStockPen  = TRUE;
 }
 
 void WinSalGraphicsImpl::SetLineColor(Color nColor)
@@ -1294,12 +1285,8 @@ void WinSalGraphicsImpl::SetLineColor(Color nColor)
 COLORREF nPenColor = PALETTERGB(nColor.GetRed(),
 nColor.GetGreen(),
 nColor.GetBlue());
-bool bStockPen = false;
-
 HPEN hNewPen = SearchStockPen(nPenColor);
-if (hNewPen)
-bStockPen = true;
-else
+if (!hNewPen)
 hNewPen = MakePen(nColor);
 
 ResetPen(hNewPen);
@@ -1308,7 +1295,6 @@ void WinSalGraphicsImpl::SetLineColor(Color nColor)
 mnPenColor  = nPenColor;
 maLineColor = nColor;
 mbPen   = TRUE;
-mbStockPen  = bStockPen;
 }
 
 HPEN WinSalGraphicsImpl::SearchStockPen(COLORREF nPenColor)
@@ -1350,16 +1336,9 @@ void WinSalGraphicsImpl::ResetPen(HPEN hNewPen)
 HPEN hOldPen = SelectPen(mrParent.getHDC(), hNewPen);
 
 if (mhPen)
-{
-if (!mbStockPen)
-{
-DeletePen(mhPen);
-}
-}
+DeletePen(mhPen);
 else
-{
 mrParent.mhDefPen = hOldPen;
-}
 
 mhPen = hNewPen;
 }
@@ -1370,7 +1349,6 @@ void WinSalGraphicsImpl::SetFillColor()
 
 // set new data
 mbBrush = FALSE;
-mbStockBrush = TRUE;
 }
 
 void WinSalGraphicsImpl::SetFillColor(Color nColor)
@@ -1378,12 +1356,8 @@ void WinSalGraphicsImpl::SetFillColor(Color nColor)
 COLORREF nBrushColor = PALETTERGB(nColor.GetRed(),
   nColor.GetGreen(),
   nColor.GetBlue());
-bool bStockBrush = false;
-
 HBRUSH hNewBrush = SearchStockBrush(nBrushColor);
-if (hNewBrush)
-bStockBrush = true;
-else
+if (!hNewBrush)
 hNewBrush = MakeBrush(nColor);
 
 ResetBrush(hNewBrush);
@@ -1392,7 +1366,6 @@ void WinSalGraphicsImpl::SetFillColor(Color nColor)
 mnBrushColor = nBrushColor;
 maFillColor = nColor;
 mbBrush = TRUE;
-mbStockBrush = bStockBrush;
 }
 
 HBRUSH WinSalGraphicsImpl::SearchStockBrush(COLORREF nBrushColor)
@@ -1525,16 +1498,9 @@ void WinSalGraphicsImpl::ResetBrush(HBRUSH hNewBrush)
 HBRUSH hOldBrush = SelectBrush(mrParent.getHDC(), hNewBrush);
 
 if (mhBrush)
-{
-if (!mbStockBrush)
-{
-DeleteBrush(mhBrush);
-}
-}
+DeleteBrush(mhBrush);
 else
-{
 mrParent.mhDefBrush = hOldBrush;
-}
 
 mhBrush = hNewBrush;
 }
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index f1cd729daf1b..e96b226457f7 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -38,9 +38,7 @@ private:
 bool mbXORMode : 1; // _every_ output with RasterOp XOR
 bool mbPen : 1; // is Pen (FALSE == NULL_PEN)
 HPEN mhPen; // Pen
-bool mbStockPen : 1; // is Pen a stockpen
 bool mbBrush : 1; // is Brush (FALSE == NULL_BRUSH)
-bool mbStockBrush : 1; // is Brush a stockbrush
 HBRUSH mhBrush; // Brush
 COLORREF mnPenColor; // PenColor
 COLORREF mnBrushColor; // BrushColor
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-17 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |   55 
 1 file changed, 10 insertions(+), 45 deletions(-)

New commits:
commit 5de78478ce98ae484040b79de7df6c091873481b
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jan 17 13:46:08 2019 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jan 17 17:31:47 2019 +0100

WIN remove private-font fallback handling

The fallback code is from times, when FR_PRIVATE was not available
(pre Win2k). So just remove this special global font handling.

Change-Id: Ie54b0269513ab63d84e5c8bb4d4555a775161757
Reviewed-on: https://gerrit.libreoffice.org/66516
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 155c08e962fb..9c4b4995f9ca 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1064,8 +1064,7 @@ static int CALLBACK SalEnumFontsProcExW( const LOGFONTW* 
lpelfe,
 
 struct TempFontItem
 {
-OUString maFontFilePath;
-OUString maResourcePath;
+OUString maFontResourcePath;
 TempFontItem* mpNextItem;
 };
 
@@ -1076,57 +1075,23 @@ bool ImplAddTempFont( SalData& rSalData, const 
OUString& rFontFileURL )
 OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, 
aUSytemPath ) );
 
 nRet = AddFontResourceExW( o3tl::toW(aUSytemPath.getStr()), FR_PRIVATE, 
nullptr );
-
-if ( !nRet )
+SAL_WARN_IF(!nRet, "vcl.fonts", "Adding private font failed: " << 
rFontFileURL);
+if (nRet > 0)
 {
-static int nCounter = 0;
-wchar_t aFileName[] = L"soAA.fot";
-aFileName[2] = sal::static_int_cast(L'A' + (15 & 
(nCounter>>4)));
-aFileName[3] = sal::static_int_cast(L'A' + (15 & nCounter));
-wchar_t aResourceName[512];
-int const nMaxLen = SAL_N_ELEMENTS(aResourceName) - 16;
-int nLen = GetTempPathW( nMaxLen, aResourceName );
-wcsncpy( aResourceName + nLen, aFileName, SAL_N_ELEMENTS( 
aResourceName ) - nLen );
-// security: end buffer in any case
-aResourceName[ SAL_N_ELEMENTS(aResourceName)-1 ] = 0;
-DeleteFileW( aResourceName );
-
-// TODO: font should be private => need to investigate why it doesn't 
work then
-if( !CreateScalableFontResourceW( 0, aResourceName, 
o3tl::toW(aUSytemPath.getStr()), nullptr ) )
-return false;
-++nCounter;
-
-nRet = AddFontResourceW( aResourceName );
-if( nRet > 0 )
-{
-TempFontItem* pNewItem = new TempFontItem;
-pNewItem->maResourcePath = o3tl::toU( aResourceName );
-pNewItem->maFontFilePath = aUSytemPath;
-pNewItem->mpNextItem = rSalData.mpTempFontItem;
-rSalData.mpTempFontItem = pNewItem;
-}
+TempFontItem* pNewItem = new TempFontItem;
+pNewItem->maFontResourcePath = aUSytemPath;
+pNewItem->mpNextItem = rSalData.mpTempFontItem;
+rSalData.mpTempFontItem = pNewItem;
 }
-
 return (nRet > 0);
 }
 
 void ImplReleaseTempFonts( SalData& rSalData )
 {
-int nCount = 0;
-while( TempFontItem* p = rSalData.mpTempFontItem )
+while (TempFontItem* p = rSalData.mpTempFontItem)
 {
-++nCount;
-if( p->maResourcePath.getLength() )
-{
-const wchar_t* pResourcePath = 
o3tl::toW(p->maResourcePath.getStr());
-RemoveFontResourceW( pResourcePath );
-DeleteFileW( pResourcePath );
-}
-else
-{
-RemoveFontResourceW( o3tl::toW(p->maFontFilePath.getStr()) );
-}
-
+RemoveFontResourceExW(o3tl::toW(p->maFontResourcePath.getStr()),
+  FR_PRIVATE, nullptr);
 rSalData.mpTempFontItem = p->mpNextItem;
 delete p;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-16 Thread Libreoffice Gerrit user
 vcl/win/src/assw.cur |binary
 1 file changed

New commits:
commit 28dee1129c7a9c4da34b9253aefd6c6b2df1a073
Author: Matthias Seidel 
AuthorDate: Fri Jan 11 22:52:36 2019 +
Commit: Caolán McNamara 
CommitDate: Wed Jan 16 15:30:00 2019 +0100

Corrected hotspot for pointer (autoscroll south west)

(cherry picked from commit 1170f10906a9bca78782df6ab1b6a4e20cf0435a)

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

diff --git a/vcl/win/src/assw.cur b/vcl/win/src/assw.cur
index fddaf3f57cbf..46ee06d16849 100644
Binary files a/vcl/win/src/assw.cur and b/vcl/win/src/assw.cur differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-14 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 4da70cfe433c7c2b52709d5f689b274e1bccaaeb
Author: Andrea Gelmini 
AuthorDate: Sun Jan 13 22:12:14 2019 +
Commit: Julien Nabet 
CommitDate: Mon Jan 14 09:31:04 2019 +0100

Fix typos

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index bb70bc3901c3..3b209075defc 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1941,7 +1941,7 @@ static void impAddB2DPolygonToGDIPlusGraphicsPathReal(
 
 // tdf#99165 MS Gdiplus cannot handle creating correct 
extra geometry for fat lines
 // with LineCap or LineJoin when a bezier segment starts 
or ends trivial, e.g. has
-// no 1st or 2nd control point, despite that these are 
mathematicaly correct definitions
+// no 1st or 2nd control point, despite that these are 
mathematically correct definitions
 // (basegfx can handle that).
 // Caution: This error (and it's correction) might be 
necessary for other graphical
 // sub-systems in a similar way.
@@ -2347,9 +2347,9 @@ bool WinSalGraphicsImpl::drawPolyLine(
 
 if(mrParent.isPrinter())
 {
-// tdf#122384 As metioned above in WinSalGraphicsImpl::drawPolyPolygon
+// tdf#122384 As mentioned above in WinSalGraphicsImpl::drawPolyPolygon
 // (look for 'One more hint: This *may* also be needed now in'...).
-// See comments in same spot above *uregntly* before doing changes 
here,
+// See comments in same spot above *urgently* before doing changes 
here,
 // these comments are *still fully valid* at this place (!)
 const Gdiplus::REAL aDpiX(aGraphics.GetDpiX());
 const Gdiplus::REAL aDpiY(aGraphics.GetDpiY());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-13 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 6e3c4ae8bca898700cde9caaff43c3a8a61eebc2
Author: Armin Le Grand 
AuthorDate: Fri Jan 11 17:59:59 2019 +0100
Commit: Armin Le Grand 
CommitDate: Sun Jan 13 12:16:57 2019 +0100

tdf#122384 Added isPrinter support to WinSalGraphicsImpl::drawPolyLine

As already guessed but not been sure (see 'One more hint'
in WinSalGraphicsImpl::drawPolyPolygon) the strange WinGDI
transform is also needed when printing for WinSalGraphicsImpl::
drawPolyLine.

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index ec7682b14899..bb70bc3901c3 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2345,6 +2345,21 @@ bool WinSalGraphicsImpl::drawPolyLine(
 aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
 }
 
+if(mrParent.isPrinter())
+{
+// tdf#122384 As metioned above in WinSalGraphicsImpl::drawPolyPolygon
+// (look for 'One more hint: This *may* also be needed now in'...).
+// See comments in same spot above *uregntly* before doing changes 
here,
+// these comments are *still fully valid* at this place (!)
+const Gdiplus::REAL aDpiX(aGraphics.GetDpiX());
+const Gdiplus::REAL aDpiY(aGraphics.GetDpiY());
+
+aGraphics.ScaleTransform(
+Gdiplus::REAL(100.0) / aDpiX,
+Gdiplus::REAL(100.0) / aDpiY,
+Gdiplus::MatrixOrderAppend);
+}
+
 aGraphics.DrawPath(
 ,
 &(*pGraphicsPath));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-08 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx|   10 --
 vcl/win/gdi/scoped_gdi.hxx |7 +++
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit bcbcfa7927c575ddb1379b3cd8ef1b2df709ba66
Author: Dmitriy Shilin 
AuthorDate: Sun Jan 6 23:53:45 2019 -0800
Commit: Mike Kaganski 
CommitDate: Tue Jan 8 11:12:14 2019 +0100

tdf#107792 vcl/win/gdi: introduce ScopedHRGN

Change-Id: I3d103dcb6ebb81d50bb8a10371dba7feb92c421d
Reviewed-on: https://gerrit.libreoffice.org/65924
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 2eb537931d50..1bb39b84cd2e 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -296,9 +296,8 @@ void MakeInvisibleArea(const RECT& rSrcRect,
 rhInvalidateRgn = CreateRectRgnIndirect();
 }
 
-HRGN hTempRgn = CreateRectRgn(nLeft, nTop, nRight, nBottom);
-CombineRgn(rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF);
-DeleteRegion(hTempRgn);
+ScopedHRGN hTempRgn(CreateRectRgn(nLeft, nTop, nRight, nBottom));
+CombineRgn(rhInvalidateRgn, rhInvalidateRgn, hTempRgn.get(), RGN_DIFF);
 }
 
 void ImplCalcOutSideRgn( const RECT& rSrcRect,
@@ -1259,9 +1258,8 @@ bool WinSalGraphicsImpl::setClipRegion( const 
vcl::Region& i_rClip )
 
 for( sal_uLong n = 1; n < pHeader.nCount; n++, pRect++ )
 {
-HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, 
pRect->right, pRect->bottom );
-CombineRgn( mrParent.mhRegion, mrParent.mhRegion, 
hRgn, RGN_OR );
-DeleteRegion( hRgn );
+ScopedHRGN hRgn(CreateRectRgn(pRect->left, pRect->top, 
pRect->right, pRect->bottom));
+CombineRgn( mrParent.mhRegion, mrParent.mhRegion, 
hRgn.get(), RGN_OR );
 }
 }
 }
diff --git a/vcl/win/gdi/scoped_gdi.hxx b/vcl/win/gdi/scoped_gdi.hxx
index 64dbd180b969..90af7340f06a 100644
--- a/vcl/win/gdi/scoped_gdi.hxx
+++ b/vcl/win/gdi/scoped_gdi.hxx
@@ -21,7 +21,14 @@ struct HBRUSHDeleter
 void operator()(HBRUSH hBrush) { DeleteBrush(hBrush); }
 };
 
+struct HRGNDeleter
+{
+using pointer = HRGN;
+void operator()(HRGN hRgn) { DeleteRegion(hRgn); }
+};
+
 using ScopedHBRUSH = std::unique_ptr;
+using ScopedHRGN = std::unique_ptr;
 
 #endif // INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-31 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit 7a308efc48ddc03e689e0d7847f594fb882af0c1
Author: Dmitriy Shilin 
AuthorDate: Sun Dec 30 03:29:26 2018 -0800
Commit: Noel Grandin 
CommitDate: Mon Dec 31 12:50:16 2018 +0100

vcl/win/gdi: replace PALETTEENTRY object with constant values

Change-Id: I2a06c202f1340b735d132f68db97b5980555c99a
Reviewed-on: https://gerrit.libreoffice.org/65741
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 7b489e32261a..b9041acdefd4 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -193,14 +193,7 @@ bool IsPaletteColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
 
 bool IsExtraColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
 {
-static PALETTEENTRY aImplExtraColor1 =
-{
-0, 184, 255, 0
-};
-
-return aImplExtraColor1.peRed == nRed &&
-   aImplExtraColor1.peGreen == nGreen &&
-   aImplExtraColor1.peBlue == nBlue;
+return (nRed == 0) && (nGreen == 184) && (nBlue == 255);
 }
 
 bool ImplIsPaletteEntry(BYTE nRed, BYTE nGreen, BYTE nBlue)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-27 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx|   40 +---
 vcl/win/gdi/scoped_gdi.hxx |   28 
 2 files changed, 49 insertions(+), 19 deletions(-)

New commits:
commit 71f02295f2dca557fddd7dbdd19bfd464de06508
Author: Dmitriy Shilin 
AuthorDate: Fri Dec 14 09:34:34 2018 +0300
Commit: Mike Kaganski 
CommitDate: Thu Dec 27 12:43:50 2018 +0100

tdf#107792 vcl/win/gdi: introduce ScopedHBRUSH

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 50238bf801a9..7b489e32261a 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include "gdiimpl.hxx"
+#include "scoped_gdi.hxx"
 
 #include 
 #include 
@@ -772,9 +773,9 @@ bool WinSalGraphicsImpl::drawAlphaRect( long nX, long nY, 
long nWidth,
 return bRet;
 }
 
-void WinSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry,
-const SalBitmap& rSSalBitmap,
-Color nMaskColor )
+void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry,
+  const SalBitmap& rSSalBitmap,
+  Color nMaskColor)
 {
 SAL_WARN_IF( mrParent.isPrinter(), "vcl", "No transparency print 
possible!" );
 
@@ -783,12 +784,12 @@ void WinSalGraphicsImpl::drawMask( const SalTwoRect& 
rPosAry,
 const WinSalBitmap& rSalBitmap = static_cast(rSSalBitmap);
 
 SalTwoRect  aPosAry = rPosAry;
-const BYTE  cRed = nMaskColor.GetRed();
-const BYTE  cGreen = nMaskColor.GetGreen();
-const BYTE  cBlue = nMaskColor.GetBlue();
-HDC hDC = mrParent.getHDC();
-HBRUSH  hMaskBrush = CreateSolidBrush( RGB( cRed, cGreen, cBlue ) );
-HBRUSH  hOldBrush = SelectBrush( hDC, hMaskBrush );
+const HDC hDC = mrParent.getHDC();
+
+ScopedHBRUSH hMaskBrush(CreateSolidBrush(RGB(nMaskColor.GetRed(),
+ nMaskColor.GetGreen(),
+ nMaskColor.GetBlue(;
+HBRUSH  hOldBrush = SelectBrush(hDC, hMaskBrush.get());
 
 // WIN/WNT seems to have a minor problem mapping the correct color of the
 // mask to the palette if we draw the DIB directly ==> draw DDB
@@ -802,8 +803,7 @@ void WinSalGraphicsImpl::drawMask( const SalTwoRect& 
rPosAry,
 else
 ImplDrawBitmap( hDC, aPosAry, rSalBitmap, false, 0x00B8074AUL );
 
-SelectBrush( hDC, hOldBrush );
-DeleteBrush( hMaskBrush );
+SelectBrush(hDC, hOldBrush);
 }
 
 std::shared_ptr WinSalGraphicsImpl::getBitmap( long nX, long nY, 
long nDX, long nDY )
@@ -1575,16 +1575,18 @@ void WinSalGraphicsImpl::SetROPFillColor( SalROPColor 
nROPColor )
 
 void WinSalGraphicsImpl::DrawPixelImpl( long nX, long nY, COLORREF crColor )
 {
-if ( mbXORMode )
+const HDC hDC = mrParent.getHDC();
+
+if (!mbXORMode)
 {
-HBRUSH hBrush = CreateSolidBrush( crColor );
-HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hBrush );
-PatBlt( mrParent.getHDC(), static_cast(nX), static_cast(nY), 
int(1), int(1), PATINVERT );
-SelectBrush( mrParent.getHDC(), hOldBrush );
-DeleteBrush( hBrush );
+SetPixel(hDC, static_cast(nX), static_cast(nY), crColor);
+return;
 }
-else
-SetPixel( mrParent.getHDC(), static_cast(nX), 
static_cast(nY), crColor );
+
+ScopedHBRUSH hBrush(CreateSolidBrush(crColor));
+HBRUSH hOldBrush = SelectBrush(hDC, hBrush.get());
+PatBlt(hDC, static_cast(nX), static_cast(nY), int(1), int(1), 
PATINVERT);
+SelectBrush(hDC, hOldBrush);
 }
 
 void WinSalGraphicsImpl::drawPixel( long nX, long nY )
diff --git a/vcl/win/gdi/scoped_gdi.hxx b/vcl/win/gdi/scoped_gdi.hxx
new file mode 100644
index ..64dbd180b969
--- /dev/null
+++ b/vcl/win/gdi/scoped_gdi.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX
+#define INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX
+
+#include 
+#include 
+
+#include 
+
+struct HBRUSHDeleter
+{
+using pointer = HBRUSH;
+void operator()(HBRUSH hBrush) { DeleteBrush(hBrush); }
+};
+
+using ScopedHBRUSH = std::unique_ptr;
+
+#endif // INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

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

2018-12-24 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   40 
 1 file changed, 20 insertions(+), 20 deletions(-)

New commits:
commit af9493419e103cff3b8b006c6d41613c42df8a49
Author: Dmitriy Shilin 
AuthorDate: Tue Dec 18 10:06:17 2018 +0300
Commit: Mike Kaganski 
CommitDate: Mon Dec 24 10:16:26 2018 +0100

tdf#107792: vcl/win/gdi: extract Get50PercentBrush

Change-Id: If62d9f5429a78d39dc5edbe434308603b1b09fe9
Reviewed-on: https://gerrit.libreoffice.org/65307
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index e99e84bc4030..50238bf801a9 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -853,6 +853,24 @@ Color WinSalGraphicsImpl::getPixel( long nX, long nY )
   GetBValue( aWinCol ) );
 }
 
+namespace
+{
+
+HBRUSH Get50PercentBrush()
+{
+SalData* pSalData = GetSalData();
+if ( !pSalData->mh50Brush )
+{
+if ( !pSalData->mh50Bmp )
+pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
+pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
+}
+
+return pSalData->mh50Brush;
+}
+
+} // namespace
+
 void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, 
SalInvert nFlags )
 {
 if ( nFlags & SalInvert::TrackFrame )
@@ -871,16 +889,8 @@ void WinSalGraphicsImpl::invert( long nX, long nY, long 
nWidth, long nHeight, Sa
 }
 else if ( nFlags & SalInvert::N50 )
 {
-SalData* pSalData = GetSalData();
-if ( !pSalData->mh50Brush )
-{
-if ( !pSalData->mh50Bmp )
-pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
-pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
-}
-
 COLORREF nOldTextColor = ::SetTextColor( mrParent.getHDC(), 0 );
-HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), pSalData->mh50Brush 
);
+HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), Get50PercentBrush() 
);
 PatBlt( mrParent.getHDC(), nX, nY, nWidth, nHeight, PATINVERT );
 ::SetTextColor( mrParent.getHDC(), nOldTextColor );
 SelectBrush( mrParent.getHDC(), hOldBrush );
@@ -911,17 +921,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const 
SalPoint* pPtAry, Sal
 {
 
 if ( nSalFlags & SalInvert::N50 )
-{
-SalData* pSalData = GetSalData();
-if ( !pSalData->mh50Brush )
-{
-if ( !pSalData->mh50Bmp )
-pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 
);
-pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
-}
-
-hBrush = pSalData->mh50Brush;
-}
+hBrush = Get50PercentBrush();
 else
 hBrush = GetStockBrush( BLACK_BRUSH );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-20 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   14 +++---
 vcl/win/gdi/gdiimpl.hxx |4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 718c9b8a42987dd19252d539c38909305839c946
Author: Dmitriy Shilin 
AuthorDate: Fri Dec 14 08:21:31 2018 +0300
Commit: Noel Grandin 
CommitDate: Thu Dec 20 13:20:23 2018 +0100

vcl/win/gdi: unify private API naming in WinSalGraphicsImpl

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index eecd9f350164..e99e84bc4030 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -647,7 +647,7 @@ void WinSalGraphicsImpl::drawBitmap(const SalTwoRect& 
rPosAry, const SalBitmap&
 }
 
 // try to draw using GdiPlus directly
-if(bTryDirectPaint && tryDrawBitmapGdiPlus(rPosAry, rSalBitmap))
+if(bTryDirectPaint && TryDrawBitmapGDIPlus(rPosAry, rSalBitmap))
 {
 return;
 }
@@ -1573,7 +1573,7 @@ void WinSalGraphicsImpl::SetROPFillColor( SalROPColor 
nROPColor )
 SetFillColor( ImplGetROPColor( nROPColor ) );
 }
 
-void WinSalGraphicsImpl::drawPixelImpl( long nX, long nY, COLORREF crColor )
+void WinSalGraphicsImpl::DrawPixelImpl( long nX, long nY, COLORREF crColor )
 {
 if ( mbXORMode )
 {
@@ -1589,7 +1589,7 @@ void WinSalGraphicsImpl::drawPixelImpl( long nX, long nY, 
COLORREF crColor )
 
 void WinSalGraphicsImpl::drawPixel( long nX, long nY )
 {
-drawPixelImpl( nX, nY, mnPenColor );
+DrawPixelImpl( nX, nY, mnPenColor );
 }
 
 void WinSalGraphicsImpl::drawPixel( long nX, long nY, Color nColor )
@@ -1603,7 +1603,7 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY, 
Color nColor )
  ImplIsSysColorEntry( nColor ) )
 nCol = PALRGB_TO_RGB( nCol );
 
-drawPixelImpl( nX, nY, nCol );
+DrawPixelImpl( nX, nY, nCol );
 }
 
 void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
@@ -1614,7 +1614,7 @@ void WinSalGraphicsImpl::drawLine( long nX1, long nY1, 
long nX2, long nY2 )
 
 // LineTo doesn't draw the last pixel
 if ( !mrParent.isPrinter() )
-drawPixelImpl( nX2, nY2, mnPenColor );
+DrawPixelImpl( nX2, nY2, mnPenColor );
 }
 
 void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight 
)
@@ -1653,7 +1653,7 @@ void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 
nPoints, const SalPoint* pPtAr
 
 // Polyline seems to uses LineTo, which doesn't paint the last pixel (see 
87eb8f8ee)
 if ( !mrParent.isPrinter() )
-drawPixelImpl( pWinPtAry[nPoints-1].x, pWinPtAry[nPoints-1].y, 
mnPenColor );
+DrawPixelImpl( pWinPtAry[nPoints-1].x, pWinPtAry[nPoints-1].y, 
mnPenColor );
 }
 
 void WinSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* 
pPtAry )
@@ -2418,7 +2418,7 @@ static void setInterpolationMode(
 }
 }
 
-bool WinSalGraphicsImpl::tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const 
SalBitmap& rSrcBitmap)
+bool WinSalGraphicsImpl::TryDrawBitmapGDIPlus(const SalTwoRect& rTR, const 
SalBitmap& rSrcBitmap)
 {
 if(rTR.mnSrcWidth && rTR.mnSrcHeight && rTR.mnDestWidth && 
rTR.mnDestHeight)
 {
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 295f474740f8..f1cd729daf1b 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -49,8 +49,8 @@ private:
 ColormaLineColor;
 ColormaFillColor;
 
-bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& 
rSrcBitmap);
-void drawPixelImpl( long nX, long nY, COLORREF crColor );
+bool TryDrawBitmapGDIPlus(const SalTwoRect& rTR, const SalBitmap& 
rSrcBitmap);
+void DrawPixelImpl(long nX, long nY, COLORREF crColor);
 
 HPEN SearchStockPen(COLORREF nPenColor);
 HPEN MakePen(Color nColor);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-17 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   58 
 1 file changed, 30 insertions(+), 28 deletions(-)

New commits:
commit 5bc0cbc77f0a8be6b241e644bdac56989a0974a4
Author: Dmitriy Shilin 
AuthorDate: Fri Dec 14 08:13:53 2018 +0300
Commit: Mike Kaganski 
CommitDate: Mon Dec 17 19:32:04 2018 +0100

vcl/win/gdi: merge ImplRenderPath into drawPolyLineBezier

Change-Id: I6e0a5d81bc155c8ad3603c4451a557f8412245bd
Reviewed-on: https://gerrit.libreoffice.org/65139
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 1f161619589a..eecd9f350164 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -65,33 +65,6 @@
 
 namespace {
 
-// #100127# draw an array of points which might also contain bezier control 
points
-void ImplRenderPath( HDC hdc, sal_uLong nPoints, const SalPoint* pPtAry, const 
PolyFlags* pFlgAry )
-{
-if( nPoints )
-{
-// TODO: profile whether the following options are faster:
-// a) look ahead and draw consecutive bezier or line segments by 
PolyBezierTo/PolyLineTo resp.
-// b) convert our flag array to window's and use PolyDraw
-
-MoveToEx( hdc, pPtAry->mnX, pPtAry->mnY, nullptr );
-++pPtAry; ++pFlgAry;
-
-for( sal_uLong i=1; imnX, pPtAry->mnY );
-}
-else if( nPoints - i > 2 )
-{
-PolyBezierTo( hdc, reinterpret_cast(pPtAry), 3 );
-i += 2; pPtAry += 2; pFlgAry += 2;
-}
-}
-}
-}
-
 // #100127# Fill point and flag memory from array of points which
 // might also contain bezier control points for the PolyDraw() GDI method
 // Make sure pWinPointAry and pWinFlagAry are big enough
@@ -1763,7 +1736,36 @@ bool WinSalGraphicsImpl::drawPolyLineBezier( sal_uInt32 
nPoints, const SalPoint*
 {
 static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same 
size" );
 
-ImplRenderPath( mrParent.getHDC(), nPoints, pPtAry, pFlgAry );
+// #100127# draw an array of points which might also contain bezier 
control points
+if (!nPoints)
+return true;
+
+const HDC hdc = mrParent.getHDC();
+
+// TODO: profile whether the following options are faster:
+// a) look ahead and draw consecutive bezier or line segments by 
PolyBezierTo/PolyLineTo resp.
+// b) convert our flag array to window's and use PolyDraw
+MoveToEx(hdc, pPtAry->mnX, pPtAry->mnY, nullptr);
+++pPtAry;
+++pFlgAry;
+
+for(sal_uInt32 i = 1; i < nPoints; ++i)
+{
+if(*pFlgAry != PolyFlags::Control)
+{
+LineTo(hdc, pPtAry->mnX, pPtAry->mnY);
+}
+else if(nPoints - i > 2)
+{
+PolyBezierTo(hdc, reinterpret_cast(pPtAry), 3);
+i += 2;
+pPtAry += 2;
+pFlgAry += 2;
+}
+
+++pPtAry;
+++pFlgAry;
+}
 
 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

2018-12-13 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

New commits:
commit e71f44f4dc847c75b874d514888d0675ccb00496
Author: Dmitriy Shilin 
AuthorDate: Thu Dec 13 07:23:37 2018 +0300
Commit: Mike Kaganski 
CommitDate: Thu Dec 13 11:21:03 2018 +0100

vcl/win/gdi: get dither mapping value explicitly

Having a macro with a very short and nice API but assuming
that some variables must be defined before using it leads
to a huge misunderstanding.

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b8fafc25482d..1f161619589a 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -61,8 +61,6 @@
 #define SAL_POLYPOLYCOUNT_STACKBUF  8
 #define SAL_POLYPOLYPOINTS_STACKBUF 64
 
-#define DMAP( _def_nVal, _def_nThres )  
((pDitherDiff[_def_nVal]>(_def_nThres))?pDitherHigh[_def_nVal]:pDitherLow[_def_nVal])
-
 #define SAL_POLY_STACKBUF   32
 
 namespace {
@@ -1462,6 +1460,12 @@ HBRUSH WinSalGraphicsImpl::SearchStockBrush(COLORREF 
nBrushColor)
 namespace
 {
 
+BYTE GetDitherMappingValue(BYTE nVal, BYTE nThres, const SalData* pSalData)
+{
+return (pSalData->mpDitherDiff[nVal] > nThres) ?
+pSalData->mpDitherHigh[nVal] : pSalData->mpDitherLow[nVal];
+}
+
 HBRUSH Make16BitDIBPatternBrush(Color nColor)
 {
 const SalData* pSalData = GetSalData();
@@ -1483,18 +1487,15 @@ HBRUSH Make16BitDIBPatternBrush(Color nColor)
 };
 
 BYTE* pTmp = pSalData->mpDitherDIBData;
-long* pDitherDiff = pSalData->mpDitherDiff;
-BYTE* pDitherLow = pSalData->mpDitherLow;
-BYTE* pDitherHigh = pSalData->mpDitherHigh;
 
 for(int nY = 0; nY < 8; ++nY)
 {
 for(int nX = 0; nX < 8; ++nX)
 {
 const BYTE nThres = aOrdDither16Bit[nY][nX];
-*pTmp++ = DMAP(nBlue, nThres);
-*pTmp++ = DMAP(nGreen, nThres);
-*pTmp++ = DMAP(nRed, nThres);
+*pTmp++ = GetDitherMappingValue(nBlue, nThres, pSalData);
+*pTmp++ = GetDitherMappingValue(nGreen, nThres, pSalData);
+*pTmp++ = GetDitherMappingValue(nRed, nThres, pSalData);
 }
 }
 
@@ -1522,18 +1523,15 @@ HBRUSH Make8BitDIBPatternBrush(Color nColor)
 };
 
 BYTE* pTmp = pSalData->mpDitherDIBData;
-long* pDitherDiff = pSalData->mpDitherDiff;
-BYTE* pDitherLow = pSalData->mpDitherLow;
-BYTE* pDitherHigh = pSalData->mpDitherHigh;
 
 for (int nY = 0; nY < 8; ++nY)
 {
 for (int nX = 0; nX < 8; ++nX)
 {
 const BYTE nThres = aOrdDither8Bit[nY][nX];
-*pTmp = DMAP(nRed, nThres) +
-DMAP(nGreen, nThres) * 6 +
-DMAP(nBlue, nThres) * 36;
+*pTmp = GetDitherMappingValue(nRed, nThres, pSalData) +
+GetDitherMappingValue(nGreen, nThres, pSalData) * 6 +
+GetDitherMappingValue(nBlue, nThres, pSalData) * 36;
 pTmp++;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-12 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |8 ++--
 vcl/win/gdi/gdiimpl.hxx |2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 399af2e8cb3b80555194b4a6186fe9deabeac95d
Author: Dmitriy Shilin 
AuthorDate: Wed Dec 12 17:24:41 2018 +0300
Commit: Mike Kaganski 
CommitDate: Thu Dec 13 06:17:12 2018 +0100

tdf#107792 vcl/win/gdi: shrink WinSalGraphicsImpl::MakePen API

Change-Id: I7d5752214a0c2f4891dcc023c6d573a8459b65f4
Reviewed-on: https://gerrit.libreoffice.org/65037
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 47548b4129b3..b8fafc25482d 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1347,7 +1347,7 @@ void WinSalGraphicsImpl::SetLineColor(Color nColor)
 if (hNewPen)
 bStockPen = true;
 else
-hNewPen = MakePen(nColor, nPenColor);
+hNewPen = MakePen(nColor);
 
 ResetPen(hNewPen);
 
@@ -1375,8 +1375,12 @@ HPEN WinSalGraphicsImpl::SearchStockPen(COLORREF 
nPenColor)
 return nullptr;
 }
 
-HPEN WinSalGraphicsImpl::MakePen(Color nColor, COLORREF nPenColor)
+HPEN WinSalGraphicsImpl::MakePen(Color nColor)
 {
+COLORREF nPenColor = PALETTERGB(nColor.GetRed(),
+nColor.GetGreen(),
+nColor.GetBlue());
+
 if (!mrParent.isPrinter())
 {
 if (GetSalData()->mhDitherPal && ImplIsSysColorEntry(nColor))
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 6bee309e6ec1..295f474740f8 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -53,7 +53,7 @@ private:
 void drawPixelImpl( long nX, long nY, COLORREF crColor );
 
 HPEN SearchStockPen(COLORREF nPenColor);
-HPEN MakePen(Color nColor, COLORREF nPenColor);
+HPEN MakePen(Color nColor);
 void ResetPen(HPEN hNewPen);
 
 HBRUSH SearchStockBrush(COLORREF nBrushColor);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-12 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 007396b294c9ecdd7468c5dd7bc01a30905e904d
Author: Dmitriy Shilin 
AuthorDate: Wed Dec 12 17:20:49 2018 +0300
Commit: Mike Kaganski 
CommitDate: Thu Dec 13 06:16:14 2018 +0100

tdf#107792 vcl/win/gdi: reduce number of return paths

Change-Id: I3e7f00a10e76933424149a931042a0611ede5d47
Reviewed-on: https://gerrit.libreoffice.org/65036
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 5c1fa6df3e30..47548b4129b3 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1361,17 +1361,15 @@ void WinSalGraphicsImpl::SetLineColor(Color nColor)
 HPEN WinSalGraphicsImpl::SearchStockPen(COLORREF nPenColor)
 {
 // Only screen, because printer has problems, when we use stock objects.
-if (mrParent.isPrinter())
+if (!mrParent.isPrinter())
 {
-return nullptr;
-}
-
-const SalData* pSalData = GetSalData();
+const SalData* pSalData = GetSalData();
 
-for (sal_uInt16 i = 0; i < pSalData->mnStockPenCount; i++)
-{
-if (nPenColor == pSalData->maStockPenColorAry[i])
-return pSalData->mhStockPenAry[i];
+for (sal_uInt16 i = 0; i < pSalData->mnStockPenCount; i++)
+{
+if (nPenColor == pSalData->maStockPenColorAry[i])
+return pSalData->mhStockPenAry[i];
+}
 }
 
 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

2018-12-12 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |  103 +---
 1 file changed, 64 insertions(+), 39 deletions(-)

New commits:
commit 773a29a3fa188b0a1290781d305d2df868e1600c
Author: Dmitriy Shilin 
AuthorDate: Wed Dec 12 10:14:28 2018 +0300
Commit: Mike Kaganski 
CommitDate: Wed Dec 12 11:31:42 2018 +0100

tdf#107792 vcl: split MakeBrush into functions

Change-Id: I531442ca1e121c059fb21bd86ff0c6ac7fa0cac4
Reviewed-on: https://gerrit.libreoffice.org/64914
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index cebacda7e5f5..5c1fa6df3e30 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1457,56 +1457,55 @@ HBRUSH WinSalGraphicsImpl::SearchStockBrush(COLORREF 
nBrushColor)
 return nullptr;
 }
 
-HBRUSH WinSalGraphicsImpl::MakeBrush(Color nColor)
+namespace
+{
+
+HBRUSH Make16BitDIBPatternBrush(Color nColor)
 {
 const SalData* pSalData = GetSalData();
 
-BYTEnRed= nColor.GetRed();
-BYTEnGreen  = nColor.GetGreen();
-BYTEnBlue   = nColor.GetBlue();
-COLORREFnBrushColor = PALETTERGB(nRed, nGreen, nBlue);
+const BYTE nRed   = nColor.GetRed();
+const BYTE nGreen = nColor.GetGreen();
+const BYTE nBlue  = nColor.GetBlue();
 
-if (mrParent.isPrinter() || !pSalData->mhDitherDIB)
-return CreateSolidBrush(nBrushColor);
+static const BYTE aOrdDither16Bit[8][8] =
+{
+   { 0, 6, 1, 7, 0, 6, 1, 7 },
+   { 4, 2, 5, 3, 4, 2, 5, 3 },
+   { 1, 7, 0, 6, 1, 7, 0, 6 },
+   { 5, 3, 4, 2, 5, 3, 4, 2 },
+   { 0, 6, 1, 7, 0, 6, 1, 7 },
+   { 4, 2, 5, 3, 4, 2, 5, 3 },
+   { 1, 7, 0, 6, 1, 7, 0, 6 },
+   { 5, 3, 4, 2, 5, 3, 4, 2 }
+};
 
-if (24 == 
reinterpret_cast(pSalData->mpDitherDIB)->biBitCount)
+BYTE* pTmp = pSalData->mpDitherDIBData;
+long* pDitherDiff = pSalData->mpDitherDiff;
+BYTE* pDitherLow = pSalData->mpDitherLow;
+BYTE* pDitherHigh = pSalData->mpDitherHigh;
+
+for(int nY = 0; nY < 8; ++nY)
 {
-static const BYTE aOrdDither16Bit[8][8] =
-{
-   { 0, 6, 1, 7, 0, 6, 1, 7 },
-   { 4, 2, 5, 3, 4, 2, 5, 3 },
-   { 1, 7, 0, 6, 1, 7, 0, 6 },
-   { 5, 3, 4, 2, 5, 3, 4, 2 },
-   { 0, 6, 1, 7, 0, 6, 1, 7 },
-   { 4, 2, 5, 3, 4, 2, 5, 3 },
-   { 1, 7, 0, 6, 1, 7, 0, 6 },
-   { 5, 3, 4, 2, 5, 3, 4, 2 }
-};
-
-BYTE* pTmp = pSalData->mpDitherDIBData;
-long* pDitherDiff = pSalData->mpDitherDiff;
-BYTE* pDitherLow = pSalData->mpDitherLow;
-BYTE* pDitherHigh = pSalData->mpDitherHigh;
-
-for(int nY = 0; nY < 8; ++nY)
+for(int nX = 0; nX < 8; ++nX)
 {
-for(int nX = 0; nX < 8; ++nX)
-{
-const BYTE nThres = aOrdDither16Bit[nY][nX];
-*pTmp++ = DMAP(nBlue, nThres);
-*pTmp++ = DMAP(nGreen, nThres);
-*pTmp++ = DMAP(nRed, nThres);
-}
+const BYTE nThres = aOrdDither16Bit[nY][nX];
+*pTmp++ = DMAP(nBlue, nThres);
+*pTmp++ = DMAP(nGreen, nThres);
+*pTmp++ = DMAP(nRed, nThres);
 }
-
-return CreateDIBPatternBrush(pSalData->mhDitherDIB, DIB_RGB_COLORS);
 }
 
-if (ImplIsSysColorEntry(nColor))
-return CreateSolidBrush(PALRGB_TO_RGB(nBrushColor));
+return CreateDIBPatternBrush(pSalData->mhDitherDIB, DIB_RGB_COLORS);
+}
 
-if (ImplIsPaletteEntry(nRed, nGreen, nBlue))
-return CreateSolidBrush(nBrushColor);
+HBRUSH Make8BitDIBPatternBrush(Color nColor)
+{
+const SalData* pSalData = GetSalData();
+
+const BYTE nRed   = nColor.GetRed();
+const BYTE nGreen = nColor.GetGreen();
+const BYTE nBlue  = nColor.GetBlue();
 
 static const BYTE aOrdDither8Bit[8][8] =
 {
@@ -1540,6 +1539,32 @@ HBRUSH WinSalGraphicsImpl::MakeBrush(Color nColor)
 return CreateDIBPatternBrush(pSalData->mhDitherDIB, DIB_PAL_COLORS);
 }
 
+} // namespace
+
+HBRUSH WinSalGraphicsImpl::MakeBrush(Color nColor)
+{
+const SalData* pSalData = GetSalData();
+
+const BYTEnRed= nColor.GetRed();
+const BYTEnGreen  = nColor.GetGreen();
+const BYTEnBlue   = nColor.GetBlue();
+const COLORREFnBrushColor = PALETTERGB(nRed, nGreen, nBlue);
+
+if (mrParent.isPrinter() || !pSalData->mhDitherDIB)
+return CreateSolidBrush(nBrushColor);
+
+if (24 == 
reinterpret_cast(pSalData->mpDitherDIB)->biBitCount)
+return Make16BitDIBPatternBrush(nColor);
+
+if (ImplIsSysColorEntry(nColor))
+return CreateSolidBrush(PALRGB_TO_RGB(nBrushColor));
+
+if (ImplIsPaletteEntry(nRed, nGreen, nBlue))
+return CreateSolidBrush(nBrushColor);
+
+return Make8BitDIBPatternBrush(nColor);
+}
+
 void WinSalGraphicsImpl::ResetBrush(HBRUSH hNewBrush)
 {
 HBRUSH hOldBrush = 

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

2018-12-12 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |  195 
 vcl/win/gdi/gdiimpl.hxx |2 
 2 files changed, 102 insertions(+), 95 deletions(-)

New commits:
commit 1f399944ab9d2d46b372a259374cb1c2d26f107c
Author: Dmitriy Shilin 
AuthorDate: Tue Dec 11 08:46:41 2018 +0300
Commit: Mike Kaganski 
CommitDate: Wed Dec 12 09:03:22 2018 +0100

tdf#107792 vcl: simplify SetFillColor()

Change-Id: If01e88d80922ca140e7e5d388cb5760f0bb20d79
Reviewed-on: https://gerrit.libreoffice.org/64913
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 2200dbda000a..cebacda7e5f5 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -165,31 +165,6 @@ void ImplPreparePolyDraw( bool  
bCloseFigures,
 }
 }
 
-
-static BYTE aOrdDither8Bit[8][8] =
-{
-   {  0, 38,  9, 48,  2, 40, 12, 50 },
-   { 25, 12, 35, 22, 28, 15, 37, 24 },
-   {  6, 44,  3, 41,  8, 47,  5, 44 },
-   { 32, 19, 28, 16, 34, 21, 31, 18 },
-   {  1, 40, 11, 49,  0, 39, 10, 48 },
-   { 27, 14, 36, 24, 26, 13, 36, 23 },
-   {  8, 46,  4, 43,  7, 45,  4, 42 },
-   { 33, 20, 30, 17, 32, 20, 29, 16 }
-};
-
-static BYTE aOrdDither16Bit[8][8] =
-{
-   { 0, 6, 1, 7, 0, 6, 1, 7 },
-   { 4, 2, 5, 3, 4, 2, 5, 3 },
-   { 1, 7, 0, 6, 1, 7, 0, 6 },
-   { 5, 3, 4, 2, 5, 3, 4, 2 },
-   { 0, 6, 1, 7, 0, 6, 1, 7 },
-   { 4, 2, 5, 3, 4, 2, 5, 3 },
-   { 1, 7, 0, 6, 1, 7, 0, 6 },
-   { 5, 3, 4, 2, 5, 3, 4, 2 }
-};
-
 Color ImplGetROPColor( SalROPColor nROPColor )
 {
 Color nColor;
@@ -1443,96 +1418,126 @@ void WinSalGraphicsImpl::SetFillColor()
 mbStockBrush = TRUE;
 }
 
-void WinSalGraphicsImpl::SetFillColor( Color nColor )
+void WinSalGraphicsImpl::SetFillColor(Color nColor)
 {
+COLORREF nBrushColor = PALETTERGB(nColor.GetRed(),
+  nColor.GetGreen(),
+  nColor.GetBlue());
+bool bStockBrush = false;
+
+HBRUSH hNewBrush = SearchStockBrush(nBrushColor);
+if (hNewBrush)
+bStockBrush = true;
+else
+hNewBrush = MakeBrush(nColor);
+
+ResetBrush(hNewBrush);
+
+// set new data
+mnBrushColor = nBrushColor;
 maFillColor = nColor;
-SalData*pSalData= GetSalData();
+mbBrush = TRUE;
+mbStockBrush = bStockBrush;
+}
+
+HBRUSH WinSalGraphicsImpl::SearchStockBrush(COLORREF nBrushColor)
+{
+// Only screen, because printer has problems, when we use stock objects.
+if (!mrParent.isPrinter())
+{
+const SalData* pSalData = GetSalData();
+
+for (sal_uInt16 i = 0; i < pSalData->mnStockBrushCount; i++)
+{
+if (nBrushColor == pSalData->maStockBrushColorAry[i])
+return pSalData->mhStockBrushAry[i];
+}
+}
+
+return nullptr;
+}
+
+HBRUSH WinSalGraphicsImpl::MakeBrush(Color nColor)
+{
+const SalData* pSalData = GetSalData();
+
 BYTEnRed= nColor.GetRed();
 BYTEnGreen  = nColor.GetGreen();
 BYTEnBlue   = nColor.GetBlue();
-COLORREFnBrushColor = PALETTERGB( nRed, nGreen, nBlue );
-HBRUSH  hNewBrush   = nullptr;
-boolbStockBrush = FALSE;
+COLORREFnBrushColor = PALETTERGB(nRed, nGreen, nBlue);
 
-// search for stock brush (only screen, because printer have problems,
-// when we use stock objects)
-if ( !mrParent.isPrinter() )
+if (mrParent.isPrinter() || !pSalData->mhDitherDIB)
+return CreateSolidBrush(nBrushColor);
+
+if (24 == 
reinterpret_cast(pSalData->mpDitherDIB)->biBitCount)
 {
-for ( sal_uInt16 i = 0; i < pSalData->mnStockBrushCount; i++ )
+static const BYTE aOrdDither16Bit[8][8] =
+{
+   { 0, 6, 1, 7, 0, 6, 1, 7 },
+   { 4, 2, 5, 3, 4, 2, 5, 3 },
+   { 1, 7, 0, 6, 1, 7, 0, 6 },
+   { 5, 3, 4, 2, 5, 3, 4, 2 },
+   { 0, 6, 1, 7, 0, 6, 1, 7 },
+   { 4, 2, 5, 3, 4, 2, 5, 3 },
+   { 1, 7, 0, 6, 1, 7, 0, 6 },
+   { 5, 3, 4, 2, 5, 3, 4, 2 }
+};
+
+BYTE* pTmp = pSalData->mpDitherDIBData;
+long* pDitherDiff = pSalData->mpDitherDiff;
+BYTE* pDitherLow = pSalData->mpDitherLow;
+BYTE* pDitherHigh = pSalData->mpDitherHigh;
+
+for(int nY = 0; nY < 8; ++nY)
 {
-if ( nBrushColor == pSalData->maStockBrushColorAry[ i ] )
+for(int nX = 0; nX < 8; ++nX)
 {
-hNewBrush = pSalData->mhStockBrushAry[i];
-bStockBrush = TRUE;
-break;
+const BYTE nThres = aOrdDither16Bit[nY][nX];
+*pTmp++ = DMAP(nBlue, nThres);
+*pTmp++ = DMAP(nGreen, nThres);
+*pTmp++ = DMAP(nRed, nThres);
 }
 }
+
+return CreateDIBPatternBrush(pSalData->mhDitherDIB, DIB_RGB_COLORS);
 }
 
-// create new brush
-if ( !hNewBrush )
-{
- 

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

2018-12-10 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   74 ++--
 vcl/win/gdi/gdiimpl.hxx |3 +
 2 files changed, 44 insertions(+), 33 deletions(-)

New commits:
commit 216cbcec6b0361986593e49837f8420e84032d6f
Author: Dmitriy Shilin 
AuthorDate: Sun Dec 9 16:57:23 2018 +0300
Commit: Mike Kaganski 
CommitDate: Tue Dec 11 08:44:58 2018 +0100

tdf#107792 vcl: simplify SetLineColor()

Change-Id: Ie40ef8f4c0b8fe510ead1e8ad66bce88ee6cb913
Reviewed-on: https://gerrit.libreoffice.org/64842
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 72f2f58e524a..2200dbda000a 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1361,50 +1361,58 @@ void WinSalGraphicsImpl::SetLineColor()
 mbStockPen  = TRUE;
 }
 
-void WinSalGraphicsImpl::SetLineColor( Color nColor )
+void WinSalGraphicsImpl::SetLineColor(Color nColor)
 {
+COLORREF nPenColor = PALETTERGB(nColor.GetRed(),
+nColor.GetGreen(),
+nColor.GetBlue());
+bool bStockPen = false;
+
+HPEN hNewPen = SearchStockPen(nPenColor);
+if (hNewPen)
+bStockPen = true;
+else
+hNewPen = MakePen(nColor, nPenColor);
+
+ResetPen(hNewPen);
+
+// set new data
+mnPenColor  = nPenColor;
 maLineColor = nColor;
-COLORREFnPenColor = PALETTERGB( nColor.GetRed(),
-nColor.GetGreen(),
-nColor.GetBlue() );
-HPENhNewPen = nullptr;
-boolbStockPen = FALSE;
+mbPen   = TRUE;
+mbStockPen  = bStockPen;
+}
 
-// search for stock pen (only screen, because printer have problems,
-// when we use stock objects)
-if ( !mrParent.isPrinter() )
+HPEN WinSalGraphicsImpl::SearchStockPen(COLORREF nPenColor)
+{
+// Only screen, because printer has problems, when we use stock objects.
+if (mrParent.isPrinter())
 {
-SalData* pSalData = GetSalData();
-for ( sal_uInt16 i = 0; i < pSalData->mnStockPenCount; i++ )
-{
-if ( nPenColor == pSalData->maStockPenColorAry[i] )
-{
-hNewPen = pSalData->mhStockPenAry[i];
-bStockPen = TRUE;
-break;
-}
-}
+return nullptr;
 }
 
-// create new pen
-if ( !hNewPen )
+const SalData* pSalData = GetSalData();
+
+for (sal_uInt16 i = 0; i < pSalData->mnStockPenCount; i++)
 {
-if ( !mrParent.isPrinter() )
+if (nPenColor == pSalData->maStockPenColorAry[i])
+return pSalData->mhStockPenAry[i];
+}
+
+return nullptr;
+}
+
+HPEN WinSalGraphicsImpl::MakePen(Color nColor, COLORREF nPenColor)
+{
+if (!mrParent.isPrinter())
+{
+if (GetSalData()->mhDitherPal && ImplIsSysColorEntry(nColor))
 {
-if ( GetSalData()->mhDitherPal && ImplIsSysColorEntry( nColor ) )
-nPenColor = PALRGB_TO_RGB( nPenColor );
+nPenColor = PALRGB_TO_RGB(nPenColor);
 }
-
-hNewPen = CreatePen( PS_SOLID, mrParent.mnPenWidth, nPenColor );
-bStockPen = FALSE;
 }
 
-ResetPen(hNewPen);
-
-// set new data
-mnPenColor  = nPenColor;
-mbPen   = TRUE;
-mbStockPen  = bStockPen;
+return CreatePen(PS_SOLID, mrParent.mnPenWidth, nPenColor);
 }
 
 void WinSalGraphicsImpl::ResetPen(HPEN hNewPen)
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 3673b0ca5055..24c904f9ab54 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -52,7 +52,10 @@ private:
 bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& 
rSrcBitmap);
 void drawPixelImpl( long nX, long nY, COLORREF crColor );
 
+HPEN SearchStockPen(COLORREF nPenColor);
+HPEN MakePen(Color nColor, COLORREF nPenColor);
 void ResetPen(HPEN hNewPen);
+
 void ResetBrush(HBRUSH hNewBrush);
 public:
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-09 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   44 
 vcl/win/gdi/gdiimpl.hxx |1 +
 2 files changed, 21 insertions(+), 24 deletions(-)

New commits:
commit 7311a88baa8c30eeb61d897f43ac3f5b481ed01f
Author: Dmitriy Shilin 
AuthorDate: Sat Dec 8 15:07:17 2018 +0300
Commit: Mike Kaganski 
CommitDate: Mon Dec 10 05:46:46 2018 +0100

 tdf#39593 vcl/win/gdi: extract brush updating into method

Change-Id: I569a8e1ce30054b2e01e9f774fe7332fa6874083
Reviewed-on: https://gerrit.libreoffice.org/64802
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 8caf2a94317f..72f2f58e524a 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1428,21 +1428,9 @@ void WinSalGraphicsImpl::ResetPen(HPEN hNewPen)
 
 void WinSalGraphicsImpl::SetFillColor()
 {
-// create and select new brush
-HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH );
-HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hNewBrush );
-
-// destroy or save old brush
-if ( mhBrush )
-{
-if ( !mbStockBrush )
-DeleteBrush( mhBrush );
-}
-else
-mrParent.mhDefBrush = hOldBrush;
+ResetBrush(GetStockBrush(NULL_BRUSH));
 
 // set new data
-mhBrush = hNewBrush;
 mbBrush = FALSE;
 mbStockBrush = TRUE;
 }
@@ -1531,23 +1519,31 @@ void WinSalGraphicsImpl::SetFillColor( Color nColor )
 bStockBrush = FALSE;
 }
 
-// select new brush
-HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hNewBrush );
+ResetBrush(hNewBrush);
 
-// destroy or save old brush
-if ( mhBrush )
+// set new data
+mnBrushColor = nBrushColor;
+mbBrush = TRUE;
+mbStockBrush = bStockBrush;
+}
+
+void WinSalGraphicsImpl::ResetBrush(HBRUSH hNewBrush)
+{
+HBRUSH hOldBrush = SelectBrush(mrParent.getHDC(), hNewBrush);
+
+if (mhBrush)
 {
-if ( !mbStockBrush )
-DeleteBrush( mhBrush );
+if (!mbStockBrush)
+{
+DeleteBrush(mhBrush);
+}
 }
 else
+{
 mrParent.mhDefBrush = hOldBrush;
+}
 
-// set new data
-mnBrushColor = nBrushColor;
-mhBrush = hNewBrush;
-mbBrush = TRUE;
-mbStockBrush = bStockBrush;
+mhBrush = hNewBrush;
 }
 
 void WinSalGraphicsImpl::SetXORMode( bool bSet, bool )
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 040920cb1536..3673b0ca5055 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -53,6 +53,7 @@ private:
 void drawPixelImpl( long nX, long nY, COLORREF crColor );
 
 void ResetPen(HPEN hNewPen);
+void ResetBrush(HBRUSH hNewBrush);
 public:
 
 explicit WinSalGraphicsImpl(WinSalGraphics& rParent);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-09 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   44 
 vcl/win/gdi/gdiimpl.hxx |1 +
 2 files changed, 21 insertions(+), 24 deletions(-)

New commits:
commit 53a29871800c5b520767e18c1e3f10c4d5c4852e
Author: Dmitriy Shilin 
AuthorDate: Sat Dec 8 12:07:30 2018 +0300
Commit: Mike Kaganski 
CommitDate: Sun Dec 9 20:05:30 2018 +0100

tdf#39593 vcl/win/gdi: extract pen resetting into method

Change-Id: I5abb3ed26376b38b2469f124d2ac1864083a09ef
Reviewed-on: https://gerrit.libreoffice.org/64801
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b2879686d9a7..8caf2a94317f 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1354,21 +1354,9 @@ bool WinSalGraphicsImpl::setClipRegion( const 
vcl::Region& i_rClip )
 
 void WinSalGraphicsImpl::SetLineColor()
 {
-// create and select new pen
-HPEN hNewPen = GetStockPen( NULL_PEN );
-HPEN hOldPen = SelectPen( mrParent.getHDC(), hNewPen );
-
-// destroy or save old pen
-if ( mhPen )
-{
-if ( !mbStockPen )
-DeletePen( mhPen );
-}
-else
-mrParent.mhDefPen = hOldPen;
+ResetPen(GetStockPen(NULL_PEN));
 
 // set new data
-mhPen   = hNewPen;
 mbPen   = FALSE;
 mbStockPen  = TRUE;
 }
@@ -1411,23 +1399,31 @@ void WinSalGraphicsImpl::SetLineColor( Color nColor )
 bStockPen = FALSE;
 }
 
-// select new pen
-HPEN hOldPen = SelectPen( mrParent.getHDC(), hNewPen );
+ResetPen(hNewPen);
 
-// destroy or save old pen
-if ( mhPen )
+// set new data
+mnPenColor  = nPenColor;
+mbPen   = TRUE;
+mbStockPen  = bStockPen;
+}
+
+void WinSalGraphicsImpl::ResetPen(HPEN hNewPen)
+{
+HPEN hOldPen = SelectPen(mrParent.getHDC(), hNewPen);
+
+if (mhPen)
 {
-if ( !mbStockPen )
-DeletePen( mhPen );
+if (!mbStockPen)
+{
+DeletePen(mhPen);
+}
 }
 else
+{
 mrParent.mhDefPen = hOldPen;
+}
 
-// set new data
-mnPenColor  = nPenColor;
-mhPen   = hNewPen;
-mbPen   = TRUE;
-mbStockPen  = bStockPen;
+mhPen = hNewPen;
 }
 
 void WinSalGraphicsImpl::SetFillColor()
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 217b33109311..040920cb1536 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -52,6 +52,7 @@ private:
 bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& 
rSrcBitmap);
 void drawPixelImpl( long nX, long nY, COLORREF crColor );
 
+void ResetPen(HPEN hNewPen);
 public:
 
 explicit WinSalGraphicsImpl(WinSalGraphics& rParent);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-08 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.hxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 8f8f9aa52d54f8cbdf044169d95e23b3dcc8da4b
Author: Dmitriy Shilin 
AuthorDate: Sat Dec 8 08:14:55 2018 +0300
Commit: Mike Kaganski 
CommitDate: Sat Dec 8 10:02:52 2018 +0100

vcl/win/gdi: include header guard

Change-Id: I04c55d196a26a5f3319bac08b2f406397335ee32
Reviewed-on: https://gerrit.libreoffice.org/64797
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 54d75bd9291c..217b33109311 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#ifndef INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
+#define INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
+
 #include 
 #include 
 
@@ -234,4 +237,6 @@ public:
  int nX, int nY , ControlCacheKey& 
aControlCacheKey);
 };
 
+#endif // INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-07 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   55 
 1 file changed, 28 insertions(+), 27 deletions(-)

New commits:
commit af4fab260b4e5e6cd073d449081dd057b9715881
Author: Dmitriy Shilin 
AuthorDate: Fri Dec 7 10:45:14 2018 +0300
Commit: Mike Kaganski 
CommitDate: Fri Dec 7 11:23:18 2018 +0100

tdf#39593 vcl: reduce copy-paste in ImplCalcOutSideRgn

Change-Id: I13e13e5e17815bbffef6132ed28fadd3fb12f99b
Reviewed-on: https://gerrit.libreoffice.org/64750
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index fbb36b16ffe2..b2879686d9a7 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -344,47 +344,48 @@ void WinSalGraphicsImpl::copyBits( const SalTwoRect& 
rPosAry, SalGraphics* pSrcG
 }
 }
 
-static void ImplCalcOutSideRgn( const RECT& rSrcRect,
+namespace
+{
+
+void MakeInvisibleArea(const RECT& rSrcRect,
+   int nLeft, int nTop, int nRight, int nBottom,
+   HRGN& rhInvalidateRgn)
+{
+if (!rhInvalidateRgn)
+{
+rhInvalidateRgn = CreateRectRgnIndirect();
+}
+
+HRGN hTempRgn = CreateRectRgn(nLeft, nTop, nRight, nBottom);
+CombineRgn(rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF);
+DeleteRegion(hTempRgn);
+}
+
+void ImplCalcOutSideRgn( const RECT& rSrcRect,
  int nLeft, int nTop, int nRight, int nBottom,
  HRGN& rhInvalidateRgn )
 {
-HRGN hTempRgn;
-
 // calculate area outside the visible region
-if ( rSrcRect.left < nLeft )
+if (rSrcRect.left < nLeft)
 {
-if ( !rhInvalidateRgn )
-rhInvalidateRgn = CreateRectRgnIndirect(  );
-hTempRgn = CreateRectRgn( -31999, 0, nLeft, 31999 );
-CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
-DeleteRegion( hTempRgn );
+MakeInvisibleArea(rSrcRect, -31999, 0, nLeft, 31999, rhInvalidateRgn);
 }
-if ( rSrcRect.top < nTop )
+if (rSrcRect.top < nTop)
 {
-if ( !rhInvalidateRgn )
-rhInvalidateRgn = CreateRectRgnIndirect(  );
-hTempRgn = CreateRectRgn( 0, -31999, 31999, nTop );
-CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
-DeleteRegion( hTempRgn );
+MakeInvisibleArea(rSrcRect, 0, -31999, 31999, nTop, rhInvalidateRgn);
 }
-if ( rSrcRect.right > nRight )
+if (rSrcRect.right > nRight)
 {
-if ( !rhInvalidateRgn )
-rhInvalidateRgn = CreateRectRgnIndirect(  );
-hTempRgn = CreateRectRgn( nRight, 0, 31999, 31999 );
-CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
-DeleteRegion( hTempRgn );
+MakeInvisibleArea(rSrcRect, nRight, 0, 31999, 31999, rhInvalidateRgn);
 }
-if ( rSrcRect.bottom > nBottom )
+if (rSrcRect.bottom > nBottom)
 {
-if ( !rhInvalidateRgn )
-rhInvalidateRgn = CreateRectRgnIndirect(  );
-hTempRgn = CreateRectRgn( 0, nBottom, 31999, 31999 );
-CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
-DeleteRegion( hTempRgn );
+MakeInvisibleArea(rSrcRect, 0, nBottom, 31999, 31999, rhInvalidateRgn);
 }
 }
 
+} // namespace
+
 void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY,
 long nSrcX, long nSrcY,
 long nSrcWidth, long nSrcHeight,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-07 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2ee6993007fc5160f73b7e560f6825fcecd0447e
Author: Dmitriy Shilin 
AuthorDate: Fri Dec 7 07:51:33 2018 +0300
Commit: Mike Kaganski 
CommitDate: Fri Dec 7 11:21:36 2018 +0100

vcl: use ref to const while iterating over palette entries

Change-Id: I2a1b36d9f4bb17f8b60af86a48bc9ec84588a32b
Reviewed-on: https://gerrit.libreoffice.org/64749
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index d8fd23ed6847..fbb36b16ffe2 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -211,7 +211,7 @@ bool IsDitherColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
 
 bool IsPaletteColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
 {
-static PALETTEENTRY aImplSalSysPalEntryAry[] =
+static const PALETTEENTRY aImplSalSysPalEntryAry[] =
 {
 {0,0,0, 0 },
 {0,0, 0x80, 0 },
@@ -231,7 +231,7 @@ bool IsPaletteColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
 { 0xFF, 0xFF, 0xFF, 0 }
 };
 
-for (auto& rPalEntry : aImplSalSysPalEntryAry)
+for (const auto& rPalEntry : aImplSalSysPalEntryAry)
 {
 if(rPalEntry.peRed == nRed &&
rPalEntry.peGreen == nGreen &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-06 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   99 ++--
 1 file changed, 54 insertions(+), 45 deletions(-)

New commits:
commit 8eff8a7a37fe5183bb46f977582fccd463cafe99
Author: Dmitriy Shilin 
AuthorDate: Thu Dec 6 08:52:05 2018 +0300
Commit: Mike Kaganski 
CommitDate: Thu Dec 6 11:33:07 2018 +0100

vcl: split ImplIsPaletteEntry into low-level functions

Change-Id: I785d70cf05452ce3dbe209f595670d68b9653e22
Reviewed-on: https://gerrit.libreoffice.org/64668
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b24760a3cf95..d8fd23ed6847 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -61,8 +61,6 @@
 #define SAL_POLYPOLYCOUNT_STACKBUF  8
 #define SAL_POLYPOLYPOINTS_STACKBUF 64
 
-#define DITHER_PAL_DELTA51
-#define DITHER_MAX_SYSCOLOR 16
 #define DMAP( _def_nVal, _def_nThres )  
((pDitherDiff[_def_nVal]>(_def_nThres))?pDitherHigh[_def_nVal]:pDitherLow[_def_nVal])
 
 #define SAL_POLY_STACKBUF   32
@@ -168,31 +166,6 @@ void ImplPreparePolyDraw( bool  
bCloseFigures,
 }
 
 
-static PALETTEENTRY aImplSalSysPalEntryAry[ DITHER_MAX_SYSCOLOR ] =
-{
-{0,0,0, 0 },
-{0,0, 0x80, 0 },
-{0, 0x80,0, 0 },
-{0, 0x80, 0x80, 0 },
-{ 0x80,0,0, 0 },
-{ 0x80,0, 0x80, 0 },
-{ 0x80, 0x80,0, 0 },
-{ 0x80, 0x80, 0x80, 0 },
-{ 0xC0, 0xC0, 0xC0, 0 },
-{0,0, 0xFF, 0 },
-{0, 0xFF,0, 0 },
-{0, 0xFF, 0xFF, 0 },
-{ 0xFF,0,0, 0 },
-{ 0xFF,0, 0xFF, 0 },
-{ 0xFF, 0xFF,0, 0 },
-{ 0xFF, 0xFF, 0xFF, 0 }
-};
-
-static PALETTEENTRY aImplExtraColor1 =
-{
-0, 184, 255, 0
-};
-
 static BYTE aOrdDither8Bit[8][8] =
 {
{  0, 38,  9, 48,  2, 40, 12, 50 },
@@ -227,34 +200,71 @@ Color ImplGetROPColor( SalROPColor nROPColor )
 return nColor;
 }
 
-int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue )
+bool IsDitherColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
 {
-// dither color?
-if ( !(nRed % DITHER_PAL_DELTA) && !(nGreen % DITHER_PAL_DELTA) && !(nBlue 
% DITHER_PAL_DELTA) )
-return TRUE;
+constexpr sal_uInt8 DITHER_PAL_DELTA = 51;
 
-PALETTEENTRY* pPalEntry = aImplSalSysPalEntryAry;
+return !(nRed % DITHER_PAL_DELTA) &&
+   !(nGreen % DITHER_PAL_DELTA) &&
+   !(nBlue % DITHER_PAL_DELTA);
+}
+
+bool IsPaletteColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
+{
+static PALETTEENTRY aImplSalSysPalEntryAry[] =
+{
+{0,0,0, 0 },
+{0,0, 0x80, 0 },
+{0, 0x80,0, 0 },
+{0, 0x80, 0x80, 0 },
+{ 0x80,0,0, 0 },
+{ 0x80,0, 0x80, 0 },
+{ 0x80, 0x80,0, 0 },
+{ 0x80, 0x80, 0x80, 0 },
+{ 0xC0, 0xC0, 0xC0, 0 },
+{0,0, 0xFF, 0 },
+{0, 0xFF,0, 0 },
+{0, 0xFF, 0xFF, 0 },
+{ 0xFF,0,0, 0 },
+{ 0xFF,0, 0xFF, 0 },
+{ 0xFF, 0xFF,0, 0 },
+{ 0xFF, 0xFF, 0xFF, 0 }
+};
 
-// standard palette color?
-for ( sal_uInt16 i = 0; i < DITHER_MAX_SYSCOLOR; i++, pPalEntry++ )
+for (auto& rPalEntry : aImplSalSysPalEntryAry)
 {
-if( pPalEntry->peRed == nRed && pPalEntry->peGreen == nGreen && 
pPalEntry->peBlue == nBlue )
-return TRUE;
+if(rPalEntry.peRed == nRed &&
+   rPalEntry.peGreen == nGreen &&
+   rPalEntry.peBlue == nBlue)
+{
+return true;
+}
 }
 
-// extra color?
-if ( aImplExtraColor1.peRed == nRed &&
- aImplExtraColor1.peGreen == nGreen &&
- aImplExtraColor1.peBlue == nBlue )
+return false;
+}
+
+bool IsExtraColor(BYTE nRed, BYTE nGreen, BYTE nBlue)
+{
+static PALETTEENTRY aImplExtraColor1 =
 {
-return TRUE;
-}
+0, 184, 255, 0
+};
 
-return FALSE;
+return aImplExtraColor1.peRed == nRed &&
+   aImplExtraColor1.peGreen == nGreen &&
+   aImplExtraColor1.peBlue == nBlue;
 }
 
+bool ImplIsPaletteEntry(BYTE nRed, BYTE nGreen, BYTE nBlue)
+{
+return IsDitherColor(nRed, nGreen, nBlue) ||
+   IsPaletteColor(nRed, nGreen, nBlue) ||
+   IsExtraColor(nRed, nGreen, nBlue);
 }
 
+} // namespace
+
 WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& rParent):
 mrParent(rParent),
 mbXORMode(false),
@@ -280,7 +290,6 @@ WinSalGraphicsImpl::~WinSalGraphicsImpl()
 if ( !mbStockBrush )
 DeleteBrush( mhBrush );
 }
-
 }
 
 void WinSalGraphicsImpl::Init()
@@ -673,7 +682,7 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, 
const WinSalBitmap& rSa
 }
 }
 
-}
+} // namespace
 
 void WinSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSalBitmap)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-05 Thread Libreoffice Gerrit user
 vcl/win/gdi/salgdi.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 6ad0a96a460551389808fa96e0992938540c5b72
Author: Dmitriy Shilin 
AuthorDate: Thu Dec 6 07:52:37 2018 +0300
Commit: Noel Grandin 
CommitDate: Thu Dec 6 07:21:27 2018 +0100

vcl: move SysColorEntry to anonymous namespace

Change-Id: Ib483decf4cd7d8ec5cb73a23c36181bd3e1d49c0
Relates: tdf#107792
Reviewed-on: https://gerrit.libreoffice.org/64661
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index da06dc999e4c..363476a7107f 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -45,17 +45,17 @@
 #define DITHER_MAX_SYSCOLOR 16
 #define DITHER_EXTRA_COLORS 1
 
+namespace
+{
+
 struct SysColorEntry
 {
 DWORD   nRGB;
 SysColorEntry*  pNext;
 };
 
-static SysColorEntry* pFirstSysColor = nullptr;
-static SysColorEntry* pActSysColor = nullptr;
-
-namespace
-{
+SysColorEntry* pFirstSysColor = nullptr;
+SysColorEntry* pActSysColor = nullptr;
 
 void DeleteSysColorList()
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-05 Thread Libreoffice Gerrit user
 vcl/win/gdi/salgdi.cxx |   38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

New commits:
commit 6fa4c3e4778959d4591c053461329d396741ee64
Author: Dmitriy Shilin 
AuthorDate: Fri Nov 30 08:41:00 2018 +0300
Commit: Mike Kaganski 
CommitDate: Wed Dec 5 12:16:45 2018 +0100

tdf#39593 vcl: extract SysColor list deletion

Change-Id: I7d1b319a1cf551e1fd6b67f13f738ab42df1b77d
Reviewed-on: https://gerrit.libreoffice.org/64591
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index c1ec8bd88e2d..da06dc999e4c 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -54,6 +54,24 @@ struct SysColorEntry
 static SysColorEntry* pFirstSysColor = nullptr;
 static SysColorEntry* pActSysColor = nullptr;
 
+namespace
+{
+
+void DeleteSysColorList()
+{
+SysColorEntry* pEntry = pFirstSysColor;
+pActSysColor = pFirstSysColor = nullptr;
+
+while( pEntry )
+{
+SysColorEntry* pTmp = pEntry->pNext;
+delete pEntry;
+pEntry = pTmp;
+}
+}
+
+} // namespace
+
 // Blue7
 static PALETTEENTRY aImplExtraColor1 =
 {
@@ -315,15 +333,7 @@ void ImplFreeSalGDI()
 delete[] pSalData->mpDitherHigh;
 }
 
-// delete SysColorList
-SysColorEntry* pEntry = pFirstSysColor;
-while( pEntry )
-{
-SysColorEntry* pTmp = pEntry->pNext;
-delete pEntry;
-pEntry = pTmp;
-}
-pFirstSysColor = nullptr;
+DeleteSysColorList();
 
 // delete icon cache
 SalIcon* pIcon = pSalData->mpFirstIcon;
@@ -409,15 +419,7 @@ static void ImplInsertSysColorEntry( int nSysIndex )
 
 void ImplUpdateSysColorEntries()
 {
-// delete old SysColorList
-SysColorEntry* pEntry = pFirstSysColor;
-while( pEntry )
-{
-SysColorEntry* pTmp = pEntry->pNext;
-delete pEntry;
-pEntry = pTmp;
-}
-pActSysColor = pFirstSysColor = nullptr;
+DeleteSysColorList();
 
 // create new sys color list
 ImplInsertSysColorEntry( COLOR_ACTIVEBORDER );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-27 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 6ef1eac70343d7867e24fa4830081640b0e20351
Author: Mike Kaganski 
AuthorDate: Sat Oct 27 09:35:07 2018 +0200
Commit: Mike Kaganski 
CommitDate: Sat Oct 27 11:43:01 2018 +0200

tdf#120703 (PVS): V519 variable is assigned values twice successively

V519 The 'xFontCharMap' variable is assigned values twice successively.
 Perhaps this is a mistake. Check lines: 1673, 1674.

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index b5a0efbf047e..82c69c94a2c7 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1658,8 +1658,6 @@ bool WinSalGraphics::CreateFontSubset( const OUString& 
rToFile,
 if( aRawCffData.get() )
 {
 pWinFontData->UpdateFromHDC( getHDC() );
-FontCharMapRef xFontCharMap = pWinFontData->GetFontCharMap();
-xFontCharMap = nullptr;
 
 // provide a font subset from the CFF-table
 FILE* pOutFile = fopen( aToFile.getStr(), "wb" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-20 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 5d0b961b1962474fd5c5be9a6a064114a710bc1b
Author: Caolán McNamara 
AuthorDate: Fri Oct 19 17:34:39 2018 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 20 19:55:51 2018 +0200

use std::unique_ptr

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

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 3962c4d4a52d..1ba590cc803e 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -579,14 +579,14 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, 
const WinSalBitmap& rSa
 {
 HGLOBAL hDrawDIB;
 HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB();
-WinSalBitmap*   pTmpSalBmp = nullptr;
+std::unique_ptr xTmpSalBmp;
 boolbPrintDDB = ( bPrinter && hDrawDDB );
 
 if( bPrintDDB )
 {
-pTmpSalBmp = new WinSalBitmap;
-pTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() );
-hDrawDIB = pTmpSalBmp->ImplGethDIB();
+xTmpSalBmp.reset(new WinSalBitmap);
+xTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() );
+hDrawDIB = xTmpSalBmp->ImplGethDIB();
 }
 else
 hDrawDIB = rSalBitmap.ImplGethDIB();
@@ -670,9 +670,6 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, 
const WinSalBitmap& rSa
 
 ImplReleaseCachedDC( CACHED_HDC_DRAW );
 }
-
-if( bPrintDDB )
-delete pTmpSalBmp;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-19 Thread Libreoffice Gerrit user
 vcl/win/gdi/winlayout.cxx |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 792d07c7f2816f1afdbed1d0b8129e3f1aecf8d7
Author: Jan-Marek Glogowski 
AuthorDate: Fri Oct 19 09:45:54 2018 +
Commit: Jan-Marek Glogowski 
CommitDate: Fri Oct 19 22:53:46 2018 +0200

WIN fix CacheGlyphToAtlas resource handling

Use :comphelper::ScopeGuard to handle cleanup.
And actually restore the original font on the correct DC.

Change-Id: Ib59d430636b470486da2f8e5e34ed8d71b57aac2
Reviewed-on: https://gerrit.libreoffice.org/62010
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 35303fc5c8a5..efbbd0c1edb3 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -23,6 +23,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -48,11 +49,11 @@
 #include 
 #include 
 
-GlobalOpenGLGlyphCache * GlobalOpenGLGlyphCache::get() {
-SalData * data = GetSalData();
-if (!data->m_pGlobalOpenGLGlyphCache) {
+GlobalOpenGLGlyphCache * GlobalOpenGLGlyphCache::get()
+{
+SalData *data = GetSalData();
+if (!data->m_pGlobalOpenGLGlyphCache)
 data->m_pGlobalOpenGLGlyphCache.reset(new GlobalOpenGLGlyphCache);
-}
 return data->m_pGlobalOpenGLGlyphCache.get();
 }
 
@@ -67,12 +68,15 @@ 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(aHDC.get(), hFont));
+
+const HFONT hOrigFont = static_cast(SelectObject(aHDC.get(), 
hFont));
 if (hOrigFont == nullptr)
 {
 SAL_WARN("vcl.gdi", "SelectObject failed: " << 
WindowsErrorString(GetLastError()));
 return false;
 }
+const ::comphelper::ScopeGuard aHFONTrestoreScopeGuard(
+[,hOrigFont]() { SelectFont(aHDC.get(), hOrigFont); });
 
 // For now we assume DWrite is present and we won't bother with fallback 
paths.
 D2DWriteTextOutRenderer * pTxt = dynamic_cast(::get(true));
@@ -86,6 +90,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, 
int nGlyphIndex, S
 SAL_WARN("vcl.gdi", "Binding of font failed. The font might not be 
supported by DirectWrite.");
 return false;
 }
+const ::comphelper::ScopeGuard aFontReleaseScopeGuard([]() { 
pTxt->ReleaseFont(); });
 
 std::vector aGlyphIndices(1);
 aGlyphIndices[0] = nGlyphIndex;
@@ -158,10 +163,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 
 ID2D1SolidColorBrush* pBrush = nullptr;
 if 
(!SUCCEEDED(pRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black), 
)))
-{
-pTxt->ReleaseFont();
 return false;
-}
 
 D2D1_POINT_2F baseline = {
 static_cast(aElement.getExtraOffset()),
@@ -194,12 +196,9 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 break;
 default:
 SAL_WARN("vcl.gdi", "DrawGlyphRun-EndDraw failed: " << 
WindowsErrorString(GetLastError()));
-SelectFont(aDC.getCompatibleHDC(), hOrigFont);
 return false;
 }
 
-pTxt->ReleaseFont();
-
 if (!OpenGLGlyphCache::ReserveTextureSpace(aElement, nBitmapWidth, 
nBitmapHeight))
 return false;
 if (!aDC.copyToTexture(aElement.maTexture))
@@ -207,8 +206,6 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 
 maOpenGLGlyphCache.PutDrawElementInCache(aElement, nGlyphIndex);
 
-SelectFont(aDC.getCompatibleHDC(), hOrigFont);
-
 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

2018-10-06 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |   19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

New commits:
commit 01a782d2ceb741d20721b44d26d862d80b47d226
Author: Jan-Marek Glogowski 
AuthorDate: Thu Oct 4 14:05:30 2018 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Oct 6 15:19:38 2018 +0200

tdf#119829 use font cache based glyph rect cache

The current glyph cache on Windows didn't work for multiple fonts
and had to be manually invalidated on font change. The new glyph
rect cache is coupled to the font cache and will invalidate all
cached glyph rects, if a cached font is released.

So switch to the new cache on Windows.

Change-Id: Ic641f78e2e664dc0ad52e595d5fdfb6ef611eb3f
Reviewed-on: https://gerrit.libreoffice.org/61278
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index ba205d1c8d74..a93141ff83e5 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -60,11 +60,6 @@
 
 using namespace vcl;
 
-// GetGlyphOutlineW() seems to be a little slow, and doesn't seem to do its 
own caching (tested on Windows10).
-// TODO include the font as part of the cache key, then we won't need to clear 
it on font change
-// The cache limit is set by the rough number of characters needed to read 
your average Asian newspaper.
-static o3tl::lru_map g_BoundRectCache(3000);
-
 static const int MAXFONTHEIGHT = 2048;
 
 static inline FIXED FixedFromDouble( double d )
@@ -846,8 +841,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const 
& i_rFont,
 float& o_rFontScale,
 HFONT& o_rOldFont)
 {
-// clear the cache on font change
-g_BoundRectCache.clear();
 HFONT hNewFont = nullptr;
 
 LOGFONTW aLogFont;
@@ -1335,16 +1328,12 @@ void WinSalGraphics::ClearDevFontCache()
 
 bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, 
tools::Rectangle& rRect)
 {
-auto it = g_BoundRectCache.find(rGlyph.maGlyphId);
-if (it != g_BoundRectCache.end())
-{
-rRect = it->second;
-return true;
-}
-
 rtl::Reference pFont = 
mpWinFontEntry[rGlyph.mnFallbackLevel];
 assert(pFont.is());
 
+if (pFont.is() && pFont->GetCachedGlyphBoundRect(rGlyph.maGlyphId, rRect))
+return true;
+
 HDC hDC = getHDC();
 HFONT hFont = static_cast(GetCurrentObject(hDC, OBJ_FONT));
 float fFontScale = 1.0;
@@ -1379,7 +1368,7 @@ bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& 
rGlyph, tools::Rectangle
 rRect.SetTop(static_cast( fFontScale * rRect.Top() ));
 rRect.SetBottom(static_cast( fFontScale * rRect.Bottom() ) + 1);
 
-g_BoundRectCache.insert({rGlyph.maGlyphId, rRect});
+pFont->CacheGlyphBoundRect(rGlyph.maGlyphId, rRect);
 
 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

2018-09-24 Thread Libreoffice Gerrit user
 vcl/win/gdi/salprn.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 79cb9ef524c3a6b058019da5ca6acfad7a895bf2
Author: Jan-Marek Glogowski 
AuthorDate: Tue Sep 11 14:02:22 2018 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Sep 24 18:05:31 2018 +0200

tdf#118690 don't try to process all messages

Regression from commit 221b0ab1245b ("WIN use Reschedule instead
of own dispatch loops"). This limit the maximum reschedule loops
as the original code did. There is still a busy loop when opening
the print dialog, as it was before the patch, but this at least
gets printing started.

Change-Id: If867329b82b13c898bb15b08584244084488a66c
Reviewed-on: https://gerrit.libreoffice.org/60310
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index a2b78b990920..92ca44f6af3d 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1287,6 +1287,7 @@ static BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int 
/* nError */ )
 {
 SalData*pSalData = GetSalData();
 WinSalPrinter* pPrinter;
+int i = 0;
 boolbWhile = true;
 
 // Ensure we handle the mutex which will be released in 
WinSalInstance::DoYield
@@ -1295,6 +1296,10 @@ static BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int 
/* nError */ )
 {
 // process messages
 bWhile = Application::Reschedule( true );
+if (i > 15)
+bWhile = false;
+else
+++i;
 
 pPrinter = pSalData->mpFirstPrinter;
 while ( pPrinter )
@@ -1457,7 +1462,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
 
 // As the Telecom Balloon Fax driver tends to send messages repeatedly
 // we try to process first all, and then insert a dummy message
-while ( Application::Reschedule( true ) );
+for (int i = 0; Application::Reschedule( true ) && i <= 15; ++i);
 BOOL const ret = PostMessageW(GetSalData()->mpInstance->mhComWnd, 
SAL_MSG_DUMMY, 0, 0);
 SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-17 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit cb1f0bebf80be925927028f90f8b631c9ad51e53
Author: Stephan Bergmann 
AuthorDate: Mon Sep 17 18:29:10 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Sep 17 22:21:47 2018 +0200

-Werror,-Wshadow (clang-cl)

Change-Id: I14040fd236d399bfce6c4e6e6927a00aabe5b2c5
Reviewed-on: https://gerrit.libreoffice.org/60595
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 0134c9ab63e5..0fde7b510486 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2139,7 +2139,6 @@ bool WinSalGraphicsImpl::drawPolyLine(
 const Gdiplus::Color aTestColor(aTrans, maLineColor.GetRed(), 
maLineColor.GetGreen(), maLineColor.GetBlue());
 Gdiplus::Pen aPen(aTestColor.GetValue(), 
Gdiplus::REAL(rLineWidths.getX()));
 bool bNoLineJoin(false);
-Gdiplus::Matrix aMatrix;
 
 // Set full (Object-to-Device) transformation - if used
 if(rObjectToDevice.isIdentity())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-13 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit c29e90ceb71518d8f27bdc7cd9e8446f934c3c7d
Author: Michael Stahl 
AuthorDate: Thu Sep 13 14:35:55 2018 +0200
Commit: Michael Stahl 
CommitDate: Thu Sep 13 16:33:54 2018 +0200

vcl: revert verbose WNT font logging

Revert 656bef6ce3626769bd59fc7c46d781af512dfe0e to use SAL_INFO again,
as there are few if any font related test failures now.

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index f775a139855b..ae8628079021 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1046,7 +1046,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 {
 if ((nFontType & RASTER_FONTTYPE) && !(nFontType & 
DEVICE_FONTTYPE))
 {
-SAL_WARN("vcl.fonts", "Unsupported printer font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
+SAL_INFO("vcl.fonts", "Unsupported printer font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
 return 1;
 }
 }
@@ -1055,7 +1055,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
  !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
  !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
 {
-SAL_WARN("vcl.fonts", "Unsupported font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
+SAL_INFO("vcl.fonts", "Unsupported font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
 return 1;
 }
 
@@ -1063,7 +1063,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
 
 pInfo->mpList->Add( pData.get() );
-SAL_WARN("vcl.fonts", "SalEnumFontsProcExW: font added: " << 
pData->GetFamilyName() << " " << pData->GetStyleName());
+SAL_INFO("vcl.fonts", "SalEnumFontsProcExW: font added: " << 
pData->GetFamilyName() << " " << pData->GetStyleName());
 }
 
 return 1;
@@ -1230,7 +1230,7 @@ static bool ImplGetFontAttrFromFile( const OUString& 
rFontFileURL,
 bool WinSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
 const OUString& rFontFileURL, const OUString& rFontName )
 {
-SAL_WARN( "vcl.fonts", "WinSalGraphics::AddTempDevFont(): " << 
rFontFileURL );
+SAL_INFO("vcl.fonts", "WinSalGraphics::AddTempDevFont(): " << 
rFontFileURL);
 
 FontAttributes aDFA;
 aDFA.SetFamilyName(rFontName);
@@ -1274,7 +1274,7 @@ bool WinSalGraphics::AddTempDevFont( 
PhysicalFontCollection* pFontCollection,
 
 void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
 {
-SAL_WARN( "vcl.fonts", "WinSalGraphics::GetDevFontList(): enter" );
+SAL_INFO("vcl.fonts", "WinSalGraphics::GetDevFontList(): enter");
 
 // make sure all fonts are registered at least temporarily
 static bool bOnce = true;
@@ -1326,7 +1326,7 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 pFontCollection->SetFallbackHook(  );
 pFontCollection->SetPreMatchHook();
 
-SAL_WARN( "vcl.fonts", "WinSalGraphics::GetDevFontList(): leave" );
+SAL_INFO("vcl.fonts", "WinSalGraphics::GetDevFontList(): leave");
 }
 
 void WinSalGraphics::ClearDevFontCache()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-11 Thread Libreoffice Gerrit user
 vcl/win/gdi/gdiimpl.cxx |5 -
 vcl/win/gdi/salbmp.cxx  |5 -
 2 files changed, 10 deletions(-)

New commits:
commit 6d79c2f56d3548d8ea767dfe69626759e6cf6f34
Author: Stephan Bergmann 
AuthorDate: Tue Sep 11 16:51:08 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Sep 11 20:20:29 2018 +0200

loplugin:unnecessaryoverride (clang-cl)

Change-Id: If20c05de5521ff2121da4b5973dcf15697bafe95
Reviewed-on: https://gerrit.libreoffice.org/60325
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index bf2dcc9197e0..33d89b6c94e1 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2025,7 +2025,6 @@ private:
 public:
 SystemDependentData_GraphicsPath(
 basegfx::SystemDependentDataManager& rSystemDependentDataManager);
-virtual ~SystemDependentData_GraphicsPath() override;
 
 Gdiplus::GraphicsPath& getGraphicsPath() { return maGraphicsPath; }
 
@@ -2041,10 +2040,6 @@ 
SystemDependentData_GraphicsPath::SystemDependentData_GraphicsPath(
 {
 }
 
-SystemDependentData_GraphicsPath::~SystemDependentData_GraphicsPath()
-{
-}
-
 bool WinSalGraphicsImpl::drawPolyLine(
 const basegfx::B2DHomMatrix& rObjectToDevice,
 const basegfx::B2DPolygon& rPolygon,
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index fa8b011ab5aa..b61103e17067 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -99,7 +99,6 @@ private:
 public:
 SystemDependentData_GdiPlusBitmap(
 basegfx::SystemDependentDataManager& rSystemDependentDataManager);
-virtual ~SystemDependentData_GdiPlusBitmap() override;
 
 const WinSalBitmap* getAssociatedAlpha() const { return mpAssociatedAlpha; 
}
 void setAssociatedAlpha(const WinSalBitmap* pNew) { mpAssociatedAlpha = 
pNew; }
@@ -116,10 +115,6 @@ 
SystemDependentData_GdiPlusBitmap::SystemDependentData_GdiPlusBitmap(
 {
 }
 
-SystemDependentData_GdiPlusBitmap::~SystemDependentData_GdiPlusBitmap()
-{
-}
-
 std::shared_ptr< Gdiplus::Bitmap > WinSalBitmap::ImplGetGdiPlusBitmap(const 
WinSalBitmap* pAlphaSource) const
 {
 std::shared_ptr< Gdiplus::Bitmap > aRetval;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-11 Thread Libreoffice Gerrit user
 vcl/win/gdi/winlayout.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 2ee177e58a57420eaa18b9d39ade4c28907bc0c8
Author: Jan-Marek Glogowski 
AuthorDate: Mon Sep 10 13:15:36 2018 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Sep 11 16:10:08 2018 +0200

tdf#119756 assume the HFONT is always valid

This is a regression from the commit 7cb3e475f2fb ("WIN add
SalGraphics* to WinFontInstance"). We need a sensible way to
compare the SalGraphics / HFONT. I'm not sure how to implement
this yet, so just assume unchanged, as the old code did.

Change-Id: I828a41e529976c500eedaef3afd40cf20287f746
Reviewed-on: https://gerrit.libreoffice.org/60256
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index a1d76c8026a4..5cef9f5534aa 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -395,10 +395,9 @@ hb_font_t* WinFontInstance::ImplInitHbFont()
 
 void WinFontInstance::SetGraphics(WinSalGraphics *pGraphics)
 {
-ReleaseHbFont();
-if (m_hFont)
-::DeleteFont(m_hFont);
 m_pGraphics = pGraphics;
+if (m_hFont)
+return;
 HFONT hOrigFont;
 m_hFont = m_pGraphics->ImplDoSetFont(GetFontSelectPattern(), 
GetFontFace(), m_fScale, hOrigFont);
 SelectObject(m_pGraphics->getHDC(), hOrigFont);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-09 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b90fa8698e1928b218cdbc07a7ca02b5a80eb406
Author: Julien Nabet 
AuthorDate: Sun Sep 9 20:34:34 2018 +0200
Commit: Julien Nabet 
CommitDate: Sun Sep 9 22:00:50 2018 +0200

cppcheck: fix arrayIndexThenCheck (vcl/salfont)

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 15a95ee98668..f775a139855b 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -945,7 +945,7 @@ void WinSalGraphics::SetFont(LogicalFontInstance* pFont, 
int nFallbackLevel)
 else
 {
 // release no longer referenced font handles
-for( int i = nFallbackLevel + 1; mpWinFontEntry[i].is() && i < 
MAX_FALLBACK; ++i )
+for( int i = nFallbackLevel + 1; i < MAX_FALLBACK && 
mpWinFontEntry[i].is(); ++i )
 mpWinFontEntry[i] = nullptr;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-04 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |   38 ++
 1 file changed, 18 insertions(+), 20 deletions(-)

New commits:
commit 7e7a1ff3926e86705199aa9814089e90f01c02ed
Author: Jan-Marek Glogowski 
AuthorDate: Tue Sep 4 17:24:03 2018 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Sep 4 19:20:53 2018 +0200

tdf#119340 WIN don't always re-init the HFONT

After all the LogicalFontInstance refactoring, its FontSelectData
is now immutable, so the HFONT will never need to be changed.
Therefore we can skip the HFONT lookup in WinSalGraphics::SetFont,
if the WinFontInstance already has it set.

All the HFONT handling (basically WinSalGraphics::ImplDoSetFont)
should be moved to the WinFontInstance to further clean this up.

Change-Id: I1c9a9e3414677d77f0f007d7ace653bb53b8474d
Reviewed-on: https://gerrit.libreoffice.org/59988
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 969cefd17279..8c1a6651bbd5 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -851,11 +851,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern 
const & i_rFont,
 g_BoundRectCache.clear();
 HFONT hNewFont = nullptr;
 
-HDC hdcScreen = nullptr;
-if( mbVirDev )
-// only required for virtual devices, see below for details
-hdcScreen = GetDC(nullptr);
-
 LOGFONTW aLogFont;
 ImplGetLogFontFromFontSelect( getHDC(), i_rFont, i_pFontFace, aLogFont );
 
@@ -878,8 +873,12 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern 
const & i_rFont,
 aLogFont.lfWidth = +MAXFONTHEIGHT;
 aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale );
 }
-
 hNewFont = ::CreateFontIndirectW(  );
+
+HDC hdcScreen = nullptr;
+if( mbVirDev )
+// only required for virtual devices, see below for details
+hdcScreen = GetDC(nullptr);
 if( hdcScreen )
 {
 // select font into screen hdc first to get an antialiased font
@@ -934,12 +933,18 @@ void WinSalGraphics::SetFont(LogicalFontInstance* pFont, 
int nFallbackLevel)
 return;
 }
 
-// WinSalGraphics::GetEmbedFontData does not set mpFontInstance
-// since it is interested in font file data only.
-mpWinFontEntry[ nFallbackLevel ] = 
reinterpret_cast(pFont);
+mpWinFontEntry[ nFallbackLevel ] = static_cast(pFont);
 
 HFONT hOldFont = nullptr;
-HFONT hNewFont = ImplDoSetFont(pFont->GetFontSelectPattern(), 
pFont->GetFontFace(), mfFontScale[ nFallbackLevel ], hOldFont);
+HFONT hNewFont = mpWinFontEntry[ nFallbackLevel ]->GetHFONT();
+if (!hNewFont)
+{
+hNewFont = ImplDoSetFont(pFont->GetFontSelectPattern(), 
pFont->GetFontFace(), mfFontScale[ nFallbackLevel ], hOldFont);
+mpWinFontEntry[ nFallbackLevel ]->SetHFONT(hNewFont);
+}
+else
+hOldFont = ::SelectFont( getHDC(), hNewFont );
+
 mfCurrentFontScale = mfFontScale[nFallbackLevel];
 
 if( !mhDefFont )
@@ -962,16 +967,9 @@ void WinSalGraphics::SetFont(LogicalFontInstance* pFont, 
int nFallbackLevel)
 }
 }
 
-// store new font in correct layer
-if (mpWinFontEntry[nFallbackLevel])
-{
-mpWinFontEntry[nFallbackLevel]->SetHFONT(hNewFont);
-// now the font is live => update font face
-const WinFontFace* pFontFace = static_cast(mpWinFontEntry[nFallbackLevel]->GetFontFace());
-pFontFace->UpdateFromHDC(getHDC());
-}
-else
-mhFonts[ nFallbackLevel ] = hNewFont;
+// now the font is live => update font face
+const WinFontFace* pFontFace = static_cast(mpWinFontEntry[nFallbackLevel]->GetFontFace());
+pFontFace->UpdateFromHDC(getHDC());
 }
 
 void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int 
nFallbackLevel )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-23 Thread Libreoffice Gerrit user
 vcl/win/window/salframe.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6a0aeb78e3098e92c09de24bd6036b90a13152f2
Author: Stephan Bergmann 
AuthorDate: Thu Aug 23 14:23:06 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Aug 23 15:51:26 2018 +0200

loplugin:cstylecast (clang-cl)

Change-Id: If33fb9d046ea7d54af16a14a77c76c2e173c0a63
Reviewed-on: https://gerrit.libreoffice.org/59499
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index b2e8bb190578..7b50f7f4cd09 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5255,8 +5255,8 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM 
wParam, LRESULT & nRet)
 uno::Reference< accessibility::XMSAAService > xMSAA( 
pSVData->mxAccessBridge, uno::UNO_QUERY );
 if ( xMSAA.is() )
 {
-sal_Int32 lParam32 = (sal_Int32)lParam;
-sal_uInt32 wParam32 = (sal_uInt32)wParam;
+sal_Int32 lParam32 = static_cast(lParam);
+sal_uInt32 wParam32 = static_cast(wParam);
 
 // mhOnSetTitleWnd not set to reasonable value anywhere...
 if ( lParam32 == OBJID_CLIENT )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-21 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 99fc650d519f78e3866ce119c7d3640a070e88c5
Author: Caolán McNamara 
AuthorDate: Tue Aug 21 09:05:05 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 21 21:35:33 2018 +0200

pass GetFontFace at call site

Change-Id: Id2677cdc386e51ae1549c548c06d095ad0f43b40
Reviewed-on: https://gerrit.libreoffice.org/59385
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 c4970b0ce9b4..a51a06a0d4c4 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -765,9 +765,6 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
LOGFONTW& rLogFont )
 {
 OUString aName;
-if (!pFontFace && pFont->mpFontInstance)
-pFontFace = pFont->mpFontInstance->GetFontFace();
-
 if (pFontFace)
 aName = pFontFace->GetFamilyName();
 else
@@ -942,7 +939,7 @@ void WinSalGraphics::SetFont(LogicalFontInstance* pFont, 
int nFallbackLevel)
 mpWinFontEntry[ nFallbackLevel ] = 
reinterpret_cast(pFont);
 
 HFONT hOldFont = nullptr;
-HFONT hNewFont = ImplDoSetFont(pFont->GetFontSelectPattern(), nullptr, 
mfFontScale[ nFallbackLevel ], hOldFont);
+HFONT hNewFont = ImplDoSetFont(pFont->GetFontSelectPattern(), 
pFont->GetFontFace(), mfFontScale[ nFallbackLevel ], hOldFont);
 mfCurrentFontScale = mfFontScale[nFallbackLevel];
 
 if( !mhDefFont )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-21 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 3a6f510c3e3bc269b2816cd6cca57f81eb7c4ae3
Author: Caolán McNamara 
AuthorDate: Tue Aug 21 15:29:04 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 21 21:27:43 2018 +0200

use ImplDoSetFont instead of SetFont

i.e. the same pattern as CreateFontSubset and GetGlyphWidths

Change-Id: Ie90d7279c4debe47b4d2739e12cdae86f4e70517
Reviewed-on: https://gerrit.libreoffice.org/59403
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 7ea455715136..c471c0c3be1f 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1777,7 +1777,10 @@ const void* WinSalGraphics::GetEmbedFontData(const 
PhysicalFontFace* pFont, long
 FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false );
 
 ScopedFont aOldFont(*this);
-SetFont( , 0 );
+
+float fScale = 0.0;
+HFONT hOldFont = nullptr;
+ImplDoSetFont(, pFont, fScale, hOldFont);
 
 // get the raw font file data
 RawFontData aRawFontData( getHDC() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-21 Thread Libreoffice Gerrit user
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a83dee1310c6fd7f7e2b62b3b2640d97a8d0270e
Author: Caolán McNamara 
AuthorDate: Tue Aug 21 08:50:02 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 21 14:25:17 2018 +0200

only need FontSelectPatternAttributes here

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

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 3800fcd9adc3..3411b54c8652 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -325,7 +325,7 @@ WinFontInstance::~WinFontInstance()
 
 bool WinFontInstance::hasHScale() const
 {
-const FontSelectPattern  = GetFontSelectPattern();
+const FontSelectPatternAttributes  = GetFontSelectPattern();
 int nHeight(rPattern.mnHeight);
 int nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() : 
nHeight);
 return nWidth != nHeight;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-20 Thread Libreoffice Gerrit user
 vcl/win/window/salframe.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 200fafc341c9ac5cedb0e3e8a38fcc4e88fce77c
Author: Ilhan Yesil 
AuthorDate: Mon Jul 30 11:56:22 2018 +0200
Commit: Andras Timar 
CommitDate: Mon Aug 20 19:58:31 2018 +0200

tdf#118994 JAWS has no access to accessibility objects

According to the MSDN, lParam must be cast to DWORD when examining
WM_GETOBJECT messages on 64-bit Windows. The MSDN example also
casts wParam, so in this solution, lParam and wParam are cast to
the appropriate types sal_Int32 and sal_uInt32.

Change-Id: I1edc00778c7da91d2baf5784e4c3f8c441e42eab
Reviewed-on: https://gerrit.libreoffice.org/58312
Tested-by: Jenkins
Reviewed-by: Michael Meeks 
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 334b518cb340..6fcb54638628 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5255,12 +5255,15 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM 
wParam, LRESULT & nRet)
 uno::Reference< accessibility::XMSAAService > xMSAA( 
pSVData->mxAccessBridge, uno::UNO_QUERY );
 if ( xMSAA.is() )
 {
+sal_Int32 lParam32 = (sal_Int32)lParam;
+sal_uInt32 wParam32 = (sal_uInt32)wParam;
+
 // mhOnSetTitleWnd not set to reasonable value anywhere...
-if ( lParam == OBJID_CLIENT )
+if ( lParam32 == OBJID_CLIENT )
 {
 nRet = xMSAA->getAccObjectPtr(
-reinterpret_cast(hWnd), lParam, wParam);
-if( nRet != 0 )
+reinterpret_cast(hWnd), lParam32, wParam32);
+if (nRet != 0)
 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

2018-07-25 Thread Libreoffice Gerrit user
 vcl/win/gdi/DWriteTextRenderer.cxx |4 ++--
 vcl/win/gdi/winlayout.cxx  |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9779ba452b523d45805a3d2a18f68194005ef977
Author: Stephan Bergmann 
AuthorDate: Wed Jul 25 19:03:51 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 25 22:46:18 2018 +0200

-Wc++11-narrowing (clang-cl)

...from 'int' to 'FLOAT' (aka 'float')

Change-Id: I999fc322d0ace0d32c675a22337077d7a95eed3c
Reviewed-on: https://gerrit.libreoffice.org/58006
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 27f24a9332d6..ffca720f3e6b 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -296,9 +296,9 @@ bool 
D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
 while (rLayout.GetNextGlyph(, aPos, nStart))
 {
 UINT16 glyphIndices[] = { pGlyph->maGlyphId };
-FLOAT glyphAdvances[] = { pGlyph->mnNewWidth };
+FLOAT glyphAdvances[] = { static_cast(pGlyph->mnNewWidth) };
 DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
-D2D1_POINT_2F baseline = { aPos.X() - bounds.Left(), aPos.Y() - 
bounds.Top() };
+D2D1_POINT_2F baseline = { static_cast(aPos.X() - 
bounds.Left()), static_cast(aPos.Y() - bounds.Top()) };
 DWRITE_GLYPH_RUN glyphs = {
 mpFontFace,
 mlfEmHeight,
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index fa0c2b683387..1295d5bf1d4b 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -163,8 +163,8 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT 
hFont, int nGlyphIndex, S
 }
 
 D2D1_POINT_2F baseline = {
-aElement.getExtraOffset(),
-aElement.getExtraOffset() + aElement.mnBaselineOffset
+static_cast(aElement.getExtraOffset()),
+static_cast(aElement.getExtraOffset() + 
aElement.mnBaselineOffset)
 };
 
 DWRITE_GLYPH_RUN glyphs = {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-25 Thread Libreoffice Gerrit user
 vcl/win/gdi/salfont.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 6639ab3922a8f88a0421d25f82ed50a99f40f341
Author: Stephan Bergmann 
AuthorDate: Wed Jul 25 19:02:02 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 25 22:45:37 2018 +0200

loplugin:sallogareas (clang-cl)

Change-Id: Id3f41fe72487a1e38ead75c8df6307edd1c3ccab
Reviewed-on: https://gerrit.libreoffice.org/58005
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 40effb6844f2..03c428fc72a3 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1067,7 +1067,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 {
 if ((nFontType & RASTER_FONTTYPE) && !(nFontType & 
DEVICE_FONTTYPE))
 {
-SAL_WARN("vcl.gdi.font", "Unsupported printer font ignored: " 
<< OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
+SAL_WARN("vcl.fonts", "Unsupported printer font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
 return 1;
 }
 }
@@ -1076,7 +1076,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
  !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
  !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
 {
-SAL_WARN("vcl.gdi.font", "Unsupported font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
+SAL_WARN("vcl.fonts", "Unsupported font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
 return 1;
 }
 
@@ -1084,7 +1084,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
 
 pInfo->mpList->Add( pData.get() );
-SAL_WARN("vcl.gdi.font", "SalEnumFontsProcExW: font added: " << 
pData->GetFamilyName() << " " << pData->GetStyleName());
+SAL_WARN("vcl.fonts", "SalEnumFontsProcExW: font added: " << 
pData->GetFamilyName() << " " << pData->GetStyleName());
 }
 
 return 1;
@@ -1251,7 +1251,7 @@ static bool ImplGetFontAttrFromFile( const OUString& 
rFontFileURL,
 bool WinSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
 const OUString& rFontFileURL, const OUString& rFontName )
 {
-SAL_WARN( "vcl.gdi.font", "WinSalGraphics::AddTempDevFont(): " << 
rFontFileURL );
+SAL_WARN( "vcl.fonts", "WinSalGraphics::AddTempDevFont(): " << 
rFontFileURL );
 
 FontAttributes aDFA;
 aDFA.SetFamilyName(rFontName);
@@ -1295,7 +1295,7 @@ bool WinSalGraphics::AddTempDevFont( 
PhysicalFontCollection* pFontCollection,
 
 void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
 {
-SAL_WARN( "vcl.gdi.font", "WinSalGraphics::GetDevFontList(): enter" );
+SAL_WARN( "vcl.fonts", "WinSalGraphics::GetDevFontList(): enter" );
 
 // make sure all fonts are registered at least temporarily
 static bool bOnce = true;
@@ -1347,7 +1347,7 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 pFontCollection->SetFallbackHook(  );
 pFontCollection->SetPreMatchHook();
 
-SAL_WARN( "vcl.gdi.font", "WinSalGraphics::GetDevFontList(): leave" );
+SAL_WARN( "vcl.fonts", "WinSalGraphics::GetDevFontList(): leave" );
 }
 
 void WinSalGraphics::ClearDevFontCache()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-09 Thread Jan-Marek Glogowski
 vcl/win/gdi/salfont.cxx |   23 +++
 1 file changed, 3 insertions(+), 20 deletions(-)

New commits:
commit b22244a2eb8d558499d2ffdb2cca5ddb44f3
Author: Jan-Marek Glogowski 
Date:   Mon Jul 9 18:18:14 2018 +0200

WIN GetFontMetric doesn't matter for GetEmbedFontData

so there should always be a valid mpWinFontEntry[nFallbackLevel].

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 5cf7f4354480..e90b25363cd6 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -978,11 +978,8 @@ void WinSalGraphics::SetFont( const FontSelectPattern* 
pFont, int nFallbackLevel
 void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int 
nFallbackLevel )
 {
 // temporarily change the HDC to the font in the fallback level
-const HFONT hFallbackFont = mhFonts[nFallbackLevel] ? 
mhFonts[nFallbackLevel]
-: 
mpWinFontEntry[nFallbackLevel]->GetHFONT();
-assert((mhFonts[nFallbackLevel] && !mpWinFontEntry[nFallbackLevel]) ||
-   (!mhFonts[nFallbackLevel] && mpWinFontEntry[nFallbackLevel]));
-const HFONT hOldFont = SelectFont(getHDC(), hFallbackFont);
+assert(!mhFonts[nFallbackLevel] && mpWinFontEntry[nFallbackLevel]);
+const HFONT hOldFont = SelectFont(getHDC(), 
mpWinFontEntry[nFallbackLevel]->GetHFONT());
 
 wchar_t aFaceName[LF_FACESIZE+60];
 if( GetTextFaceW( getHDC(), SAL_N_ELEMENTS(aFaceName), aFaceName ) )
@@ -993,21 +990,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& 
rxFontMetric, int nFa
 const RawFontData aHheaRawData(getHDC(), nHheaTag);
 const RawFontData aOS2RawData(getHDC(), nOS2Tag);
 
-if (mpWinFontEntry[nFallbackLevel])
-
rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth());
-else
-{
-// Calculate Kashida width without mpWinFontEntry for embedded fonts
-WCHAR nKashidaCh = 0x0640;
-WORD nKashidaGid;
-DWORD ret = GetGlyphIndicesW(getHDC(), , 1, , 
GGI_MARK_NONEXISTING_GLYPHS);
-if (ret != GDI_ERROR && nKashidaGid != 0x)
-{
-int nKashidaWidth = 0;
-if (GetCharWidthI(getHDC(), nKashidaGid, 1, nullptr, 
))
-
rxFontMetric->SetMinKashida(static_cast(mfFontScale[nFallbackLevel] * 
nKashidaWidth));
-}
-}
+
rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth());
 
 // get the font metric
 OUTLINETEXTMETRICW aOutlineMetric;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-05 Thread Michael Stahl
 vcl/win/gdi/salfont.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 656bef6ce3626769bd59fc7c46d781af512dfe0e
Author: Michael Stahl 
Date:   Tue Jul 3 18:48:30 2018 +0200

vcl: experiment for font related test fails on WNT

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 77fc91b8b2a4..2796f8686255 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1060,7 +1060,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 {
 if ((nFontType & RASTER_FONTTYPE) && !(nFontType & 
DEVICE_FONTTYPE))
 {
-SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
+SAL_WARN("vcl.gdi.font", "Unsupported printer font ignored: " 
<< OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
 return 1;
 }
 }
@@ -1069,7 +1069,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
  !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
  !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
 {
-SAL_INFO("vcl.gdi", "Unsupported font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
+SAL_WARN("vcl.gdi.font", "Unsupported font ignored: " << 
OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
 return 1;
 }
 
@@ -1077,6 +1077,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
 pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
 
 pInfo->mpList->Add( pData.get() );
+SAL_WARN("vcl.gdi.font", "SalEnumFontsProcExW: font added: " << 
pData->GetFamilyName() << " " << pData->GetStyleName());
 }
 
 return 1;
@@ -1243,7 +1244,7 @@ static bool ImplGetFontAttrFromFile( const OUString& 
rFontFileURL,
 bool WinSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
 const OUString& rFontFileURL, const OUString& rFontName )
 {
-SAL_INFO( "vcl.gdi", "WinSalGraphics::AddTempDevFont(): " << rFontFileURL 
);
+SAL_WARN( "vcl.gdi.font", "WinSalGraphics::AddTempDevFont(): " << 
rFontFileURL );
 
 FontAttributes aDFA;
 aDFA.SetFamilyName(rFontName);
@@ -1287,6 +1288,8 @@ bool WinSalGraphics::AddTempDevFont( 
PhysicalFontCollection* pFontCollection,
 
 void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
 {
+SAL_WARN( "vcl.gdi.font", "WinSalGraphics::GetDevFontList(): enter" );
+
 // make sure all fonts are registered at least temporarily
 static bool bOnce = true;
 if( bOnce )
@@ -1336,6 +1339,8 @@ void WinSalGraphics::GetDevFontList( 
PhysicalFontCollection* pFontCollection )
 static WinPreMatchFontSubstititution aPreMatchFont;
 pFontCollection->SetFallbackHook(  );
 pFontCollection->SetPreMatchHook();
+
+SAL_WARN( "vcl.gdi.font", "WinSalGraphics::GetDevFontList(): leave" );
 }
 
 void WinSalGraphics::ClearDevFontCache()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-21 Thread Khaled Hosny
 vcl/win/gdi/winlayout.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 6a54247c7dfc31aa53e6db7122e31e5498715184
Author: Khaled Hosny 
Date:   Sat May 19 18:31:41 2018 +0200

Partially revert "Fixup 23c5125148a8110d88385b29570bf0b7d4400458"

This reverts most of commit e8d48dd75a1bb31b5bc500bc79fb80384a09bcc6.

Hopefully it will make the Win@42 tinderbox happy again.

Change-Id: Ie5ef2c16a62e774dcd1f6005df3d86e1973dea2d
Reviewed-on: https://gerrit.libreoffice.org/54567
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 656681a46a8a..95034c97372b 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -342,7 +342,7 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, 
hb_tag_t nTableTag, void* pU
 hb_font_t* WinFontInstance::ImplInitHbFont()
 {
 assert(m_hDC);
-assert(m_hFont);
+m_hFont = static_cast(GetCurrentObject(m_hDC, OBJ_FONT));
 hb_font_t* pHbFont = InitHbFont(hb_face_create_for_tables(getFontTable, 
m_hFont, nullptr));
 
 // Calculate the AverageWidthFactor, see LogicalFontInstance::GetScale().
@@ -378,7 +378,6 @@ void WinFontInstance::SetHDC(const HDC hDC)
 return;
 ReleaseHbFont();
 m_hDC = hDC;
-m_hFont = static_cast(GetCurrentObject(m_hDC, OBJ_FONT));
 }
 
 bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-14 Thread Miklos Vajna
 vcl/win/gdi/salnativewidgets-luna.cxx |   51 +-
 1 file changed, 38 insertions(+), 13 deletions(-)

New commits:
commit b160db926b574b7e9d6696d49dbbce8dd289aade
Author: Miklos Vajna 
Date:   Mon May 14 09:34:52 2018 +0200

tdf#96947 vcl opengl win: fix background of menu items w/ check/radio marks

Extract the actually used bounding box from the rendering code and reuse
that for OpenGL texture purposes, so the available and the used size
can't mismatch.

The background itself is almost invisible, but the borders were lost due
to this size difference.

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

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index e7f9ab232c42..e295264a9890 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -498,6 +498,31 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 }
 }
 
+/**
+ * Gives the actual rectangle used for rendering by ControlType::MenuPopup's
+ * ControlPart::MenuItemCheckMark or ControlPart::MenuItemRadioMark.
+ */
+static tools::Rectangle GetMenuPopupMarkRegion(const ImplControlValue& rValue)
+{
+tools::Rectangle aRet;
+
+const MenupopupValue& rMVal(static_cast(rValue));
+aRet.SetTop(rMVal.maItemRect.Top());
+aRet.SetBottom(rMVal.maItemRect.Bottom() + 1); // see below in 
drawNativeControl
+if (AllSettings::GetLayoutRTL())
+{
+aRet.SetRight(rMVal.maItemRect.Right() + 1);
+aRet.SetLeft(aRet.Right() - (rMVal.getNumericVal() - 
rMVal.maItemRect.Left()));
+}
+else
+{
+aRet.SetRight(rMVal.getNumericVal());
+aRet.SetLeft(rMVal.maItemRect.Left());
+}
+
+return aRet;
+}
+
 bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
 ControlType nType,
 ControlPart nPart,
@@ -1088,19 +1113,11 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 RECT aBGRect = rc;
 if( aValue.getType() == ControlType::MenuPopup )
 {
-const MenupopupValue& rMVal( static_cast(aValue) );
-aBGRect.top= rMVal.maItemRect.Top();
-aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see 
below in drawNativeControl
-if( AllSettings::GetLayoutRTL() )
-{
-aBGRect.right = rMVal.maItemRect.Right()+1;
-aBGRect.left = aBGRect.right - 
(rMVal.getNumericVal()-rMVal.maItemRect.Left());
-}
-else
-{
-aBGRect.right = rMVal.getNumericVal();
-aBGRect.left  = rMVal.maItemRect.Left();
-}
+tools::Rectangle aRectangle = 
GetMenuPopupMarkRegion(aValue);
+aBGRect.top = aRectangle.Top();
+aBGRect.left = aRectangle.Left();
+aBGRect.bottom = aRectangle.Bottom();
+aBGRect.right = aRectangle.Right();
 rc = aBGRect;
 }
 iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : 
MCB_DISABLED;
@@ -1164,6 +1181,14 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 }
 }
 
+if (pImpl && nType == ControlType::MenuPopup && (nPart == 
ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark))
+{
+cacheRect = GetMenuPopupMarkRegion(aValue);
+buttonRect = cacheRect;
+keySize = cacheRect.GetSize();
+}
+
+
 ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize);
 if (pImpl != nullptr && 
pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), 
buttonRect.Top()))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-12 Thread Khaled Hosny
 vcl/win/gdi/salfont.cxx   |1 +
 vcl/win/gdi/winlayout.cxx |3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e8d48dd75a1bb31b5bc500bc79fb80384a09bcc6
Author: Khaled Hosny 
Date:   Sat May 12 15:11:10 2018 +0200

Fixup 23c5125148a8110d88385b29570bf0b7d4400458

It was asserting for me at startup on Windows.

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index e1c26ed902a2..2d6512154e2a 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -997,6 +997,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& 
rxFontMetric, int nFa
 const RawFontData aHheaRawData(getHDC(), nHheaTag);
 const RawFontData aOS2RawData(getHDC(), nOS2Tag);
 
+mpWinFontEntry[nFallbackLevel]->SetHDC(getHDC());
 
rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth());
 
 // get the font metric
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 95034c97372b..656681a46a8a 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -342,7 +342,7 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, 
hb_tag_t nTableTag, void* pU
 hb_font_t* WinFontInstance::ImplInitHbFont()
 {
 assert(m_hDC);
-m_hFont = static_cast(GetCurrentObject(m_hDC, OBJ_FONT));
+assert(m_hFont);
 hb_font_t* pHbFont = InitHbFont(hb_face_create_for_tables(getFontTable, 
m_hFont, nullptr));
 
 // Calculate the AverageWidthFactor, see LogicalFontInstance::GetScale().
@@ -378,6 +378,7 @@ void WinFontInstance::SetHDC(const HDC hDC)
 return;
 ReleaseHbFont();
 m_hDC = hDC;
+m_hFont = static_cast(GetCurrentObject(m_hDC, OBJ_FONT));
 }
 
 bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-20 Thread Stephan Bergmann
 vcl/win/gdi/salfont.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit cbf5ec321baed1a95ddfdb385fdc5f52a5d13e61
Author: Stephan Bergmann 
Date:   Fri Apr 20 08:51:50 2018 +0200

loplugin:cstylecast (clang-cl)

Change-Id: Ica7c080e08d74443687069df42216e0f0c4f2153

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index f9b9418ccb75..f6deaaf6b1e8 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -863,13 +863,13 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern 
const * i_pFont, float& o_
 }
 else if( -aLogFont.lfHeight >= +aLogFont.lfWidth )
 {
-o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT;
+o_rFontScale = -aLogFont.lfHeight / float(MAXFONTHEIGHT);
 aLogFont.lfHeight = -MAXFONTHEIGHT;
 aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale );
 }
 else // #i95867# also limit font widths
 {
-o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT;
+o_rFontScale = +aLogFont.lfWidth / float(MAXFONTHEIGHT);
 aLogFont.lfWidth = +MAXFONTHEIGHT;
 aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-18 Thread Michael Stahl
 vcl/win/app/salinst.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit b07e8a7e16ba69e822a309ec280d1987f90021a3
Author: Michael Stahl 
Date:   Wed Apr 18 13:01:37 2018 +0200

vcl: WNT: *really* avoid calling SHAddToRecentDocs() from unit tests

At least in sw unit tests, AddToRecentDocumentList is apparently called
too early so the variable isn't set yet.

It's much better to check IsHeadlessMode anyway because that is set in
more situations, and if you run soffice --headless you probably don't
want the corresponding files to show up in Explorer's Recently list.

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

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 340e0ed01b77..a33b7e1bd683 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -921,8 +921,7 @@ OUString WinSalInstance::GetConnectionIdentifier()
 */
 void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const 
OUString& /*rMimeType*/, const OUString& rDocumentService)
 {
-static bool const s_isTest(getenv("LO_TESTNAME") != nullptr);
-if (s_isTest)
+if (Application::IsHeadlessModeEnabled())
 return;
 
 OUString system_path;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-18 Thread Michael Stahl
 vcl/win/app/salinst.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 94c264859f621e8e7c793fad2beb6528659433bf
Author: Michael Stahl 
Date:   Tue Apr 17 18:41:39 2018 +0200

vcl: WNT: avoid calling SHAddToRecentDocs() from unit tests

On Windows 10, Explorer spends ridiculous amounts of CPU with updating
its recent documents view while tests are running.

Change-Id: I170306a392900fc4b911950e36f13f1af0e405ac
Reviewed-on: https://gerrit.libreoffice.org/53058
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 125d375096a9..340e0ed01b77 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -921,6 +921,10 @@ OUString WinSalInstance::GetConnectionIdentifier()
 */
 void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const 
OUString& /*rMimeType*/, const OUString& rDocumentService)
 {
+static bool const s_isTest(getenv("LO_TESTNAME") != nullptr);
+if (s_isTest)
+return;
+
 OUString system_path;
 osl::FileBase::RC rc = osl::FileBase::getSystemPathFromFileURL(rFileUrl, 
system_path);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-29 Thread Mike Kaganski
 vcl/win/window/salframe.cxx |  383 +---
 1 file changed, 191 insertions(+), 192 deletions(-)

New commits:
commit ed316832e9e9028444cbb587ce644d7acaacf1e7
Author: Mike Kaganski 
Date:   Thu Mar 29 14:56:26 2018 +0100

Use true/false, not TRUE/FALSE

Change-Id: I257f2799c507a6669ad7048db72fbe374f40de11
Reviewed-on: https://gerrit.libreoffice.org/52076
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 7d22f95260f3..79cd1087eb27 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -116,7 +116,7 @@ using namespace ::com::sun::star::beans;
 
 const unsigned int WM_USER_SYSTEM_WINDOW_ACTIVATED = 
RegisterWindowMessageW(L"SYSTEM_WINDOW_ACTIVATED");
 
-bool WinSalFrame::mbInReparent = FALSE;
+bool WinSalFrame::mbInReparent = false;
 
 // Macros for support of WM_UNICHAR & Keyman 6.0
 //#define Uni_UTF32ToSurrogate1(ch)   (((unsigned long) (ch) - 0x1) / 
0x400 + 0xD800)
@@ -144,7 +144,7 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
 pFrame->maState.mnState |= WindowStateState::Maximized;
 if ( bVisible )
 pFrame->mnShowState = SW_SHOWMAXIMIZED;
-pFrame->mbRestoreMaximize = TRUE;
+pFrame->mbRestoreMaximize = true;
 
 WINDOWPLACEMENT aPlacement;
 aPlacement.length = sizeof(aPlacement);
@@ -187,7 +187,7 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
 pFrame->maState.mnHeight = 
aRect.bottom-aRect.top-nTopDeco-nBottomDeco;
 if ( bVisible )
 pFrame->mnShowState = SW_SHOWNORMAL;
-pFrame->mbRestoreMaximize = FALSE;
+pFrame->mbRestoreMaximize = false;
 }
 }
 }
@@ -282,7 +282,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 HWNDhWnd;
 DWORD   nSysStyle = 0;
 DWORD   nExSysStyle = 0;
-boolbSubFrame = FALSE;
+boolbSubFrame = false;
 
 static const char* pEnvSynchronize = getenv("SAL_SYNCHRONIZE");
 if ( pEnvSynchronize )   // no buffering of drawing commands
@@ -308,8 +308,8 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 if ( hWndParent )
 {
 nSysStyle |= WS_POPUP;
-bSubFrame = TRUE;
-pFrame->mbNoIcon = TRUE;
+bSubFrame = true;
+pFrame->mbNoIcon = true;
 }
 else
 {
@@ -327,7 +327,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 
 if ( nSalFrameStyle & SalFrameStyleFlags::MOVEABLE )
 {
-pFrame->mbCaption = TRUE;
+pFrame->mbCaption = true;
 nSysStyle |= WS_SYSMENU | WS_CAPTION;
 if ( !hWndParent )
 nSysStyle |= WS_SYSMENU | WS_MINIMIZEBOX;
@@ -336,13 +336,13 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 
 if ( nSalFrameStyle & SalFrameStyleFlags::SIZEABLE )
 {
-pFrame->mbSizeBorder = TRUE;
+pFrame->mbSizeBorder = true;
 nSysStyle |= WS_THICKFRAME;
 if ( !hWndParent )
 nSysStyle |= WS_MAXIMIZEBOX;
 }
 else
-pFrame->mbFixBorder = TRUE;
+pFrame->mbFixBorder = true;
 
 if ( nSalFrameStyle & SalFrameStyleFlags::DEFAULT )
 nExSysStyle |= WS_EX_APPWINDOW;
@@ -356,7 +356,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 // #103578# looked too bad - above changes reverted
 /* && !(nSalFrameStyle & SalFrameStyleFlags::SIZEABLE) */ )
 {
-pFrame->mbNoIcon = TRUE;
+pFrame->mbNoIcon = true;
 nExSysStyle |= WS_EX_TOOLWINDOW;
 if ( pEnvTransparentFloats /*&& !(nSalFrameStyle & 
SalFrameStyleFlags::MOVEABLE) */)
 nExSysStyle |= WS_EX_LAYERED;
@@ -365,7 +365,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 if ( nSalFrameStyle & SalFrameStyleFlags::FLOAT )
 {
 nExSysStyle |= WS_EX_TOOLWINDOW;
-pFrame->mbFloatWin = TRUE;
+pFrame->mbFloatWin = true;
 
 if (pEnvTransparentFloats)
 nExSysStyle |= WS_EX_LAYERED;
@@ -395,11 +395,11 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
 {
 if ( (pFrame->mnShowState == SW_SHOWMAXIMIZED) ||
  (pFrame->mnShowState == SW_MAXIMIZE) )
-pFrame->mbOverwriteState = FALSE;
+pFrame->mbOverwriteState = false;
 pFrame->mnShowState = SW_SHOWMAXIMIZED;
 }
 else
-pFrame->mbOverwriteState = FALSE;
+pFrame->mbOverwriteState = false;
 }
 else
   

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

2018-03-27 Thread Mike Kaganski
 vcl/win/window/salframe.cxx |   26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

New commits:
commit fec7dc8d4b82cc9a60d8625f313ba12d926665b5
Author: Mike Kaganski 
Date:   Tue Mar 27 09:19:57 2018 +0100

tdf#93120: Avoid redraws when mouse enters tooltips (Win)

Change-Id: I3870f4fad0662d9f4b027ec307370291740b1d52
Reviewed-on: https://gerrit.libreoffice.org/51930
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 57ac8512daf7..7d22f95260f3 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -64,6 +64,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -3042,17 +3043,32 @@ static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
 SalData* pSalData = GetSalData();
 if ( pSalData->mhWantLeaveMsg == hWnd )
 {
+// Mouse-Coordinates are relative to the screen
+POINT aPt;
+aPt.x = static_cast(LOWORD(lParam));
+aPt.y = static_cast(HIWORD(lParam));
+ScreenToClient(hWnd, );
+if (const auto& pHelpWin = 
ImplGetSVData()->maHelpData.mpHelpWin)
+{
+const tools::Rectangle& rHelpRect = 
pHelpWin->GetHelpArea();
+if (rHelpRect.IsInside(Point(aPt.x, aPt.y)))
+{
+// We have entered a tooltip (help window). Don't call 
the handler here; it
+// would launch the sequence "Mouse leaves the 
Control->Control redraws->
+// Help window gets destroyed->Mouse enters the 
Control->Control redraws",
+// which takes CPU and may flicker. Just destroy the 
help window and pretend
+// we are still over the original window.
+ImplDestroyHelpWindow(true);
+bCall = false;
+break;
+}
+}
 pSalData->mhWantLeaveMsg = nullptr;
 if ( pSalData->mpMouseLeaveTimer )
 {
 delete pSalData->mpMouseLeaveTimer;
 pSalData->mpMouseLeaveTimer = nullptr;
 }
-// Mouse-Coordinates are relative to the screen
-POINT aPt;
-aPt.x = static_cast(LOWORD( lParam ));
-aPt.y = static_cast(HIWORD( lParam ));
-ScreenToClient( hWnd,  );
 aMouseEvt.mnX = aPt.x;
 aMouseEvt.mnY = aPt.y;
 aMouseEvt.mnButton = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-12 Thread Mike Kaganski
 vcl/win/gdi/salprn.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 43bf50d5ced4b878f747075f8c0f1b32991c290e
Author: Mike Kaganski 
Date:   Sat Mar 10 18:46:07 2018 +0100

tdf#115649: ensure we own SolarMutex in the callback

The crash is caused by releasing SolarMutex we don't own; the release 
happens
in Application::Reschedule() inside SalPrintAbortProc.

The crashing callstack:

ucrtbase.dll!abort()
mergedlo.dll!comphelper::GenericSolarMutex::doRelease(bool bUnlockAll) Line 
72
mergedlo.dll!SalYieldMutex::doRelease(bool bUnlockAll) Line 177
[Inline Frame] mergedlo.dll!SolarMutexReleaser::{ctor}() Line 1473
mergedlo.dll!WinSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents) Line 550
mergedlo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 469
mergedlo.dll!SalPrintAbortProc(HDC__ * hPrnDC, int __formal) Line 1308
gdi32full.dll!vSAPCallback()
gdi32full.dll!ExtEscapeImpl()
gdi32.dll!ExtEscape()
[Frames may be missing, no binary loaded for KMUU727V.DLL]
KMUU727V.DLL!11d0dc21()

Change-Id: I955eab7894186900d0d99e28f62d87cc645e4a5a
Reviewed-on: https://gerrit.libreoffice.org/51052
Tested-by: Jenkins 
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 7ba4ff25e418..37b72ebfadcd 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1297,6 +1297,8 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* 
nError */ )
 WinSalPrinter* pPrinter;
 boolbWhile = true;
 
+// Ensure we handle the mutex which will be released in 
WinSalInstance::DoYield
+SolarMutexGuard aSolarMutexGuard;
 do
 {
 // process messages
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-09 Thread Stephan Bergmann
 vcl/win/window/salframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 70a768e2b66cdb0f7a68a47cd9a6be16f317eeeb
Author: Stephan Bergmann 
Date:   Fri Mar 9 17:16:36 2018 +0100

loplugin:nullptr (clang-cl)

Change-Id: I239a6024131a0e659d1723085af3cb7fb64b17cc
Reviewed-on: https://gerrit.libreoffice.org/51013
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 75784736c4e8..b7e8472a0934 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1028,7 +1028,7 @@ SalGraphics* WinSalFrame::AcquireGraphics()
 
 SalData* pSalData = GetSalData();
 WinSalGraphics *pGraphics = nullptr;
-HDC hDC = 0;
+HDC hDC = nullptr;
 
 // Other threads get an own DC, because Windows modify in the
 // other case our DC (changing clip region), when they send a
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-05 Thread Mark Hung
 vcl/win/gdi/salfont.cxx   |3 +++
 vcl/win/gdi/winlayout.cxx |   15 +++
 2 files changed, 18 insertions(+)

New commits:
commit 2392238e480ecc1d1a5e2e69789e79c10f142d6c
Author: Mark Hung 
Date:   Thu Nov 30 19:42:08 2017 +0800

tdf#108302: keep the font unrotated if @font isn't available.

We will create the font in ExTextOutRenderer for glyphs that
are expected to be sideway in vertical writing, so we can reset
the font escapement and orientation if @font ( windows notation
of fonts for CJK vertical writing. ) isn't available. That will
keep the font consistent with @fonts for those glyphs expected
to be upright in vertical writing.
Note that it is necessary to change text alignment of DC when
such font is used.

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

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 20bcce07d47e..9796ab928f3b 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -826,6 +826,9 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
 memcpy( [0], aName.getStr(), 
nNameLen*sizeof(wchar_t) );
 if( nNameLen < LF_FACESIZE )
 rLogFont.lfFaceName[nNameLen] = '\0';
+// keep it upright and create the font for sideway glyphs later.
+rLogFont.lfEscapement = rLogFont.lfEscapement - 2700;
+rLogFont.lfOrientation = rLogFont.lfEscapement;
 }
 }
 }
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index d6b9cd4b57c4..409b0b447986 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -250,6 +250,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 HFONT hFont = static_cast(GetCurrentObject( hDC, OBJ_FONT ));
 HFONT hAltFont = nullptr;
 bool bUseAltFont = false;
+bool bShift = false;
 if (rLayout.getFontSelData().mbVertical)
 {
 LOGFONTW aLogFont;
@@ -260,8 +261,16 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 sizeof(aLogFont.lfFaceName)-sizeof(aLogFont.lfFaceName[0]));
 hAltFont = CreateFontIndirectW();
 }
+else
+{
+bShift = true;
+aLogFont.lfEscapement += 2700;
+aLogFont.lfOrientation = aLogFont.lfEscapement;
+hAltFont = CreateFontIndirectW();
+}
 }
 
+UINT nTextAlign = GetTextAlign ( hDC );
 int nStart = 0;
 Point aPos(0, 0);
 const GlyphItem* pGlyph;
@@ -273,7 +282,13 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 bUseAltFont = !bUseAltFont;
 SelectFont(hDC, bUseAltFont ? hAltFont : hFont);
 }
+if (bShift && pGlyph->IsVertical())
+SetTextAlign(hDC, TA_TOP|TA_LEFT);
+
 ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(), 1, nullptr);
+
+if (bShift && pGlyph->IsVertical())
+SetTextAlign(hDC, nTextAlign);
 }
 if (hAltFont)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-17 Thread Manfred Blume
 vcl/win/window/salframe.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit f53b3b547b04dc112076d8323b5b24ae178d6260
Author: Manfred Blume 
Date:   Thu Nov 16 13:55:26 2017 +0100

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

This was breaking keyboard functions in other locales, by essentially
disabling use of left Ctrl-Alt as AltGr equivalent - fixes tdf#97908

This reverts commit 3ac9942c624cb627c8b09122498b45b05cf455f6

Change-Id: Ibee8cf0cb663f1995d0696afde8baea995f35f37
Reviewed-on: https://gerrit.libreoffice.org/44824
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 83c96b69c15c..0715c88f33c0 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3360,10 +3360,8 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 nModCode |= KEY_SHIFT;
 if ( GetKeyState( VK_CONTROL ) & 0x8000 )
 nModCode |= KEY_MOD1;
-if ( GetKeyState( VK_LMENU ) & 0x8000 )
+if (GetKeyState(VK_MENU) & 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) )
 {
@@ -3567,6 +3565,13 @@ static bool 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;
 bool nRet = pFrame->CallCallback( nEvent,  );
 // independent part only reacts on keyup but Windows does not 
send
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-01 Thread Mike Kaganski
 vcl/win/gdi/DWriteTextRenderer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 11459949e920fab6074bab85e3e1a748e9aee1ee
Author: Mike Kaganski 
Date:   Wed Nov 1 22:11:01 2017 +0200

Related: tdf#113347: properly check HRESULT value

HRESULT's "success" value S_OK is 0; they are failed when their values are
negative. So, the incorrect check resulted in false failures.

Change-Id: I56560ced73e335af49c66d58201d5455e555e431
Reviewed-on: https://gerrit.libreoffice.org/44180
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 95dd9e9d9b97..9819ef205aa1 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -341,7 +341,7 @@ bool D2DWriteTextOutRenderer::BindFont(HDC hDC)
 
 // Initially bind to an empty rectangle to get access to the font face,
 //  we'll update it once we've calculated a bounding rect in DrawGlyphs
-if (!BindDC(mhDC = hDC))
+if (FAILED(BindDC(mhDC = hDC)))
 return false;
 
 mlfEmHeight = 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-10-14 Thread Andrea Gelmini
 vcl/win/app/salinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 96a0adacab0c07b337b0d3ead69398a1a2a0425b
Author: Andrea Gelmini 
Date:   Sat Oct 14 11:07:24 2017 +0200

Fix typos

Change-Id: I8f689ba1a26b2380b1962a47837b943fbefbd6b6
Reviewed-on: https://gerrit.libreoffice.org/43383
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 54598a420040..d1fc8adb6272 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -508,7 +508,7 @@ bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents 
)
 while( true );
 
 // 0ms timeouts are handled out-of-bounds to prevent busy-locking the
-// event loop with timeout massages.
+// event loop with timeout messages.
 // We ensure we never handle more then one timeout per call.
 // This way we'll always process a normal system message.
 if ( !bWasTimeoutMsg && pTimer && pTimer->IsDirectTimeout() )
@@ -855,7 +855,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
aRange.nEnd, PM_NOREMOVE | PM_NOYIELD ) )
 return true;
 
-// MOUSE and PAINT already handled, so skip futher checks
+// MOUSE and PAINT already handled, so skip further checks
 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

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

New commits:
commit 62c040e5ed827f1aa451b1169095d52db46fbc1c
Author: Stephan Bergmann 
Date:   Thu Oct 5 10:15:26 2017 +0200

Blind fix for MSVC warning C4211

..."nonstandard extension used: redefined extern to static", after the 
'static'
in the friend declaration had to be removed for clang-cl with
e5d943d984bb0918f971eec45f45384cc0c72b67 "'static' is invalid in friend
declarations"

Change-Id: I14524ec0a5d8e7e12c5b506cbf7ac43508ae26ae

diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index e8d3e10d0b86..93b93fbb832f 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -26,7 +26,7 @@
 #include 
 #include 
 
-static void CALLBACK SalTimerProc(PVOID pParameter, BOOLEAN bTimerOrWaitFired);
+void CALLBACK SalTimerProc(PVOID pParameter, BOOLEAN bTimerOrWaitFired);
 
 // See 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms687003%28v=vs.85%29.aspx
 // (and related pages) for details about the Timer Queues.
@@ -122,7 +122,7 @@ void WinSalTimer::Stop()
  * This gets invoked from a Timer Queue thread.
  * Don't acquire the SolarMutex to avoid deadlocks.
  */
-static void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
+void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
 {
 __try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-05 Thread Stephan Bergmann
 vcl/win/app/saltimer.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 26537a9c1ae27faa24a760bdc91a2162a92b58d7
Author: Stephan Bergmann 
Date:   Thu Oct 5 09:42:58 2017 +0200

Missing #include  (--disable-pch)

Change-Id: I8cf1092bb2a5718b90fda8925eeb5dd281842b70

diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index c75b7534e718..e8d3e10d0b86 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -19,6 +19,8 @@
 
 #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-10-04 Thread Tor Lillqvist
 vcl/win/gdi/salfont.cxx   |2 +-
 vcl/win/gdi/winlayout.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 013044d12b61ac3b1b0b0f6e845825cac1894d94
Author: Tor Lillqvist 
Date:   Wed Oct 4 23:40:39 2017 +0300

It's called 'DirectWrite', one word

Change-Id: I4892da38182295ca474e89bb061f713039cfd8e1

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 70ad1e908152..19c6424e6dfd 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -231,7 +231,7 @@ namespace
 }
 
 // These are Win 3.1 bitmap fonts using "FON" font format
-// which is not supported with "Direct Write" so let's substitute them
+// which is not supported with DirectWrite 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
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index f7161301d72a..cb70d9268514 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -83,7 +83,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, 
int nGlyphIndex, S
 
 if (!pTxt->BindFont(aHDC.get()))
 {
-SAL_WARN("vcl.gdi", "Binding of font failed. The font might not be 
supported by Direct Write.");
+SAL_WARN("vcl.gdi", "Binding of font failed. The font might not be 
supported by DirectWrite.");
 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

2017-10-03 Thread Xisco Fauli
 vcl/win/gdi/winlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 01f674a95ddec76dc4c8ecfccdca1773657e47cb
Author: Xisco Fauli 
Date:   Thu Sep 28 12:05:13 2017 +0200

tdf#112486 Do not force GDI in no OpenGL

See:

http://nabble.documentfoundation.org/Re-Minutes-of-ESC-call-2017-09-21-tt4223238.html

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

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 3521bea0796d..f7161301d72a 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -406,7 +406,7 @@ void WinSalGraphics::DrawTextLayout(const CommonSalLayout& 
rLayout)
 if (!bUseOpenGL)
 {
 // no OpenGL, just classic rendering
-DrawTextLayout(rLayout, hDC, !bForceGDI);
+DrawTextLayout(rLayout, hDC, false);
 }
 else if (!bForceGDI && CacheGlyphs(rLayout) &&
  DrawCachedGlyphs(rLayout))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


<    1   2   3   4   >