Kaydet (Commit) b7842c93 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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
üst dc3eb865
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment