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

2019-01-13 Thread Libreoffice Gerrit user
 vcl/inc/win/scoped_gdi.hxx|6 +++---
 vcl/win/gdi/gdiimpl.cxx   |2 +-
 vcl/win/gdi/winlayout.cxx |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   11 +++
 4 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 60e308e60a623bd45b7a30aa7f538ee6ed3d42cb
Author: Dmitriy Shilin 
AuthorDate: Sat Jan 12 06:04:39 2019 -0800
Commit: Mike Kaganski 
CommitDate: Sun Jan 13 11:06:01 2019 +0100

tdf#107792 vcl/win: move scoped_gdi.hxx to vcl/inc/win

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

diff --git a/vcl/win/gdi/scoped_gdi.hxx b/vcl/inc/win/scoped_gdi.hxx
similarity index 88%
rename from vcl/win/gdi/scoped_gdi.hxx
rename to vcl/inc/win/scoped_gdi.hxx
index b5a66d9d3698..80fbea8b4463 100644
--- a/vcl/win/gdi/scoped_gdi.hxx
+++ b/vcl/inc/win/scoped_gdi.hxx
@@ -7,8 +7,8 @@
  * 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
+#ifndef INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX
+#define INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX
 
 #include 
 #include 
@@ -37,6 +37,6 @@ using ScopedHBRUSH = std::unique_ptr;
 using ScopedHRGN = std::unique_ptr;
 using ScopedHDC = std::unique_ptr;
 
-#endif // INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX
+#endif // INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 1bb39b84cd2e..ec7682b14899 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -20,7 +20,6 @@
 #include 
 
 #include "gdiimpl.hxx"
-#include "scoped_gdi.hxx"
 
 #include 
 #include 
@@ -33,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index f5e2c025e965..ebaf2f1be2d6 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -35,10 +35,10 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
-#include "scoped_gdi.hxx"
 
 #include 
 #include 
commit cc2dbc14354b937ade02049ec69b07170bde765f
Author: Matteo Casalin 
AuthorDate: Sun Dec 30 15:54:08 2018 +0100
Commit: Matteo Casalin 
CommitDate: Sun Jan 13 11:05:56 2019 +0100

Avoid getToken index for single call

Change-Id: Ibefd5b0737de7d29a47bab0709ed96901a5e028e
Reviewed-on: https://gerrit.libreoffice.org/66227
Tested-by: Jenkins
Reviewed-by: Matteo Casalin 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a0d79ac26554..1361782d9002 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2813,8 +2813,7 @@ static OUString lcl_ExctractVariableAndHint( const 
OUString& rCommand, OUString&
 ++nIndex;
 OUString sShortCommand( rCommand.copy( nIndex ) ); //cut off the " ASK "
 
-nIndex = 0;
-sShortCommand = sShortCommand.getToken( 0, '\\', nIndex);
+sShortCommand = sShortCommand.getToken(0, '\\');
 nIndex = 0;
 OUString sRet = sShortCommand.getToken( 0, ' ', nIndex);
 if( nIndex > 0)
@@ -3813,8 +3812,7 @@ void DomainMapper_Impl::handleToc
 //  \t  Builds a table of contents by using style names other 
than the standard outline styles
 if( lcl_FindInCommand( pContext->GetCommand(), 't', sValue ))
 {
-sal_Int32 nPos = 0;
-OUString sToken = sValue.getToken( 1, '"', nPos);
+OUString sToken = sValue.getToken(1, '"');
 sTemplate = sToken.isEmpty() ? sValue : sToken;
 }
 //  \u  Builds a table of contents by using the applied 
paragraph outline level
@@ -4339,12 +4337,9 @@ void DomainMapper_Impl::CloseFieldCommand()
 }
 break;
 case FIELD_FILLIN   :
-{
-sal_Int32 nIndex = 0;
 if (xFieldProperties.is())
 xFieldProperties->setPropertyValue(
-getPropertyName(PROP_HINT), uno::makeAny( 
pContext->GetCommand().getToken( 1, '\"', nIndex)));
-}
+getPropertyName(PROP_HINT), uno::makeAny( 
pContext->GetCommand().getToken(1, '\"')));
 break;
 case FIELD_FILENAME:
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-04 Thread Khaled Hosny
 vcl/inc/win/winlayout.hxx |   12 +++-
 vcl/win/gdi/winlayout.cxx |   39 +--
 2 files changed, 20 insertions(+), 31 deletions(-)

New commits:
commit 7453cb58df4ce434a1252567f961cfe497064aca
Author: Khaled Hosny 
Date:   Sat Mar 4 05:40:39 2017 +0200

pPos and pGetNextGlypInfo always have the same value

Change-Id: Iec46e0aefff71cbeb2face4f55e5c3a4d6698995

diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 2c6cc26..bc1890b 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -179,8 +179,7 @@ public:
 
 virtual bool operator ()(CommonSalLayout const ,
 SalGraphics ,
-HDC hDC,
-Point* pPos, int* pGetNextGlypInfo) = 0;
+HDC hDC) = 0;
 };
 
 class ExTextOutRenderer : public TextOutRenderer
@@ -193,8 +192,7 @@ public:
 
 bool operator ()(CommonSalLayout const ,
 SalGraphics ,
-HDC hDC,
-Point* pPos, int* pGetNextGlypInfo) override;
+HDC hDC) override;
 };
 
 class D2DWriteTextOutRenderer : public TextOutRenderer
@@ -217,8 +215,7 @@ public:
 
 bool operator ()(CommonSalLayout const ,
 SalGraphics ,
-HDC hDC,
-Point* pPos, int* pGetNextGlypInfo) override;
+HDC hDC) override;
 
 inline bool BindDC(HDC hDC, Rectangle const & rRect = Rectangle(0, 0, 0, 
0)) {
 RECT const rc = { rRect.Left(), rRect.Top(), rRect.Right(), 
rRect.Bottom() };
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 21116d3..cf555de 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -264,10 +264,8 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
 
 bool ExTextOutRenderer::operator ()(CommonSalLayout const ,
 SalGraphics & /*rGraphics*/,
-HDC hDC,
-Point* pPos, int* pGetNextGlypInfo)
+HDC hDC)
 {
-const GlyphItem* pGlyph;
 HFONT hFont = static_cast(GetCurrentObject( hDC, OBJ_FONT ));
 HFONT hAltFont = nullptr;
 bool bUseAltFont = false;
@@ -282,7 +280,11 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 hAltFont = CreateFontIndirectW();
 }
 }
-while (rLayout.GetNextGlyphs(1, , *pPos, *pGetNextGlypInfo))
+
+int nStart = 0;
+Point aPos(0, 0);
+const GlyphItem* pGlyph;
+while (rLayout.GetNextGlyphs(1, , aPos, nStart))
 {
 WORD glyphWStr[] = { pGlyph->maGlyphId };
 if (hAltFont && pGlyph->IsVertical() == bUseAltFont)
@@ -290,7 +292,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
,
 bUseAltFont = !bUseAltFont;
 SelectFont(hDC, bUseAltFont ? hAltFont : hFont);
 }
-ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(), 1, nullptr);
+ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(), 1, nullptr);
 }
 if (hAltFont)
 {
@@ -340,8 +342,7 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
 
 bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const ,
 SalGraphics ,
-HDC hDC,
-Point* pPos, int* pGetNextGlypInfo)
+HDC hDC)
 {
 if (!Ready())
 return false;
@@ -349,7 +350,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const ,
 if (!BindFont(hDC))
 {
 // If for any reason we can't bind fallback to legacy APIs.
-return ExTextOutRenderer()(rLayout, rGraphics, hDC, pPos, 
pGetNextGlypInfo);
+return ExTextOutRenderer()(rLayout, rGraphics, hDC);
 }
 
 Rectangle bounds;
@@ -365,13 +366,15 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const ,
 {
 mpRT->BeginDraw();
 
+int nStart = 0;
+Point aPos(0, 0);
 const GlyphItem* pGlyph;
-while (rLayout.GetNextGlyphs(1, , *pPos, *pGetNextGlypInfo))
+while (rLayout.GetNextGlyphs(1, , aPos, nStart))
 {
 UINT16 glyphIndices[] = { pGlyph->maGlyphId };
 FLOAT glyphAdvances[] = { pGlyph->mnNewWidth };
 DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
-D2D1_POINT_2F baseline = { pPos->X() - bounds.Left(), pPos->Y() - 
bounds.Top() };
+D2D1_POINT_2F baseline = { aPos.X() - bounds.Left(), aPos.Y() - 
bounds.Top() };
 DWRITE_GLYPH_RUN glyphs = {
 mpFontFace,
 mlfEmHeight,
@@ -600,10 +603,8 @@ bool WinSalGraphics::DrawCachedGlyphs(const 
CommonSalLayout& rLayout)
 
 void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, 
bool bUseDWrite)
 {
-Point aPos(0, 0);
-int nGlyphCount(0);
 TextOutRenderer  = TextOutRenderer::get(bUseDWrite);
-bool result = render(rLayout, *this, hDC, , );
+bool result = render(rLayout, *this, hDC);
 assert(result);
 }
 
commit 073d920ef5914b5dfe491dbaf7fb18ba56293b85
Author: Khaled Hosny 
Date:   Sat Mar 4 05:29:38 2017 +0200

pEraseRect is 

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

2016-10-30 Thread Khaled Hosny
 vcl/inc/win/winlayout.hxx |2 +-
 vcl/win/gdi/winlayout.cxx |   16 
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 4b4abb73fcd7f2802e73102b3e7c30face8d309c
Author: Khaled Hosny 
Date:   Mon Oct 31 04:46:34 2016 +0200

Avoid excessive text clipping on Windows

Use a better rounding strategy so that when the bounding box involves
part of a pixel we include the full pixel, so floor for -ve values and
ceil for +ve ones.  Without this I see lots of cut text on Windows.

Change-Id: I258f63eb37911574cd3f6f08da22349756c0775c

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 50f6602..5655785 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3611,10 +3611,10 @@ std::vector 
D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid
bottom = INT32(m.advanceHeight) - m.verticalOriginY - 
m.bottomSideBearing;
 
 // Scale to screen space.
-pOut->Left()   = std::lround(left * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
-pOut->Top()= std::lround(top * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
-pOut->Right()  = std::lround(right * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
-pOut->Bottom() = std::lround(bottom * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
+pOut->Left()   = std::floor(left * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
+pOut->Top()= std::floor(top * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
+pOut->Right()  = std::ceil(right * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
+pOut->Bottom() = std::ceil(bottom * mlfEmHeight / 
aFontMetrics.designUnitsPerEm);
 
 ++pOut;
 }
commit ebe3fd529195ae1edf5daeab197bbb3cfec4143c
Author: Khaled Hosny 
Date:   Mon Oct 31 04:37:25 2016 +0200

Reduce number of arguments

The font is already a member of the class, and the EM height is unused.

Change-Id: Ice2eb2bb3e4b491bcb93123e1c3a08170cdaa50b

diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 04fc135..c025351 100755
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -501,7 +501,7 @@ private:
 D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = 
delete;
 
 bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * 
lfSize) const;
-bool GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLayout const 
, float const lfEmHeight, Rectangle &) const;
+bool GetDWriteInkBox(SalLayout const , Rectangle &) const;
 
 ID2D1Factory* mpD2DFactory;
 IDWriteFactory  * mpDWriteFactory;
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 658641e..50f6602 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3455,7 +3455,7 @@ bool D2DWriteTextOutRenderer::operator ()(SalLayout const 
, HDC hDC,
 }
 
 Rectangle bounds;
-bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, 
bounds);
+bool succeeded = GetDWriteInkBox(rLayout, bounds);
 succeeded &= BindDC(hDC, bounds);   // Update the bounding rect.
 
 ID2D1SolidColorBrush* pBrush = nullptr;
@@ -3652,12 +3652,12 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC 
hDC, IDWriteFontFace ** p
 return succeeded;
 }
 
-bool D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, 
SalLayout const , float const /*lfEmHeight*/, Rectangle & rOut) const
+bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout const , 
Rectangle & rOut) const
 {
 rOut.SetEmpty();
 
 DWRITE_FONT_METRICS aFontMetrics;
-rFontFace.GetMetrics();
+mpFontFace->GetMetrics();
 
 Point aPos;
 sal_GlyphId nLGlyph;
@@ -3685,7 +3685,7 @@ bool 
D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLa
 if (bVertical)
 {
 DWRITE_FONT_METRICS aFM;
-rFontFace.GetMetrics();
+mpFontFace->GetMetrics();
 nYDiff = (aFM.ascent - aFM.descent) * mlfEmHeight / 
aFM.designUnitsPerEm;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-03-19 Thread Jan Holesovsky
 vcl/inc/win/salgdi.h |3 +++
 vcl/win/source/gdi/salgdi.cxx|3 ++-
 vcl/win/source/gdi/salnativewidgets-luna.cxx |   10 ++
 3 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 5b0f3cf836054da94968eddffc2647b50236739e
Author: Jan Holesovsky ke...@collabora.com
Date:   Thu Mar 19 20:24:07 2015 +0100

opengl dr.memory: DC that contains selected object being deleted.

Change-Id: I3cfb09eacfa129a92dace47fd26ccf6e5d1a6756

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 287daf4..e956e0f 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -155,6 +155,9 @@ private:
 /// DIBSection that we use for the GDI drawing, and later obtain.
 HBITMAP mhBitmap;
 
+/// Return the previous bitmap to undo the SelectObject.
+HBITMAP mhOrigBitmap;
+
 /// DIBSection data.
 sal_uInt32 *mpData;
 
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index fc74d05..ff74b0f 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -582,13 +582,14 @@ OpenGLCompatibleDC::OpenGLCompatibleDC(SalGraphics 
rGraphics, int x, int y, int
 
 mhBitmap = WinSalVirtualDevice::ImplCreateVirDevBitmap(mhCompatibleDC, 
width, height, 32, reinterpret_castvoid **(mpData));
 
-SelectObject(mhCompatibleDC, mhBitmap);
+mhOrigBitmap = (HBITMAP) SelectObject(mhCompatibleDC, mhBitmap);
 }
 
 OpenGLCompatibleDC::~OpenGLCompatibleDC()
 {
 if (mpImpl)
 {
+SelectObject(mhCompatibleDC, mhOrigBitmap);
 DeleteObject(mhBitmap);
 DeleteDC(mhCompatibleDC);
 }
commit a175977e1eb7fe63b2314dcfb3944e87889af455
Author: Jan Holesovsky ke...@collabora.com
Date:   Thu Mar 19 20:11:31 2015 +0100

dr.memory: Deleting a drawing object that is selected into DC.

Change-Id: I2b04152896cdd231cc9be4ab008bc57a65c840da

diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx 
b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 9b690db..aedbf89 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -475,12 +475,13 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 
 // and a darker horizontal line under that
 HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xb0, 0xb0, 0xb0 ) );
-SelectObject( hDC, hpen );
+HPEN hOrigPen = (HPEN) SelectObject(hDC, hpen);
 
 MoveToEx( hDC, rc.left, gradient_bottom, NULL );
 LineTo( hDC, rc.right, gradient_bottom );
 
-DeleteObject( hpen );
+SelectObject(hDC, hOrigPen);
+DeleteObject(hpen);
 }
 else
 {
@@ -500,12 +501,13 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool 
bHorizontal )
 from_y = to_y = rc.top;
 
 HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xb0, 0xb0, 0xb0 ) );
-SelectObject( hDC, hpen );
+HPEN hOrigPen = (HPEN) SelectObject(hDC, hpen);
 
 MoveToEx( hDC, from_x, from_y, NULL );
 LineTo( hDC, to_x, to_y );
 
-DeleteObject( hpen );
+SelectObject(hDC, hOrigPen);
+DeleteObject(hpen);
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits