use of get<some name> methods that already return nulls/false when attempting to load

in contexts where we would want to try first
This commit is contained in:
AzaezelX 2025-05-27 17:07:08 -05:00
parent a43458677a
commit 40974dd14b
11 changed files with 31 additions and 31 deletions

View file

@ -296,7 +296,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
RectI iconRect( 0, 0, 0, 0 );
// Render the icon
if ( mBitmapAsset.notNull() && mIconLocation != GuiIconButtonCtrl::IconLocNone)
if ( getBitmap() && mIconLocation != GuiIconButtonCtrl::IconLocNone)
{
// Render the normal bitmap
drawer->clearBitmapModulation();

View file

@ -88,7 +88,7 @@ void GuiToolboxButtonCtrl::inspectPostApply()
// set it's extent to be exactly the size of the normal bitmap (if present)
Parent::inspectPostApply();
if ((getWidth() == 0) && (getHeight() == 0) && mNormalBitmapAsset.notNull())
if ((getWidth() == 0) && (getHeight() == 0) && getNormalBitmap())
{
setExtent(getNormalBitmap()->getWidth(), getNormalBitmap()->getHeight());
}
@ -142,7 +142,7 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
}
// Now render the image
if( mNormalBitmapAsset.notNull() )
if(getNormalBitmap())
{
renderButton(getNormalBitmap(), offset, updateRect );
return;

View file

@ -101,7 +101,7 @@ void GuiBitmapCtrl::inspectPostApply()
// set it's extent to be exactly the size of the bitmap (if present)
Parent::inspectPostApply();
if (!mWrap && (getExtent().x == 0) && (getExtent().y == 0) && mBitmapAsset.notNull())
if (!mWrap && (getExtent().x == 0) && (getExtent().y == 0) && getBitmap())
{
setExtent(mBitmap->getWidth(), mBitmap->getHeight());
}
@ -126,7 +126,7 @@ void GuiBitmapCtrl::setBitmap(const char* name, bool resize)
mBitmap = mBitmapAsset->getTexture(&GFXDefaultGUIProfile);
if (mBitmapAsset.notNull() && resize)
if (getBitmap() && resize)
{
setExtent(mBitmap->getWidth(), mBitmap->getHeight());
@ -212,7 +212,7 @@ void GuiBitmapCtrl::onRender(Point2I offset, const RectI& updateRect)
void GuiBitmapCtrl::setValue(S32 x, S32 y)
{
if (mBitmapAsset.notNull())
if (getBitmap())
{
x += mBitmapAsset->getTextureBitmapWidth() / 2;
y += mBitmapAsset->getTextureBitmapHeight() / 2;

View file

@ -184,7 +184,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
bool arrowOnR = (isSelected() || isHighlighted()) && (mWrapOptions || (mSelectedOption < mOptions.size() - 1));
if (arrowOnL)
{
if (mPreviousBitmapAsset.notNull())
if (getPreviousBitmap())
{
arrowOffset.x = currentOffset.x + mColumnSplit;
arrowOffset.y = currentOffset.y + arrowOffsetY;
@ -205,7 +205,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
}
if (arrowOnR)
{
if (mNextBitmapAsset.notNull())
if (getNextBitmap())
{
arrowOffset.x = currentOffset.x + getWidth() - mRightPad - mArrowSize;
arrowOffset.y = currentOffset.y + arrowOffsetY;
@ -369,7 +369,7 @@ void GuiGameSettingsCtrl::onRenderKeybindOption(Point2I currentOffset)
buttonSize.x = height;
buttonSize.y = height;
if (mKeybindBitmapAsset.notNull())
if (getKeybindBitmap())
{
RectI rect(button, buttonSize);
drawer->clearBitmapModulation();

View file

@ -891,13 +891,13 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
// Draw a bitmap over the background?
if ( mBitmapAsset[Depressed].notNull() )
if (getBitmap(Depressed))
{
RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( getBitmap(Depressed), rect );
}
else if ( mBitmapAsset[Normal].notNull() )
else if (getBitmap(Normal))
{
RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation();
@ -941,7 +941,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
// Draw a bitmap over the background?
if ( mBitmapAsset[Normal].notNull() )
if (getBitmap(Normal))
{
RectI rect( offset, mBitmapBounds );
drawUtil->clearBitmapModulation();
@ -977,7 +977,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
// Draw a bitmap over the background?
if (mBitmapAsset[Normal].notNull())
if (getBitmap(Normal))
{
RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation();

View file

@ -1090,13 +1090,13 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
// Draw a bitmap over the background?
if ( mBitmapAsset[Depressed].notNull() )
if (getBitmap(Depressed))
{
RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch(getBitmap(Depressed), rect );
}
else if (mBitmapAsset[Normal].notNull())
else if (getBitmap(Normal))
{
RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation();
@ -1134,7 +1134,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
// Draw a bitmap over the background?
if (mBitmapAsset[Normal].notNull())
if (getBitmap(Normal))
{
RectI rect( offset, mBitmapBounds );
drawUtil->clearBitmapModulation();
@ -1164,7 +1164,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
// Draw a bitmap over the background?
if (mBitmapAsset[Normal].notNull())
if (getBitmap(Normal))
{
RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation();

View file

@ -112,7 +112,7 @@ void GuiCursor::onRemove()
void GuiCursor::render(const Point2I &pos)
{
if (mBitmapAsset.notNull())
if (getBitmap())
{
mExtent.set(getBitmap()->getWidth(), getBitmap()->getHeight());
}

View file

@ -155,7 +155,7 @@ void GuiChunkedBitmapCtrl::renderRegion(const Point2I &offset, const Point2I &ex
void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
{
if( mBitmapAsset.notNull() )
if(getBitmap())
{
RectI boundsRect( offset, getExtent());
GFX->getDrawUtil()->drawBitmapStretch(getBitmap(), boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear);