diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-12-17 15:14:49 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2015-12-17 15:19:20 +0200 |
commit | b7842c93dc06b831d3fa649410ed847358ce9d17 (patch) | |
tree | 71d8504749b1f30d5bb56c48ae846b37d5eb1700 | |
parent | dc3eb865bd10e690dbf80f41277b062ac2253572 (diff) |
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
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 14 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.hxx | 6 |
2 files changed, 13 insertions, 7 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 0bed284726e7..a1cdf14899d8 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 545d26735907..db09d1eda308 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; |