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

2023-03-16 Thread Noel Grandin (via logerrit)
 vcl/win/dtrans/DOTransferable.cxx |2 +-
 vcl/win/dtrans/DOTransferable.hxx |3 ++-
 vcl/win/dtrans/MtaOleClipb.cxx|   12 ++--
 vcl/win/dtrans/MtaOleClipb.hxx|6 +++---
 4 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 2604dae5729018dcc0894179b032c463f941624b
Author: Noel Grandin 
AuthorDate: Thu Mar 16 11:24:20 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 16 16:21:14 2023 +

osl::Mutex->std::mutex in CDOTransferable

Change-Id: I44e9305ec4127f9567fb51ce7bf8c26f17727787
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148974
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/dtrans/DOTransferable.cxx 
b/vcl/win/dtrans/DOTransferable.cxx
index 7c5b55c02f9b..c2b54bf83a0f 100644
--- a/vcl/win/dtrans/DOTransferable.cxx
+++ b/vcl/win/dtrans/DOTransferable.cxx
@@ -236,7 +236,7 @@ Any SAL_CALL CDOTransferable::getTransferData( const 
DataFlavor& aFlavor )
 {
 OSL_ASSERT( isValidFlavor( aFlavor ) );
 
-MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 // convert dataflavor to formatetc
 
diff --git a/vcl/win/dtrans/DOTransferable.hxx 
b/vcl/win/dtrans/DOTransferable.hxx
index e42555ce6143..1824c7b44844 100644
--- a/vcl/win/dtrans/DOTransferable.hxx
+++ b/vcl/win/dtrans/DOTransferable.hxx
@@ -31,6 +31,7 @@
 
 #include 
 
+#include 
 #include 
 
 // forward
@@ -84,7 +85,7 @@ private:
 const css::uno::Reference< css::uno::XComponentContext >  
m_xContext;
 CDataFormatTranslator 
m_DataFormatTranslator;
 css::uno::Reference< css::datatransfer::XMimeContentTypeFactory > 
m_rXMimeCntFactory;
-::osl::Mutex  m_aMutex;
+std::mutexm_aMutex;
 bool  
m_bUnicodeRegistered;
 CLIPFORMAT
m_TxtFormatOnClipboard;
 
commit 45946d9465b197a20f12828815da6d9da3b2e3e7
Author: Noel Grandin 
AuthorDate: Thu Mar 16 11:22:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 16 16:21:04 2023 +

osl::Mutex->std::mutex in CMtaOleClipboard

Change-Id: If19fe618de0c316ffa6d74432b03c507b960a891
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148953
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx
index 865025057dcc..8753cf46cbae 100644
--- a/vcl/win/dtrans/MtaOleClipb.cxx
+++ b/vcl/win/dtrans/MtaOleClipb.cxx
@@ -438,7 +438,7 @@ bool CMtaOleClipboard::onRegisterClipViewer( 
LPFNC_CLIPVIEWER_CALLBACK_t pfncCli
 
 // we need exclusive access because the clipboard changed notifier
 // thread also accesses this variable
-MutexGuard aGuard( m_pfncClipViewerCallbackMutex );
+std::unique_lock aGuard( m_pfncClipViewerCallbackMutex );
 
 // register if not yet done
 if ( ( nullptr != pfncClipViewerCallback ) && ( nullptr == 
m_pfncClipViewerCallback ) )
@@ -502,7 +502,7 @@ LRESULT CMtaOleClipboard::onClipboardUpdate()
 // registering ourself as clipboard
 if ( !m_bInRegisterClipViewer )
 {
-MutexGuard aGuard( m_ClipboardChangedEventCountMutex );
+std::unique_lock aGuard( m_ClipboardChangedEventCountMutex );
 
 m_ClipboardChangedEventCount++;
 SetEvent( m_hClipboardChangedEvent );
@@ -713,7 +713,7 @@ DWORD WINAPI 
CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID p
 MsgWaitForMultipleObjects(2, pInst->m_hClipboardChangedNotifierEvents, 
false, INFINITE,
   QS_ALLINPUT | QS_ALLPOSTMESSAGE);
 
-ClearableMutexGuard aGuard2( pInst->m_ClipboardChangedEventCountMutex 
);
+std::unique_lock aGuard2( pInst->m_ClipboardChangedEventCountMutex );
 
 if ( pInst->m_ClipboardChangedEventCount > 0 )
 {
@@ -721,17 +721,17 @@ DWORD WINAPI 
CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID p
 if ( 0 == pInst->m_ClipboardChangedEventCount )
 ResetEvent( pInst->m_hClipboardChangedEvent );
 
-aGuard2.clear( );
+aGuard2.unlock( );
 
 // nobody should touch m_pfncClipViewerCallback while we do
-MutexGuard aClipViewerGuard( pInst->m_pfncClipViewerCallbackMutex 
);
+std::unique_lock aClipViewerGuard( 
pInst->m_pfncClipViewerCallbackMutex );
 
 // notify all clipboard listener
 if ( pInst->m_pfncClipViewerCallback )
 pInst->m_pfncClipViewerCallback( );
 }
 else
-aGuard2.clear( );
+aGuard2.unlock( );
 }
 
 return 0;
diff --git a/vcl/win/dtrans/MtaOleClipb.hxx b/vcl/win/dtrans/MtaOleClipb.hxx
index a76b85e3b059..c510418f4981 100644
--- a/vcl/win/dtrans/MtaOleClipb.hxx
+++ 

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

2023-03-11 Thread Noel Grandin (via logerrit)
 vcl/win/dtrans/clipboardmanager.cxx  |   85 ++-
 vcl/win/dtrans/clipboardmanager.hxx  |7 +-
 vcl/win/dtrans/generic_clipboard.cxx |   40 ++--
 vcl/win/dtrans/generic_clipboard.hxx |6 +-
 4 files changed, 55 insertions(+), 83 deletions(-)

New commits:
commit be1c0c195166bb4d4056196599d88c864b42600b
Author: Noel Grandin 
AuthorDate: Fri Mar 10 15:59:09 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Mar 12 07:00:12 2023 +

osl::Mutex->std::mutex in dtrans::GenericClipboard

Change-Id: I5a4bbb9a445ec73422bca167ca658550eac26b7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148638
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/dtrans/generic_clipboard.cxx 
b/vcl/win/dtrans/generic_clipboard.cxx
index a614a6808c37..fd822f091e7e 100644
--- a/vcl/win/dtrans/generic_clipboard.cxx
+++ b/vcl/win/dtrans/generic_clipboard.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star::datatransfer;
 using namespace com::sun::star::datatransfer::clipboard;
@@ -33,7 +34,6 @@ using namespace osl;
 using ::dtrans::GenericClipboard;
 
 GenericClipboard::GenericClipboard() :
-WeakComponentImplHelper< XClipboardEx, XClipboardNotifier, XServiceInfo, 
XInitialization > (m_aMutex),
 m_bInitialized(false)
 {
 }
@@ -72,7 +72,7 @@ Sequence< OUString > SAL_CALL 
GenericClipboard::getSupportedServiceNames()
 
 Reference< XTransferable > SAL_CALL GenericClipboard::getContents()
 {
-MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 return m_aContents;
 }
 
@@ -80,7 +80,7 @@ void SAL_CALL GenericClipboard::setContents(const Reference< 
XTransferable >& xT
   const Reference< XClipboardOwner >& 
xClipboardOwner )
 {
 // remember old values for callbacks before setting the new ones.
-ClearableMutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 
 Reference< XClipboardOwner > oldOwner(m_aOwner);
 m_aOwner = xClipboardOwner;
@@ -88,25 +88,16 @@ void SAL_CALL GenericClipboard::setContents(const 
Reference< XTransferable >& xT
 Reference< XTransferable > oldContents(m_aContents);
 m_aContents = xTrans;
 
-aGuard.clear();
+aGuard.unlock();
 
 // notify old owner on loss of ownership
 if( oldOwner.is() )
 oldOwner->lostOwnership(static_cast < XClipboard * > (this), 
oldContents);
 
 // notify all listeners on content changes
-OInterfaceContainerHelper *pContainer =
-rBHelper.aLC.getContainer(cppu::UnoType::get());
-if (pContainer)
-{
-ClipboardEvent aEvent(static_cast < XClipboard * > (this), 
m_aContents);
-OInterfaceIteratorHelper aIterator(*pContainer);
-
-while (aIterator.hasMoreElements())
-{
-
static_cast(aIterator.next())->changedContents(aEvent);
-}
-}
+aGuard.lock();
+ClipboardEvent aEvent(static_cast < XClipboard * > (this), m_aContents);
+maClipboardListeners.notifyEach(aGuard, 
::changedContents, aEvent);
 }
 
 OUString SAL_CALL GenericClipboard::getName()
@@ -121,19 +112,18 @@ sal_Int8 SAL_CALL 
GenericClipboard::getRenderingCapabilities()
 
 void SAL_CALL GenericClipboard::addClipboardListener( const Reference< 
XClipboardListener >& listener )
 {
-MutexGuard aGuard( rBHelper.rMutex );
-OSL_ENSURE( !rBHelper.bInDispose, "do not add listeners in the dispose 
call" );
-OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
-if (!rBHelper.bInDispose && !rBHelper.bDisposed)
-rBHelper.aLC.addInterface( cppu::UnoType::get(), 
listener );
+std::unique_lock aGuard( m_aMutex );
+OSL_ENSURE( !m_bDisposed, "object is disposed" );
+if (!m_bDisposed)
+maClipboardListeners.addInterface( aGuard, listener );
 }
 
 void SAL_CALL GenericClipboard::removeClipboardListener( const Reference< 
XClipboardListener >& listener )
 {
-MutexGuard aGuard( rBHelper.rMutex );
-OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
-if (!rBHelper.bInDispose && !rBHelper.bDisposed)
-rBHelper.aLC.removeInterface( 
cppu::UnoType::get(), listener );
+std::unique_lock aGuard( m_aMutex );
+OSL_ENSURE( !m_bDisposed, "object is disposed" );
+if (!m_bDisposed)
+maClipboardListeners.removeInterface( aGuard, listener );
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
diff --git a/vcl/win/dtrans/generic_clipboard.hxx 
b/vcl/win/dtrans/generic_clipboard.hxx
index 3c9126bcc535..cc1ad976b32b 100644
--- a/vcl/win/dtrans/generic_clipboard.hxx
+++ b/vcl/win/dtrans/generic_clipboard.hxx
@@ -19,7 +19,7 @@
 
 #pragma once
 
-#include 
+#include 
 
 #include 
 
@@ -31,17 +31,17 @@
 namespace dtrans
 {
 
-class GenericClipboard : public ::cppu::WeakComponentImplHelper <
+class GenericClipboard : public ::comphelper::WeakComponentImplHelper <
 css::datatransfer::clipboard::XClipboardEx,
   

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

2022-12-13 Thread Caolán McNamara (via logerrit)
 vcl/win/gdi/salnativewidgets-luna.cxx |   70 ++
 vcl/win/window/salframe.cxx   |   10 +++-
 2 files changed, 46 insertions(+), 34 deletions(-)

New commits:
commit 39c35de607f86d3d512c34e2dbc4622c579ce926
Author: Caolán McNamara 
AuthorDate: Tue Dec 13 12:23:24 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 13 14:17:07 2022 +

Related: tdf#152454 don't use Button to render dark mode Tabs

on Windows. I can't find anything obviously suitable, so fall back to
drawing simple rectangles with ActiveTabColor/InactiveTabColor

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

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 601575a9f58b..e3811020a42e 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -762,11 +762,17 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 if( nType == ControlType::TabPane )
 {
 // tabpane in tabcontrols gets drawn in "darkmode" as if it was a
-// a "light" theme, so bodge this by drawing with a button instead
+// a "light" theme, so bodge this by drawing a frame directly
 if (UseDarkMode())
-iPart = BP_PUSHBUTTON;
-else
-iPart = TABP_PANE;
+{
+Color 
aColor(Application::GetSettings().GetStyleSettings().GetDisableColor());
+ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(),
+ aColor.GetGreen(),
+ aColor.GetBlue(;
+FrameRect(hDC, , hbrush.get());
+return true;
+}
+iPart = TABP_PANE;
 return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption);
 }
 
@@ -804,7 +810,8 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, 
RECT rc,
 iPart = TABP_TABITEMLEFTEDGE;
 else if (rValue.isRightAligned())
 iPart = TABP_TABITEMRIGHTEDGE;
-else iPart = TABP_TABITEM;
+else
+iPart = TABP_TABITEM;
 
 if( !(nState & ControlState::ENABLED) )
 iState = TILES_DISABLED;
@@ -834,25 +841,31 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME 
hTheme, RECT rc,
 // a "light" theme, so bodge this by drawing with a button instead
 if (UseDarkMode())
 {
-iPart = BP_PUSHBUTTON;
-switch (iState)
-{
-case TILES_DISABLED:
-iState = PBS_DISABLED;
-break;
-case TILES_SELECTED:
-iState = PBS_DEFAULTED;
-break;
-case TILES_HOT:
-iState = PBS_HOT;
-break;
-case TILES_FOCUSED:
-iState = PBS_PRESSED;
-break;
-default:
-iState = PBS_NORMAL;
-break;
-}
+Color aColor;
+if (iState == TILES_SELECTED)
+aColor = 
Application::GetSettings().GetStyleSettings().GetActiveTabColor();
+else
+aColor = 
Application::GetSettings().GetStyleSettings().GetInactiveTabColor();
+ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(),
+ aColor.GetGreen(),
+ aColor.GetBlue(;
+FillRect(hDC, , hbrush.get());
+
+aColor = 
Application::GetSettings().GetStyleSettings().GetDisableColor();
+ScopedSelectedHPEN hPen(hDC, CreatePen(PS_SOLID, 1, 
RGB(aColor.GetRed(),
+
aColor.GetGreen(),
+
aColor.GetBlue(;
+POINT apt[4];
+apt[0].x = rc.left;
+apt[0].y = rc.bottom - (iPart == TABP_TABITEMLEFTEDGE ? 1 : 2);
+apt[1].x = rc.left;
+apt[1].y = rc.top;
+apt[2].x = rc.right;
+apt[2].y = rc.top;
+apt[3].x = rc.right;
+apt[3].y = rc.bottom - 1;
+Polyline(hDC, apt, SAL_N_ELEMENTS(apt));
+return true;
 }
 
 return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption);
@@ -1195,14 +1208,7 @@ bool WinSalGraphics::drawNativeControl( ControlType 
nType,
 break;
 case ControlType::TabPane:
 case ControlType::TabItem:
-if (bUseDarkMode)
-{
-// tabitem in tabcontrols gets drawn in "darkmode" as if it 
was a
-// a "light" theme, so bodge this by drawing with a 

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

2021-09-16 Thread Michael Weghorn (via logerrit)
 vcl/win/window/salframe.cxx   |3 ---
 winaccessibility/source/UAccCOM/MAccessible.h |   15 ---
 2 files changed, 18 deletions(-)

New commits:
commit 6a36d9b341f647d5547027c33bf4dc7c3df12cf8
Author: Michael Weghorn 
AuthorDate: Thu Sep 16 09:47:55 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Sep 17 07:05:14 2021 +0200

Drop conditional WM_GETOBJECT define from vcl/win/window/salframe.cxx

WM_GETOBJECT is already defined in WinUser.h.

Change-Id: I7594560698dd2a17412f5075f8b689decbd4ca49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122202
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index ae19b4a5c5c7..259a1395a3b2 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -86,9 +86,6 @@
 
 #include 
 #include 
-#ifndef WM_GETOBJECT // TESTME does this ever happen ?
-#  define WM_GETOBJECT  0x003D
-#endif
 
 #include 
 
commit f1c902af040eb358cc141a7a926272a25a2afba7
Author: Michael Weghorn 
AuthorDate: Thu Sep 16 09:43:28 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Sep 17 07:04:59 2021 +0200

wina11y: Drop OBJID_* defines from MAccessible.h

They are defined in WinUser.h, so there's no
need to duplicate that.

Change-Id: I1ab4255a8964d7822eface027d3cef7dcd6d29eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122201
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/winaccessibility/source/UAccCOM/MAccessible.h 
b/winaccessibility/source/UAccCOM/MAccessible.h
index 5384e6a5c665..71296cfc2fda 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.h
+++ b/winaccessibility/source/UAccCOM/MAccessible.h
@@ -34,21 +34,6 @@ namespace {
 enum class XInterfaceType;
 }
 
-#define OBJID_WINDOW((LONG)0x)
-#define OBJID_SYSMENU   ((LONG)0x)
-#define OBJID_TITLEBAR  ((LONG)0xFFFE)
-#define OBJID_MENU  ((LONG)0xFFFD)
-#define OBJID_CLIENT((LONG)0xFFFC)
-#define OBJID_VSCROLL   ((LONG)0xFFFB)
-#define OBJID_HSCROLL   ((LONG)0xFFFA)
-#define OBJID_SIZEGRIP  ((LONG)0xFFF9)
-#define OBJID_CARET ((LONG)0xFFF8)
-#define OBJID_CURSOR((LONG)0xFFF7)
-#define OBJID_ALERT ((LONG)0xFFF6)
-#define OBJID_SOUND ((LONG)0xFFF5)
-#define OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFF4)
-#define OBJID_NATIVEOM  ((LONG)0xFFF0)
-
 /**
  *This class implements IMAccessible interface, which inherits from 
IAccessible2, and
  *in turn inherits from IAccessible. So its methods include the methods 
defined only in


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

2017-07-17 Thread Jan-Marek Glogowski
 vcl/win/app/salinst.cxx |2 +-
 vcl/win/gdi/salbmp.cxx  |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit cd1d5f35cb0f9c455787819de56e24cd51e6c5cc
Author: Jan-Marek Glogowski 
Date:   Mon Jul 17 14:10:16 2017 +0200

WIN revert to Sleep(1) for yield

There are multiple ways on Windows to yield a thread:

* SwitchToThread: yields to any thread on same processor
* Sleep(0): yields to any thread of same or higher priority
on any processor
* Sleep(1): yields to any thread on any processor

So we stay with Sleep(1), as it also seems the only call, which
actually does some sleep and is not a busy wait.

Change-Id: I85c69b2f32dba9869bbddc1a572b3a63c366c5d1

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3a1522f7e836..3b29cf820b01 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -618,7 +618,7 @@ bool WinSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents, sal_uLong
 
 // #i18883# only sleep if potential deadlock scenario, ie, when a 
dialog is open
 if( ImplGetSVData()->maAppData.mnModalMode )
-SwitchToThread();
+Sleep(1);
 else
 bDidWork = SendMessageW( mhComWnd, SAL_MSG_THREADYIELD, 
(WPARAM)bWait, (LPARAM)bHandleAllCurrentEvents );
 
commit f0dae5fb2b0628659a121ca3f9ee9bf9039a49dd
Author: Jan-Marek Glogowski 
Date:   Mon Jul 17 13:58:44 2017 +0200

WIN annotate GdiPlusBuffer Timer

Change-Id: Ia7aa081848647314e14b5ccd3063d51700f2b6c6

diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 8b95249da6d8..98b59e771c74 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -71,8 +71,8 @@ private:
 EntryMapmaEntries;
 
 public:
-GdiPlusBuffer()
-:   Timer(),
+GdiPlusBuffer( const sal_Char *pDebugName )
+:   Timer( pDebugName ),
 maEntries()
 {
 SetTimeout(1000);
@@ -172,7 +172,7 @@ public:
 // Global instance of GdiPlusBuffer which manages Gdiplus::Bitmap
 // instances
 
-static GdiPlusBuffer aGdiPlusBuffer;
+static GdiPlusBuffer aGdiPlusBuffer( "vcl::win GdiPlusBuffer aGdiPlusBuffer" );
 
 
 WinSalBitmap::WinSalBitmap()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

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

New commits:
commit 03bff1b6b953e4b7a54d2fb7bbf366bea7e959d9
Author: Khaled Hosny 
Date:   Tue Nov 1 23:15:44 2016 +0200

tdf#71603: Improve font fallback on Windows a bit

Check all missing characters, not just the first one. Also the calling
sites for GlyphFallbackFontSubstitution hook expect the OUString to be
updated to have only any characters not supported by the returned font.

Change-Id: Ife56d692c05433f2f7fe02db3ef1562181dc3d53

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index c8c9893..8d6f065 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -151,7 +151,7 @@ public:
 bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingChars ) 
const override;
 private:
 HDC mhDC;
-bool HasMissingChars( PhysicalFontFace*, const OUString& rMissingChars ) 
const;
+bool HasMissingChars(PhysicalFontFace*, OUString& rMissingChars) const;
 };
 
 inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC 
)
@@ -159,7 +159,7 @@ inline 
WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC )
 {}
 
 // does a font face hold the given missing characters?
-bool WinGlyphFallbackSubstititution::HasMissingChars( PhysicalFontFace* pFace, 
const OUString& rMissingChars ) const
+bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, 
OUString& rMissingChars) const
 {
 WinFontFace* pWinFont = static_cast< WinFontFace* >(pFace);
 FontCharMapRef xFontCharMap = pWinFont->GetFontCharMap();
@@ -194,19 +194,24 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( 
PhysicalFontFace* pFace, c
 return false;
 
 int nMatchCount = 0;
-// static const int nMaxMatchCount = 1; // TODO: tolerate more missing 
characters?
+std::vector rRemainingCodes;
 const sal_Int32 nStrLen = rMissingChars.getLength();
-for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; /* ++nStrIdx unreachable 
code, see the 'break' below */ )
+sal_Int32 nStrIdx = 0;
+while (nStrIdx < nStrLen)
 {
 const sal_UCS4 uChar = rMissingChars.iterateCodePoints(  );
-nMatchCount += xFontCharMap->HasChar( uChar ) ? 1 : 0;
-break; // for now
+if (xFontCharMap->HasChar(uChar))
+nMatchCount++;
+else
+rRemainingCodes.push_back(uChar);
 }
 
 xFontCharMap = nullptr;
 
-const bool bHasMatches = (nMatchCount > 0);
-return bHasMatches;
+if (nMatchCount > 0)
+rMissingChars = OUString(rRemainingCodes.data(), 
rRemainingCodes.size());
+
+return nMatchCount > 0;
 }
 
 namespace
commit d66ec48fe879a26ec542661c04e5c2b8271b7d64
Author: Khaled Hosny 
Date:   Tue Nov 1 22:22:30 2016 +0200

Use the font language instead of guessing it

Similar to what we do with FontConfig.

Change-Id: Id01dabe0b52e4e3aea54073d42b719a924025920

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index b434184..c8c9893 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -134,150 +134,6 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
 }
 
 // platform specific font substitution hooks for glyph fallback enhancement
-// TODO: move into i18n module (maybe merge with svx/ucsubset.*
-//   or merge with i18nutil/source/utility/unicode_data.h)
-struct Unicode2LangType
-{
-sal_UCS4 mnMinCode;
-sal_UCS4 mnMaxCode;
-LanguageType mnLangID;
-};
-
-// entries marked with default-CJK get replaced with the default-CJK language
-#define LANGUAGE_DEFAULT_CJK 0xFFF0
-
-// map unicode ranges to languages supported by OOo
-// NOTE: due to the binary search used this list must be sorted by mnMinCode
-static Unicode2LangType aLangFromCodeChart[]= {
-{0x, 0x007F, LANGUAGE_ENGLISH}, // Basic Latin
-{0x0080, 0x024F, LANGUAGE_ENGLISH}, // Latin Extended-A and 
Latin Extended-B
-{0x0250, 0x02AF, LANGUAGE_SYSTEM},  // IPA Extensions
-{0x0370, 0x03FF, LANGUAGE_GREEK},   // Greek
-{0x0590, 0x05FF, LANGUAGE_HEBREW},  // Hebrew
-{0x0600, 0x06FF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic
-{0x0900, 0x097F, LANGUAGE_HINDI},   // Devanagari
-{0x0980, 0x09FF, LANGUAGE_BENGALI}, // Bengali
-{0x0A80, 0x0AFF, LANGUAGE_GUJARATI},// Gujarati
-{0x0B00, 0x0B7F, LANGUAGE_ODIA},// Odia
-{0x0B80, 0x0BFF, LANGUAGE_TAMIL},   // Tamil
-{0x0C00, 0x0C7F, LANGUAGE_TELUGU},  // Telugu
-{0x0C80, 0x0CFF, LANGUAGE_KANNADA}, // Kannada
-{0x0D00, 0x0D7F, LANGUAGE_MALAYALAM},   // Malayalam
-{0x0D80, 0x0D7F, LANGUAGE_SINHALESE_SRI_LANKA}, // Sinhala
-{0x0E00, 0x0E7F, LANGUAGE_THAI},// Thai
-{0x0E80, 

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

2016-04-06 Thread Stephan Bergmann
 vcl/win/gdi/winlayout.cxx |2 
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx |   36 
+-
 2 files changed, 18 insertions(+), 20 deletions(-)

New commits:
commit 6d7366c80bee15c8d00168efa30c731cead566cb
Author: Stephan Bergmann 
Date:   Wed Apr 6 08:33:45 2016 +0200

-Werror,-Winconsistent-missing-override

Change-Id: I9e6a44fb54484aebc3f223b3c71d2de18bb5d553

diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
index e05408c..09fd6b38 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
@@ -50,33 +50,33 @@ class X509Certificate_MSCryptImpl : public 
::cppu::WeakImplHelper<
 virtual ~X509Certificate_MSCryptImpl() ;
 
 //Methods from XCertificate
-virtual sal_Int16 SAL_CALL getVersion() throw ( 
css::uno::RuntimeException) ;
+virtual sal_Int16 SAL_CALL getVersion() throw ( 
css::uno::RuntimeException) override;
 
-virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber() 
throw ( css::uno::RuntimeException) ;
-virtual OUString SAL_CALL getIssuerName() throw ( 
css::uno::RuntimeException) ;
-virtual OUString SAL_CALL getSubjectName() throw ( 
css::uno::RuntimeException) ;
-virtual css::util::DateTime SAL_CALL getNotValidBefore() throw ( 
css::uno::RuntimeException) ;
-virtual css::util::DateTime SAL_CALL getNotValidAfter() throw ( 
css::uno::RuntimeException) ;
-virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID() 
throw ( css::uno::RuntimeException) ;
-virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID() 
throw ( css::uno::RuntimeException) ;
-virtual css::uno::Sequence< css::uno::Reference< 
css::security::XCertificateExtension > > SAL_CALL getExtensions() throw ( 
css::uno::RuntimeException) ;
-virtual css::uno::Reference< css::security::XCertificateExtension > 
SAL_CALL findCertificateExtension( const css::uno::Sequence< sal_Int8 >& oid ) 
throw (css::uno::RuntimeException) ;
-virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() throw ( 
css::uno::RuntimeException) ;
+virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber() 
throw ( css::uno::RuntimeException) override;
+virtual OUString SAL_CALL getIssuerName() throw ( 
css::uno::RuntimeException) override;
+virtual OUString SAL_CALL getSubjectName() throw ( 
css::uno::RuntimeException) override;
+virtual css::util::DateTime SAL_CALL getNotValidBefore() throw ( 
css::uno::RuntimeException) override;
+virtual css::util::DateTime SAL_CALL getNotValidAfter() throw ( 
css::uno::RuntimeException) override;
+virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID() 
throw ( css::uno::RuntimeException) override;
+virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID() 
throw ( css::uno::RuntimeException) override;
+virtual css::uno::Sequence< css::uno::Reference< 
css::security::XCertificateExtension > > SAL_CALL getExtensions() throw ( 
css::uno::RuntimeException) override;
+virtual css::uno::Reference< css::security::XCertificateExtension > 
SAL_CALL findCertificateExtension( const css::uno::Sequence< sal_Int8 >& oid ) 
throw (css::uno::RuntimeException) override;
+virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() throw ( 
css::uno::RuntimeException) override;
 virtual OUString SAL_CALL getSubjectPublicKeyAlgorithm()
-throw ( css::uno::RuntimeException) ;
+throw ( css::uno::RuntimeException) override;
 virtual css::uno::Sequence< sal_Int8 > SAL_CALL 
getSubjectPublicKeyValue()
-throw ( css::uno::RuntimeException) ;
+throw ( css::uno::RuntimeException) override;
 virtual OUString SAL_CALL getSignatureAlgorithm()
-throw ( css::uno::RuntimeException) ;
+throw ( css::uno::RuntimeException) override;
 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint()
-throw ( css::uno::RuntimeException) ;
+throw ( css::uno::RuntimeException) override;
 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint()
-throw ( css::uno::RuntimeException) ;
+throw ( css::uno::RuntimeException) override;
 
-virtual sal_Int32 SAL_CALL getCertificateUsage( ) throw ( 
css::uno::RuntimeException) ;
+virtual sal_Int32 SAL_CALL getCertificateUsage( ) throw ( 
css::uno::RuntimeException) override;
 
 //Methods from XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) throw (css::uno::RuntimeException);
+virtual sal_Int64 SAL_CALL getSomething( const 

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

2016-03-14 Thread Tor Lillqvist
 vcl/win/gdi/salfont.cxx   |4 
 vcl/win/gdi/winlayout.cxx |  698 +++---
 2 files changed, 417 insertions(+), 285 deletions(-)

New commits:
commit 03637a75c1bebf8b35b520139b9ddfa3238ee53f
Author: Tor Lillqvist 
Date:   Mon Mar 14 07:29:14 2016 +0200

Fix what seems to have been off-by-one errors in glyph bounds calculation

For some reason the error had a visible impact (as far as I an see,
anyway) only for Graphite fonts. The bottommost pixels were cut
off. (Also leftmost, but that was not so easily visible.)

 Rectangle type, I love you.

Change-Id: I6f7438ec21d2bc1b9bef31cd70e649856f7ec7d5

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index a47f3d1..3278e88 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -2014,9 +2014,9 @@ bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId 
aGlyphId, Rectangle& rRect )
 rRect = Rectangle( Point( +aGM.gmptGlyphOrigin.x, -aGM.gmptGlyphOrigin.y ),
 Size( aGM.gmBlackBoxX, aGM.gmBlackBoxY ) );
 rRect.Left()= static_cast( mfCurrentFontScale * rRect.Left() );
-rRect.Right()   = static_cast( mfCurrentFontScale * rRect.Right() );
+rRect.Right()   = static_cast( mfCurrentFontScale * rRect.Right() ) + 
1;
 rRect.Top() = static_cast( mfCurrentFontScale * rRect.Top() );
-rRect.Bottom()  = static_cast( mfCurrentFontScale * rRect.Bottom() );
+rRect.Bottom()  = static_cast( mfCurrentFontScale * rRect.Bottom() ) 
+ 1;
 return true;
 }
 
commit e45d80f20ff6a05888f92ae942abed67609d5b20
Author: Tim Eves 
Date:   Tue Feb 23 16:45:21 2016 +

tdf#97171: Use DirectWrite for OpenGL glyph caching

This is a squash of several separate intermediate commits, the most
relevant log messages of which are repeated here:

Refactor some previously private methods into public ones and
reimplement parts of D2DWriteTextOutRenderer to user them. Also
apply them to rendering the OpenGL glyph atlas, in an effort to
workaround some bugs in legacy Windows text rendering APIs.

I assume we want to initialise the rectangle with zero
left/right/top/bottom and not using the default constructor, which
sets the right and bottom coordinates to the magic value -32767. That
made the 'bound' rectangle end up with rather amusing boundaries, like
left=-32766, top=-16, right=-32576, bottom=6.

Try calculating a chunks ascent & height from the inkboxes rather than
using the font metrics which might not alway be correct when glyphs
inkboxes are tall than the ascent or lower than the descent.

Mark the mnAscent in the chunk bitmap debug output.

Fix several miscalulations in positioning glyph to be rendered into
that atlas.

Fix vertical alignment problems. Inkboxes are returned with all
co-ordinates relative to the glyphs not the fonts ascent.  Therefor
bounds.Top() is not the vertical overhang but the -ve height of the
inkbox above the baseline.  This fixes the calulation of the per Chunk
ascent.

Fix horizontal occsional alingment issues in OpenGL cached glyphs. The
left edge of the src location rectangle for the first glyph in a cache
chunk would set to extraspace and not zero, but all other rectangles
in the chunk would be set from the aEnds array. This produced a bug
where only certain letters would be mispositioned, proportional to the
fonts point size.

Rename OpenGLGlyphChunk::mnAscent to mnBaselineOffset to reflect curr
use.  Changed at Tor's stuggestion to better describe to it's use as
it's value would be per chunk and based on the maximum ink box bounds
of the glyphs in the chunk, rather than having anything to do with the
font's real ascent value.

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index ab04e70..c8856dc 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -38,6 +38,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -78,8 +79,9 @@ struct OpenGLGlyphCacheChunk
 WORD mnFirstGlyph;
 int mnGlyphCount;
 std::vector maLocation;
+std::vector maLeftOverhangs;
 std::shared_ptr mpTexture;
-int mnAscent;
+int mnBaselineOffset;
 int mnHeight;
 bool mbVertical;
 bool mbRealGlyphIndices;
@@ -147,6 +149,104 @@ private:
 
 GLuint WinFontInstance::mnGLyphyProgram = 0;
 
+class TextOutRenderer
+{
+protected:
+explicit TextOutRenderer() = default;
+TextOutRenderer(const TextOutRenderer &) = delete;
+TextOutRenderer & operator = (const TextOutRenderer &) = delete;
+
+public:
+static TextOutRenderer & get();
+
+virtual ~TextOutRenderer() = default;
+
+virtual bool operator ()(WinLayout const , HDC hDC,
+const Rectangle* pRectToErase,
+Point* pPos, int* pGetNextGlypInfo) = 0;
+};
+
+class ExTextOutRenderer : public 

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

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

New commits:
commit 7f25a5a0736c90a70d58fde6afaddd1ae4c24cb6
Author: Tor Lillqvist 
Date:   Thu Mar 10 10:11:58 2016 +0200

Add comment wondering what the code thinks it is doing

Change-Id: Icb135c12b2bc159e0542994bb496b45bf1fdb9e2

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 1b2ca79..691901e 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3770,6 +3770,7 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const 
, HDC hDC,
 bool succeeded = GetDWriteInkBox(*pFontFace, rLayout, lfEmHeight, bounds);
 if (pRectToErase)
 {
+// Isn't this equivalent to simply doing: bounds = *pRectToErase ?
 bounds.Intersection(*pRectToErase);
 bounds.Union(*pRectToErase);
 }
commit bda20c0f39acec27b39556fd7ee1cacfc2813720
Author: Tor Lillqvist 
Date:   Thu Mar 10 10:11:07 2016 +0200

Factor out the calls to FillRect in the DrawTextImpl() implementations

They were all in fact doing exactly the same, so do it at the call
site instead.

Change-Id: Id61cf9f5881411ddb7df5c3fd98c83252637e4d7

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 39d6fd7..1b2ca79 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -846,16 +846,10 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, 
sal_GlyphId* pGlyphIds, Point& rPo
 }
 
 bool SimpleWinLayout::DrawTextImpl(HDC hDC,
-   const Rectangle* pRectToErase,
+   const Rectangle* /* pRectToErase */,
Point* /* pPos */,
int* /* pGetNextGlypInfo */) const
 {
-if (pRectToErase)
-{
-RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left()+pRectToErase->GetWidth(), 
pRectToErase->Top()+pRectToErase->GetHeight() };
-FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
-}
-
 if( mnGlyphCount <= 0 )
 return false;
 
@@ -1384,6 +1378,9 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 // we are making changes to the DC, make sure we got a new one
 assert(aDC.getCompatibleHDC() != hDC);
 
+RECT aWinRect = { aRect.Left(), aRect.Top(), aRect.Left() + 
aRect.GetWidth(), aRect.Top() + aRect.GetHeight() };
+FillRect(aDC.getCompatibleHDC(), , 
static_cast(GetStockObject(WHITE_BRUSH)));
+
 // setup the hidden DC with black color and white background, 
we will
 // use the result of the text drawing later as a mask only
 HFONT hOrigFont = SelectFont(aDC.getCompatibleHDC(), mhFont);
@@ -2605,16 +2602,10 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 }
 
 bool UniscribeLayout::DrawTextImpl(HDC hDC,
-   const Rectangle* pRectToErase,
+   const Rectangle* /* pRectToErase */,
Point* /* pPos */,
int* /* pGetNextGlypInfo */) const
 {
-if (pRectToErase)
-{
-RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left()+pRectToErase->GetWidth(), 
pRectToErase->Top()+pRectToErase->GetHeight() };
-FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
-}
-
 HFONT hOrigFont = DisableFontScaling();
 
 int nBaseClusterOffset = 0;
@@ -3710,12 +3701,6 @@ bool ExTextOutRenderer::operator ()(WinLayout const 
, HDC hDC,
 const Rectangle* pRectToErase,
 Point* pPos, int* pGetNextGlypInfo)
 {
-if (pRectToErase)
-{
-RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left() + pRectToErase->GetWidth(), pRectToErase->Top() + 
pRectToErase->GetHeight() };
-FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
-}
-
 const int MAX_GLYPHS = 2;
 sal_GlyphId glyphIntStr[MAX_GLYPHS];
 int nGlyphs = 0;
@@ -3768,12 +3753,6 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout 
const , HDC hDC,
 const Rectangle* pRectToErase,
 Point* pPos, int* pGetNextGlypInfo)
 {
-if (pRectToErase)
-{
-RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), 
pRectToErase->Left() + pRectToErase->GetWidth(), pRectToErase->Top() + 
pRectToErase->GetHeight() };
-FillRect(hDC, , 
static_cast(GetStockObject(WHITE_BRUSH)));
-}
-
 if (!Ready())
 return false;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-28 Thread Michael Stahl
 vcl/win/source/gdi/winlayout.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3706003a81a47ea14011fe58dcef300a5b570f79
Author: Michael Stahl mst...@redhat.com
Date:   Fri Aug 28 13:13:39 2015 +0200

vcl: convert to assert in UniscribeLayout::DropGlyph()

Change-Id: I918a47da16a539f981baa9a8c1e5a7a5cf642cf4

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index f4dc9c0..7158e29 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1482,7 +1482,7 @@ void UniscribeLayout::DropGlyph( int nStartx8 )
 {
 DBG_ASSERT( !(nStartx8  0xff), USP::DropGlyph(): glyph injection not 
disabled! );
 int nStart = nStartx8  8;
-DBG_ASSERT( nStart=mnGlyphCount, USPLayout::MoveG nStart overflow );
+assert(nStart = mnGlyphCount);
 
 if( nStart  0 )// nStart0 means absolute glyph pos + 1
 --nStart;
@@ -1492,7 +1492,7 @@ void UniscribeLayout::DropGlyph( int nStartx8 )
 for( int i = mnItemCount, nDummy; --i = 0; ++pVI )
 if( GetItemSubrange( *pVI, nStart, nDummy ) )
 break;
-DBG_ASSERT( nStart = mnGlyphCount, USPLayout::DropG overflow );
+assert(nStart = mnGlyphCount);
 
 int j = pVI-mnMinGlyphPos;
 while (j  mnGlyphCount  mpOutGlyphs[j] == DROPPED_OUTGLYPH) j++;
commit eba9a6c4b32220dcc729c71e440234f90af5bdcc
Author: Michael Stahl mst...@redhat.com
Date:   Fri Aug 28 13:12:25 2015 +0200

vcl: fix drmemory warning in UniscribeLayout::DropGlyph()

It says there's access to uninitialized variable on that line,
so propbably the loop is running over.

Change-Id: I0226f82b20a6fbbc79af5bbb46af09830c3bc25a

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d341806..f4dc9c0 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1495,7 +1495,7 @@ void UniscribeLayout::DropGlyph( int nStartx8 )
 DBG_ASSERT( nStart = mnGlyphCount, USPLayout::DropG overflow );
 
 int j = pVI-mnMinGlyphPos;
-while (mpOutGlyphs[j] == DROPPED_OUTGLYPH) j++;
+while (j  mnGlyphCount  mpOutGlyphs[j] == DROPPED_OUTGLYPH) j++;
 if (j == nStart)
 {
 pVI-mnXOffset += ((mpJustifications)? mpJustifications[nStart] : 
mpGlyphAdvances[nStart]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-21 Thread Tor Lillqvist
 vcl/win/source/gdi/winlayout.cxx |  176 ---
 1 file changed, 148 insertions(+), 28 deletions(-)

New commits:
commit ba815705e30d190e9d6c2fdf202a0bdbf7be5ea0
Author: Tor Lillqvist t...@collabora.com
Date:   Fri Aug 21 16:19:31 2015 +0300

Error handling

Change-Id: I46e5463aaa5cab41cd69c13314ee98a0c73e7ba2

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 964ff99..b0575a6 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -271,6 +271,8 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, 
const WinLayout rLayou
 if (!GetCharABCWidthsI(hDC, 0, nCount, aGlyphIndices.data(), aABC.data()))
 {
 SAL_WARN(vcl.gdi, GetCharABCWidthsI failed:   
WindowsErrorString(GetLastError()));
+SelectObject(hDC, hOrigFont);
+DeleteDC(hDC);
 return false;
 }
 
@@ -296,10 +298,24 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, 
const WinLayout rLayou
 }
 
 TEXTMETRICW aTextMetric;
-GetTextMetricsW(hDC, aTextMetric);
+if (!GetTextMetricsW(hDC, aTextMetric))
+{
+SAL_WARN(vcl.gdi, GetTextMetrics failed:   
WindowsErrorString(GetLastError()));
+SelectObject(hDC, hOrigFont);
+DeleteDC(hDC);
+return false;
+}
 aChunk.mnAscentPlusIntLeading = aTextMetric.tmAscent + 
aTextMetric.tmInternalLeading;
 
 UINT nAlign = GetTextAlign(hDC);
+if (nAlign == GDI_ERROR)
+{
+SAL_WARN(vcl.gdi, GetTextAlign failed:   
WindowsErrorString(GetLastError()));
+SelectObject(hDC, hOrigFont);
+DeleteDC(hDC);
+return false;
+}
+
 OUString sAlign;
 switch ((TA_LEFT|TA_CENTER|TA_RIGHT)  nAlign)
 {
@@ -339,10 +355,24 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, 
const WinLayout rLayou
 sAlign += NOUPDATECP;
 
 LOGFONTW aLogfont;
-GetObjectW(rLayout.mhFont, sizeof(aLogfont), aLogfont);
+if (!GetObjectW(rLayout.mhFont, sizeof(aLogfont), aLogfont))
+{
+SAL_WARN(vcl.gdi, GetObject failed:   
WindowsErrorString(GetLastError()));
+SelectObject(hDC, hOrigFont);
+DeleteDC(hDC);
+return false;
+}
 
 wchar_t sFaceName[200];
 int nFaceNameLen = GetTextFaceW(hDC, SAL_N_ELEMENTS(sFaceName), sFaceName);
+if (!nFaceNameLen)
+{
+SAL_WARN(vcl.gdi, GetTextFace failed:   
WindowsErrorString(GetLastError()));
+SelectObject(hDC, hOrigFont);
+DeleteDC(hDC);
+return false;
+}
+
 SAL_INFO(vcl.gdi.opengl, OUString(sFaceName, nFaceNameLen) 
  :   sAlign 
   Escapement=  aLogfont.lfEscapement 
commit dc0167c2635c8a6d925df96c250c3412fac1a8fb
Author: Tor Lillqvist t...@collabora.com
Date:   Fri Aug 21 16:04:07 2015 +0300

Make vertical fonts show up when using OpenGL glyph caching

Change-Id: I6b19873eef48b625dc3d4f7b3a9afdb348189b38

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d445506..964ff99 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -65,6 +65,7 @@ struct OpenGLGlyphCacheChunk
 std::vectorRectangle maLocation;
 std::shared_ptrOpenGLTexture mpTexture;
 int mnAscentPlusIntLeading;
+bool mbVertical;
 };
 
 // win32 specific physical font instance
@@ -130,13 +131,18 @@ OUString DumpGlyphBitmap(OpenGLGlyphCacheChunk rChunk, 
HDC hDC)
 }
 
 std::cerr  Bitmap   hBitmap  :   aBitmap.bmWidth  x  
aBitmap.bmHeight  :  std::endl;
+
+// Print out start pos of each glyph only in the horizontal font case
 int nPos = 0;
-for (int i = 1; i  rChunk.mnGlyphCount  nPos  75; i++)
+if (rChunk.mnGlyphCount  1  rChunk.maLocation[1].Left()  
rChunk.maLocation[0].Left())
 {
-for (int j = nPos; j  rChunk.maLocation[i].Left(); j++)
-std::cerr   ;
-std::cerr  !;
-nPos = rChunk.maLocation[i].Left() + 1;
+for (int i = 1; i  rChunk.mnGlyphCount  nPos  75; i++)
+{
+for (int j = nPos; j  rChunk.maLocation[i].Left(); j++)
+std::cerr   ;
+std::cerr  !;
+nPos = rChunk.maLocation[i].Left() + 1;
+}
 }
 std::cerr  std::endl;
 
@@ -289,7 +295,61 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, 
const WinLayout rLayou
 totWidth += aDX[i];
 }
 
-SAL_INFO(vcl.gdi.opengl, aSize=(  aSize.cx  ,  aSize.cy  ) 
totWidth=  totWidth);
+TEXTMETRICW aTextMetric;
+GetTextMetricsW(hDC, aTextMetric);
+aChunk.mnAscentPlusIntLeading = aTextMetric.tmAscent + 
aTextMetric.tmInternalLeading;
+
+UINT nAlign = GetTextAlign(hDC);
+OUString sAlign;
+switch ((TA_LEFT|TA_CENTER|TA_RIGHT)  nAlign)
+{
+case TA_LEFT:
+sAlign = LEFT;
+break;
+case TA_CENTER:
+sAlign = CENTER;
+break;
+case TA_RIGHT:
+sAlign = RIGHT;
+break;
+

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

2015-08-10 Thread Tor Lillqvist
 vcl/win/source/gdi/winlayout.cxx |   72 +++
 vcl/win/source/gdi/winlayout.hxx |   52 ++--
 2 files changed, 62 insertions(+), 62 deletions(-)

New commits:
commit 8bc5b7a41f290ab4cc999cddf5d578843559ad1f
Author: Tor Lillqvist t...@collabora.com
Date:   Mon Aug 10 13:58:37 2015 +0300

Add missing SAL_OVERRIDEs

It is really ugly to use SAL_OVERRIDE inconsistently.

Change-Id: I8b556a9cc65e6f71198d126d07ce1559216543e9

diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
index 196b8e9..528215f 100644
--- a/vcl/win/source/gdi/winlayout.hxx
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -41,7 +41,7 @@ class WinLayout : public SalLayout
 {
 public:
 WinLayout(HDC, const ImplWinFontData, 
ImplWinFontEntry, bool bUseOpenGL);
-virtual voidInitFont() const;
+virtual voidInitFont() const SAL_OVERRIDE;
 voidSetFontScale( float f ) { mfFontScale = f; }
 HFONT   DisableFontScaling() const;
 
@@ -71,22 +71,22 @@ public:
 SimpleWinLayout(HDC, BYTE nCharSet, const 
ImplWinFontData, ImplWinFontEntry, bool bUseOpenGL);
 virtual ~SimpleWinLayout();
 
-virtual boolLayoutText( ImplLayoutArgs );
-virtual voidAdjustLayout( ImplLayoutArgs );
+virtual boolLayoutText( ImplLayoutArgs ) SAL_OVERRIDE;
+virtual voidAdjustLayout( ImplLayoutArgs ) SAL_OVERRIDE;
 virtual voidDrawTextImpl(HDC hDC) const SAL_OVERRIDE;
 
 virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point 
rPos, int,
DeviceCoordinate* pGlyphAdvances, int* 
pCharIndexes,
-   const PhysicalFontFace** pFallbackFonts = 
NULL ) const;
+   const PhysicalFontFace** pFallbackFonts = 
NULL ) const SAL_OVERRIDE;
 
-virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const 
SAL_OVERRIDE;
 virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, 
DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) 
const;
+virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) 
const SAL_OVERRIDE;
 
 // for glyph+font+script fallback
-virtual voidMoveGlyph( int nStart, long nNewXPos );
-virtual voidDropGlyph( int nStart );
-virtual voidSimplify( bool bIsBase );
+virtual voidMoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE;
+virtual voidDropGlyph( int nStart ) SAL_OVERRIDE;
+virtual voidSimplify( bool bIsBase ) SAL_OVERRIDE;
 
 protected:
 voidJustify( DeviceCoordinate nNewWidth );
@@ -114,22 +114,22 @@ class UniscribeLayout : public WinLayout
 public:
 UniscribeLayout(HDC, const ImplWinFontData, 
ImplWinFontEntry, bool bUseOpenGL);
 
-virtual boolLayoutText( ImplLayoutArgs );
-virtual voidAdjustLayout( ImplLayoutArgs );
+virtual boolLayoutText( ImplLayoutArgs ) SAL_OVERRIDE;
+virtual voidAdjustLayout( ImplLayoutArgs ) SAL_OVERRIDE;
 virtual voidDrawTextImpl(HDC hDC) const SAL_OVERRIDE;
 virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point 
rPos, int,
DeviceCoordinate* pGlyphAdvances, int* 
pCharPosAry,
-   const PhysicalFontFace** pFallbackFonts = 
NULL ) const;
+   const PhysicalFontFace** pFallbackFonts = 
NULL ) const SAL_OVERRIDE;
 
-virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const 
SAL_OVERRIDE;
 virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, 
DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) 
const;
+virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) 
const SAL_OVERRIDE;
 virtual boolIsKashidaPosValid ( int nCharPos ) const SAL_OVERRIDE;
 
 // for glyph+font+script fallback
-virtual voidMoveGlyph( int nStart, long nNewXPos );
-virtual voidDropGlyph( int nStart );
-virtual voidSimplify( bool bIsBase );
+virtual voidMoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE;
+virtual voidDropGlyph( int nStart ) SAL_OVERRIDE;
+virtual voidSimplify( bool bIsBase ) SAL_OVERRIDE;
 virtual voidDisableGlyphInjection( bool bDisable ) SAL_OVERRIDE { 
mbDisableGlyphInjection = bDisable; }
 
 protected:
@@ -184,7 +184,7 @@ public:
 throw()
 : GraphiteLayout(pFace), mrFont(rFont) {};
 virtual ~GraphiteLayoutWinImpl() throw() {};
-virtual sal_GlyphId getKashidaGlyph(int 

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

2015-05-20 Thread Noel Grandin
 vcl/win/source/gdi/salprn.cxx|4 ++--
 vcl/win/source/gdi/winlayout.cxx |   14 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit e964042c16efafd5f6656dbb7cea14c852a39822
Author: Noel Grandin n...@peralex.com
Date:   Wed May 20 10:01:56 2015 +0200

fix Win build

after my commit 7a0af37989d1f1b508a61f28e785c5b1f27d58af
convert SAL_LAYOUT flags to scoped enum

Change-Id: Iba12d2f60840a012d3e54a1364b672820e8bd6dc

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 4de0437..a231a2f 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -264,7 +264,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs rArgs )
 {
 // prepare layout
 // TODO: fix case when recyclying old SimpleWinLayout object
-mbDisableGlyphs |= ((rArgs.mnFlags  
SalLayoutFlags::DisableGlyphProcessing) != 0);
+mbDisableGlyphs |= bool(rArgs.mnFlags  
SalLayoutFlags::DisableGlyphProcessing);
 mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
 
 if( !mbDisableGlyphs )
@@ -291,7 +291,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs rArgs )
 int i, j;
 
 mnGlyphCount = 0;
-bool bVertical = (rArgs.mnFlags  SalLayoutFlags::Vertical) != 0;
+bool bVertical(rArgs.mnFlags  SalLayoutFlags::Vertical);
 
 // count the number of chars to process if no RTL run
 rArgs.ResetPos();
@@ -1071,14 +1071,14 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs rArgs 
)
 // prepare itemization
 // TODO: try to avoid itemization since it costs a lot of performance
 SCRIPT_STATE aScriptState = 
{0,false,false,false,false,false,false,false,false,0,0};
-aScriptState.uBidiLevel = (0 != (rArgs.mnFlags  
SalLayoutFlags::BiDiRtl));
-aScriptState.fOverrideDirection = (0 != (rArgs.mnFlags  
SalLayoutFlags::BidiStrong));
-aScriptState.fDigitSubstitute   = (0 != (rArgs.mnFlags  
SalLayoutFlags::SubstituteDigits));
+aScriptState.uBidiLevel = bool(rArgs.mnFlags  
SalLayoutFlags::BiDiRtl);
+aScriptState.fOverrideDirection = bool(rArgs.mnFlags  
SalLayoutFlags::BidiStrong);
+aScriptState.fDigitSubstitute   = bool(rArgs.mnFlags  
SalLayoutFlags::SubstituteDigits);
 aScriptState.fArabicNumContext  = aScriptState.fDigitSubstitute  
aScriptState.uBidiLevel;
 DWORD nLangId = 0;  // TODO: get language from font
 SCRIPT_CONTROL aScriptControl = 
{nLangId,false,false,false,false,false,false,false,false,0};
 aScriptControl.fNeutralOverride = aScriptState.fOverrideDirection;
-aScriptControl.fContextDigits   = (0 != (rArgs.mnFlags  
SalLayoutFlags::SubstituteDigits));
+aScriptControl.fContextDigits   = bool(rArgs.mnFlags  
SalLayoutFlags::SubstituteDigits);
 #if HAVE_FMERGENEUTRALITEMS
 aScriptControl.fMergeNeutralItems = true;
 #endif
@@ -1265,7 +1265,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs rArgs )
 rVisualItem.IsRTL() );
 
 // don't bother to do a default layout in a fallback level
-if( 0 != (rArgs.mnFlags  SalLayoutFlags::ForFallback) )
+if( rArgs.mnFlags  SalLayoutFlags::ForFallback )
 continue;
 
 // the primitive layout engine is good enough for the default 
layout
commit bc56da8784a76e92878193baf4764c50333eb21f
Author: Noel Grandin n...@peralex.com
Date:   Wed May 20 10:00:18 2015 +0200

fix Win build

after my commit 4b57be7234ea61aad0a472a56a4f073270933c8e
convert QUEUE_STATUS constants to scoped enum

Change-Id: I5a91a79148b3b3edaa12e6933344040ed64acc6a

diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index f6c00be..c0705fe 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -151,7 +151,7 @@ static PrintQueueFlags ImplWinQueueStatusToSal( DWORD 
nWinStatus )
 nStatus |= PrintQueueFlags::StatusUnknown;
 if ( nWinStatus  PRINTER_STATUS_POWER_SAVE )
 nStatus |= PrintQueueFlags::PowerSave;
-if ( !nStatus  !(nWinStatus  PRINTER_STATUS_NOT_AVAILABLE) )
+if ( nStatus == PrintQueueFlags::NONE  !(nWinStatus  
PRINTER_STATUS_NOT_AVAILABLE) )
 nStatus |= PrintQueueFlags::Ready;
 return nStatus;
 }
@@ -173,7 +173,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* 
pList )
 {
 SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
 pInfo-maPrinterName = OUString( reinterpret_cast const 
sal_Unicode* (pWinInfo4[i].pPrinterName) );
-pInfo-mnStatus  = 0;
+pInfo-mnStatus  = PrintQueueFlags::NONE;
 pInfo-mnJobs= 0;
 pInfo-mpSysData = NULL;
 pList-Add( pInfo );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits