Issue found with PVS-Studio:

Many instances of a function or expression being used repeatedly, which can lower performance.

Fixed it in these cases by creating on local var, reference or pointer that's used instead.
This commit is contained in:
Areloch 2015-07-13 22:51:17 -05:00
parent ec63398042
commit 2002d74b78
38 changed files with 465 additions and 371 deletions

View file

@ -136,6 +136,8 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
{
GFX->setClipRect(updateRect);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
//draw the outline
RectI winRect;
winRect.point = offset;
@ -148,11 +150,11 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
winRect.extent.y -= mBitmapBounds[BorderTop].extent.y + mBitmapBounds[BorderBottom].extent.y;
if(mProfile->mOpaque)
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
mBitmapBounds[BorderTopRight]);
RectI destRect;
@ -162,7 +164,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
destRect.extent.y = mBitmapBounds[BorderTop].extent.y;
RectI stretchRect = mBitmapBounds[BorderTop];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
destRect.point.x = offset.x;
destRect.point.y = offset.y + mBitmapBounds[BorderTopLeft].extent.y;
@ -170,7 +172,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
destRect.extent.y = getHeight() - mBitmapBounds[BorderTopLeft].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
stretchRect = mBitmapBounds[BorderLeft];
stretchRect.inset(0,1);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
@ -179,10 +181,10 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[BorderRight];
stretchRect.inset(0,1);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
drawUtil->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
drawUtil->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].extent.x;
destRect.extent.x = getWidth() - mBitmapBounds[BorderBottomLeft].extent.x - mBitmapBounds[BorderBottomRight].extent.x;
@ -192,6 +194,6 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[BorderBottom];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
}
}

View file

@ -56,6 +56,8 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
{
GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile;
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
F32 xScale = (float) getWidth() / profile->getRowWidth();
bool profileHasIcons = profile->hasArrows();
@ -121,19 +123,19 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
}
// render the row bitmap
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
// render the row icon if it has one
if ((iconIndex != NO_ICON) && profileHasIcons && (! profile->getBitmapArrayRect((U32)iconIndex).extent.isZero()))
{
iconIndex += Profile::TEX_FIRST_ICON;
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
}
// render the row text
GFX->getDrawUtil()->setBitmapModulation(fontColor);
drawUtil->setBitmapModulation(fontColor);
renderJustifiedText(currentOffset + textOffset, textExtent, (*row)->mLabel);
}

View file

@ -249,8 +249,9 @@ bool GuiGradientCtrl::onAdd()
{
Parent::onAdd();
S32 l = getBounds().point.x + mSwatchFactor, r = getBounds().point.x + getBounds().extent.x - mSwatchFactor;
S32 t = getBounds().point.y, b = getBounds().point.y + getBounds().extent.y - mSwatchFactor;
RectI bounds = getBounds();
S32 l = bounds.point.x + mSwatchFactor, r = bounds.point.x + bounds.extent.x - mSwatchFactor;
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - mSwatchFactor;
mBlendRangeBox = RectI( Point2I(l, t), Point2I(r, b) );
setupDefaultRange();
@ -330,16 +331,18 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
// Update local dimensions
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
ColorRange& firstColorRange = colorRange.first();
if(colorRange.size() == 1) // Only one color to draw
{
PrimBuild::begin( GFXTriangleFan, 4 );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i( l, t );
PrimBuild::vertex2i( l, b );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i( r, b );
PrimBuild::vertex2i( r, t );
@ -349,13 +352,13 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
{
PrimBuild::begin( GFXTriangleFan, 4 );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i( l, t );
PrimBuild::vertex2i( l, b );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, b );
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, t );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, b);
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, t);
PrimBuild::end();
@ -377,13 +380,15 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
PrimBuild::end();
}
ColorRange& lastColorRange = colorRange.last();
PrimBuild::begin( GFXTriangleFan, 4 );
PrimBuild::color( colorRange.last().swatch->getColor() );
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, t );
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, b );
PrimBuild::color(lastColorRange.swatch->getColor());
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, t);
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, b);
PrimBuild::color( colorRange.last().swatch->getColor() );
PrimBuild::color(lastColorRange.swatch->getColor());
PrimBuild::vertex2i( r, b );
PrimBuild::vertex2i( r, t );

View file

@ -852,6 +852,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
if ( mScrollDir != GuiScrollCtrl::None )
autoScroll();
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
RectI r( offset, getExtent() );
if ( mInAction )
{
@ -868,30 +870,30 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
else
{
//renderSlightlyLoweredBox(r, mProfile);
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
drawUtil->drawRectFill( r, mProfile->mFillColor );
}
// Draw a bitmap over the background?
if ( mTextureDepressed )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
}
else if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
@ -912,24 +914,24 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect( offset, mBitmapBounds );
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
else
@ -942,21 +944,21 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawRect( r, mProfile->mBorderColorNA );
drawUtil->drawRect( r, mProfile->mBorderColorNA );
}
}
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
@ -1027,8 +1029,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{
Point2I coloredboxsize( 15, 10 );
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
GFX->getDrawUtil()->drawRectFill( r, boxColor);
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
drawUtil->drawRectFill( r, boxColor);
drawUtil->drawRect( r, ColorI(0,0,0));
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
}
@ -1036,7 +1038,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
// Draw the text
Point2I globalStart = localToGlobalCoord( localStart );
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
GFX->getDrawUtil()->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
drawUtil->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
// Get the number of columns in the text
S32 colcount = getColumnCount( mText, "\t" );
@ -1048,7 +1050,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
// Draw the first column
getColumn( mText, buff, 0, "\t" );
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
// Draw the second column to the right
getColumn( mText, buff, 1, "\t" );
@ -1059,17 +1061,17 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
// right cap of the border.
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else
{
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
}
} else
{
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
}
// If we're rendering a bitmap border, then it will take care of the arrow.

View file

@ -1034,6 +1034,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
if ( mScrollDir != GuiScrollCtrl::None )
autoScroll();
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
RectI r( offset, getExtent() );
if ( mInAction )
{
@ -1050,30 +1052,30 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
else
{
//renderSlightlyLoweredBox(r, mProfile);
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
drawUtil->drawRectFill( r, mProfile->mFillColor );
}
// Draw a bitmap over the background?
if ( mTextureDepressed )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
}
else if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
@ -1094,24 +1096,24 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect( offset, mBitmapBounds );
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
else
@ -1124,21 +1126,21 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawRect( r, mProfile->mBorderColorNA );
drawUtil->drawRect( r, mProfile->mBorderColorNA );
}
}
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
@ -1209,8 +1211,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{
Point2I coloredboxsize( 15, 10 );
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
GFX->getDrawUtil()->drawRectFill( r, boxColor);
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
drawUtil->drawRectFill( r, boxColor);
drawUtil->drawRect( r, ColorI(0,0,0));
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
}
@ -1218,7 +1220,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// Draw the text
Point2I globalStart = localToGlobalCoord( localStart );
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
GFX->getDrawUtil()->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
drawUtil->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
// Get the number of columns in the text
S32 colcount = getColumnCount( mText, "\t" );
@ -1230,7 +1232,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// Draw the first column
getColumn( mText, buff, 0, "\t" );
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
// Draw the second column to the right
getColumn( mText, buff, 1, "\t" );
@ -1241,17 +1243,17 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// right cap of the border.
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else
{
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
}
} else
{
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
}
// If we're rendering a bitmap border, then it will take care of the arrow.

View file

@ -363,6 +363,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
Point2I ext(getWidth() - mShiftExtent, getHeight());
RectI thumb = mThumb;
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
if( mHasTexture )
{
if(mTicks > 0)
@ -402,12 +404,12 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
S32 index = SliderButtonNormal;
if(mMouseOver)
index = SliderButtonHighlight;
GFX->getDrawUtil()->clearBitmapModulation();
drawUtil->clearBitmapModulation();
//left border
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]);
drawUtil->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]);
//right border
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]);
drawUtil->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]);
//draw our center piece to our slider control's border and stretch it
@ -421,11 +423,11 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[SliderLineCenter];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
//draw our control slider button
thumb.point += pos;
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject,Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]);
drawUtil->drawBitmapSR(mProfile->mTextureObject,Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]);
}
else if (getWidth() >= getHeight())
@ -490,8 +492,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
else if(textStart.x + txt_w > offset.x+getWidth())
textStart.x -=((textStart.x + txt_w) - (offset.x+getWidth()));
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor);
GFX->getDrawUtil()->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
drawUtil->setBitmapModulation(mProfile->mFontColor);
drawUtil->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
}
renderChildControls(offset, updateRect);
}