mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
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:
parent
ec63398042
commit
2002d74b78
38 changed files with 465 additions and 371 deletions
|
|
@ -206,8 +206,10 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
mDim = getHeight();
|
||||
else
|
||||
mDim = getWidth();
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
if(mNumberOfBitmaps == 1)
|
||||
{
|
||||
|
|
@ -218,14 +220,14 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
//drawing stretch bitmap
|
||||
RectI progressRect = ctrlRect;
|
||||
progressRect.extent.x = width;
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[0]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[0]);
|
||||
}
|
||||
}
|
||||
else if(mNumberOfBitmaps >= 3)
|
||||
{
|
||||
//drawing left-end bitmap
|
||||
RectI progressRectLeft(ctrlRect.point.x, ctrlRect.point.y, mDim, mDim);
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRectLeft, mProfile->mBitmapArrayRects[0]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRectLeft, mProfile->mBitmapArrayRects[0]);
|
||||
|
||||
//draw the progress with image
|
||||
S32 width = (S32)((F32)(getWidth()) * mProgress);
|
||||
|
|
@ -237,11 +239,11 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
progressRect.extent.x = (width - mDim - mDim);
|
||||
if (progressRect.extent.x < 0)
|
||||
progressRect.extent.x = 0;
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[1]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[1]);
|
||||
|
||||
//drawing right-end bitmap
|
||||
RectI progressRectRight(progressRect.point.x + progressRect.extent.x, ctrlRect.point.y, mDim, mDim );
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRectRight, mProfile->mBitmapArrayRects[2]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRectRight, mProfile->mBitmapArrayRects[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -249,7 +251,7 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
//if there's a border, draw it
|
||||
if (mProfile->mBorder)
|
||||
GFX->getDrawUtil()->drawRect(ctrlRect, mProfile->mBorderColor);
|
||||
drawUtil->drawRect(ctrlRect, mProfile->mBorderColor);
|
||||
|
||||
Parent::onRender( offset, updateRect );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue