refactor to avoid shadowvars

This commit is contained in:
Azaezel 2018-03-15 00:52:03 -05:00
parent 25920aeee9
commit a0eebd01c8
2 changed files with 16 additions and 16 deletions

View file

@ -1210,9 +1210,9 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
if ( drawbox )
{
Point2I coloredboxsize( 15, 10 );
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
drawUtil->drawRectFill( r, boxColor);
drawUtil->drawRect( r, ColorI(0,0,0));
RectI boxBounds( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
drawUtil->drawRectFill(boxBounds, boxColor);
drawUtil->drawRect(boxBounds, ColorI(0,0,0));
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
}
@ -1236,18 +1236,18 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// Draw the second column to the right
getColumn( mText, buff, 1, "\t" );
S32 txt_w = mProfile->mFont->getStrWidth( buff );
S32 colTxt_w = mProfile->mFont->getStrWidth( buff );
if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() )
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - bitmapBounds[2].extent.x, localStart.y ) );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else
{
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - 12, localStart.y ) );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
}

View file

@ -168,7 +168,7 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
F32 Scale = F32( getExtent().y ) / F32( mGraphMax[ k ] * 1.05 );
const S32 numSamples = mGraphData[ k ].size();
F32 graphOffset;
switch( mGraphType[ k ] )
{
case Bar:
@ -180,21 +180,21 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
PrimBuild::begin( GFXTriangleStrip, 4 );
PrimBuild::color( mGraphColor[ k ] );
F32 offset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 );
graphOffset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 );
PrimBuild::vertex2f( globalPos.x + prevOffset,
midPointY - ( getDatum( k, sample ) * Scale ) );
PrimBuild::vertex2f( globalPos.x + offset,
PrimBuild::vertex2f( globalPos.x + graphOffset,
midPointY - ( getDatum( k, sample ) * Scale ) );
PrimBuild::vertex2f( globalPos.x + offset,
PrimBuild::vertex2f( globalPos.x + graphOffset,
midPointY );
PrimBuild::vertex2f( globalPos.x + prevOffset,
midPointY );
prevOffset = offset;
prevOffset = graphOffset;
PrimBuild::end();
}
@ -209,12 +209,12 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
for( S32 sample = 0; sample < numSamples; ++ sample )
{
F32 offset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample );
graphOffset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample );
PrimBuild::vertex2f( globalPos.x + offset,
PrimBuild::vertex2f( globalPos.x + graphOffset,
midPointY );
PrimBuild::vertex2f( globalPos.x + offset,
PrimBuild::vertex2f( globalPos.x + graphOffset,
midPointY - ( getDatum( k, sample ) * Scale ) );
}
@ -234,9 +234,9 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
for( S32 sample = 0; sample < numSamples; ++ sample )
{
F32 offset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample );
graphOffset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample );
PrimBuild::vertex2f( globalPos.x + offset,
PrimBuild::vertex2f( globalPos.x + graphOffset,
midPointY - ( getDatum( k, sample ) * Scale ) );
}