Always draw text with wxCOPY raster operation mode on wxGCDC

It is said in the wxDC::DrawText() documentation that current logical function is ignored by this function (e928566f). This should apply also to wxGCDC implementation for the sake of consistency and text drawing should be always done with wxCOPY mode regardless of the current mode set.
This commit is contained in:
Artur Wieczorek
2019-12-11 23:20:11 +01:00
parent 09c4033f43
commit 395a30002e

View File

@@ -1196,14 +1196,20 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
if ( str.empty() )
return;
if ( !m_logicalFunctionSupported )
return;
// Text drawing shouldn't be affected by the raster operation
// mode set by SetLogicalFunction() and should be always done
// in the default wxCOPY mode (which is wxCOMPOSITION_OVER
// composition mode).
wxCompositionMode curMode = m_graphicContext->GetCompositionMode();
m_graphicContext->SetCompositionMode(wxCOMPOSITION_OVER);
if ( m_backgroundMode == wxBRUSHSTYLE_TRANSPARENT )
m_graphicContext->DrawText( str, x ,y);
else
m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush(m_textBackgroundColour) );
m_graphicContext->SetCompositionMode(curMode);
wxCoord w, h;
GetOwner()->GetTextExtent(str, &w, &h);
CalcBoundingBox(x, y);