[Libreoffice-commits] core.git: vcl/win
Tor Lillqvist
tml at collabora.com
Thu Dec 17 05:29:11 PST 2015
vcl/win/gdi/winlayout.cxx | 14 ++++++++++----
vcl/win/gdi/winlayout.hxx | 6 +++---
2 files changed, 13 insertions(+), 7 deletions(-)
New commits:
commit b7842c93dc06b831d3fa649410ed847358ce9d17
Author: Tor Lillqvist <tml at collabora.com>
Date: Thu Dec 17 15:14:49 2015 +0200
tdf#95648: Erase the OpenGLCompatibleDC to white before drawing text into it
For some reason this is needed in the case of GraphiteWinLayout and
OpenGL. Otherwise when a space glyph is "drawn" into a space that is
wider than the nominal width of the space glyph, we get two black
rectangles surrounding the white space "glyph".
Change-Id: Ifb4ea00d9e5f078518ac97d7dd18694088aa1cdf
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 0bed284..a1cdf14 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -566,7 +566,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
if (!mbUseOpenGL)
{
// no OpenGL, just classic rendering
- DrawTextImpl(hDC);
+ DrawTextImpl(hDC, NULL);
}
else if (CacheGlyphs(rGraphics) &&
DrawCachedGlyphs(rGraphics))
@@ -623,7 +623,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
SetTextAlign(aDC.getCompatibleHDC(), nTextAlign);
// the actual drawing
- DrawTextImpl(aDC.getCompatibleHDC());
+ DrawTextImpl(aDC.getCompatibleHDC(), &aRect);
COLORREF color = GetTextColor(hDC);
SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color));
@@ -1764,7 +1764,7 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
}
}
-void UniscribeLayout::DrawTextImpl(HDC hDC) const
+void UniscribeLayout::DrawTextImpl(HDC hDC, const Rectangle* /* pRectToErase */) const
{
HFONT hOrigFont = DisableFontScaling();
@@ -2801,8 +2801,14 @@ void GraphiteWinLayout::AdjustLayout(ImplLayoutArgs& rArgs)
maImpl.AdjustLayout(rArgs);
}
-void GraphiteWinLayout::DrawTextImpl(HDC hDC) const
+void GraphiteWinLayout::DrawTextImpl(HDC hDC, const Rectangle* pRectToErase) const
{
+ if (pRectToErase)
+ {
+ RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), pRectToErase->Left()+pRectToErase->GetWidth(), pRectToErase->Top()+pRectToErase->GetHeight() };
+ FillRect(hDC, &aRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
+ }
+
HFONT hOrigFont = DisableFontScaling();
maImpl.DrawBase() = WinLayout::maDrawBase;
maImpl.DrawOffset() = WinLayout::maDrawOffset;
diff --git a/vcl/win/gdi/winlayout.hxx b/vcl/win/gdi/winlayout.hxx
index 545d267..db09d1e 100644
--- a/vcl/win/gdi/winlayout.hxx
+++ b/vcl/win/gdi/winlayout.hxx
@@ -53,7 +53,7 @@ public:
virtual void DrawText(SalGraphics&) const override;
/// Draw to the provided HDC.
- virtual void DrawTextImpl(HDC hDC) const = 0;
+ virtual void DrawTextImpl(HDC hDC, const Rectangle* pRectToErase) const = 0;
virtual bool CacheGlyphs(SalGraphics& rGraphics) const = 0;
virtual bool DrawCachedGlyphs(SalGraphics& rGraphics) const = 0;
@@ -75,7 +75,7 @@ public:
virtual bool LayoutText( ImplLayoutArgs& ) override;
virtual void AdjustLayout( ImplLayoutArgs& ) override;
- virtual void DrawTextImpl(HDC hDC) const override;
+ virtual void DrawTextImpl(HDC hDC, const Rectangle* pRectToErase) const override;
virtual bool CacheGlyphs(SalGraphics& rGraphics) const override;
virtual bool DrawCachedGlyphs(SalGraphics& rGraphics) const override;
virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
@@ -168,7 +168,7 @@ public:
// used by upper layers
virtual bool LayoutText( ImplLayoutArgs& ) override; // first step of layout
virtual void AdjustLayout( ImplLayoutArgs& ) override; // adjusting after fallback etc.
- virtual void DrawTextImpl(HDC hDC) const override;
+ virtual void DrawTextImpl(HDC hDC, const Rectangle* pRectToErase) const override;
virtual bool CacheGlyphs(SalGraphics& rGraphics) const override;
virtual bool DrawCachedGlyphs(SalGraphics& rGraphics) const override;
More information about the Libreoffice-commits
mailing list