Fix possible usage of uninitialized variable in wxQt wxDC code
Make sure rasterColourOp is always initialized, even if none of the switch cases matches, to avoid warnings about possibly uninitialized variable. See https://github.com/wxWidgets/wxWidgets/pull/1048
This commit is contained in:
committed by
Vadim Zeitlin
parent
194936ab26
commit
82a66e56b2
@@ -220,7 +220,7 @@ void wxQtDCImpl::SetLogicalFunction(wxRasterOperationMode function)
|
||||
{
|
||||
m_logicalFunction = function;
|
||||
|
||||
wxQtRasterColourOp rasterColourOp;
|
||||
wxQtRasterColourOp rasterColourOp = wxQtNONE;
|
||||
switch ( function )
|
||||
{
|
||||
case wxCLEAR: // 0
|
||||
@@ -229,7 +229,6 @@ void wxQtDCImpl::SetLogicalFunction(wxRasterOperationMode function)
|
||||
break;
|
||||
case wxXOR: // src XOR dst
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_SourceXorDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxINVERT: // NOT dst => dst XOR WHITE
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_SourceXorDestination );
|
||||
@@ -241,35 +240,27 @@ void wxQtDCImpl::SetLogicalFunction(wxRasterOperationMode function)
|
||||
break;
|
||||
case wxAND_REVERSE: // src AND (NOT dst)
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_SourceAndNotDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxCOPY: // src
|
||||
m_qtPainter->setCompositionMode( QPainter::CompositionMode_SourceOver );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxAND: // src AND dst
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_SourceAndDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxAND_INVERT: // (NOT src) AND dst
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_NotSourceAndDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxNO_OP: // dst
|
||||
m_qtPainter->setCompositionMode( QPainter::CompositionMode_DestinationOver );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxNOR: // (NOT src) AND (NOT dst)
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_NotSourceAndNotDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxEQUIV: // (NOT src) XOR dst
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_NotSourceXorDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxSRC_INVERT: // (NOT src)
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_NotSource );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxOR_INVERT: // (NOT src) OR dst
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_SourceOrDestination );
|
||||
@@ -277,11 +268,9 @@ void wxQtDCImpl::SetLogicalFunction(wxRasterOperationMode function)
|
||||
break;
|
||||
case wxNAND: // (NOT src) OR (NOT dst)
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_NotSourceOrNotDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxOR: // src OR dst
|
||||
m_qtPainter->setCompositionMode( QPainter::RasterOp_SourceOrDestination );
|
||||
rasterColourOp = wxQtNONE;
|
||||
break;
|
||||
case wxSET: // 1
|
||||
m_qtPainter->setCompositionMode( QPainter::CompositionMode_SourceOver );
|
||||
|
Reference in New Issue
Block a user