mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-28 19:13:47 +00:00
Issue found with PVS-Studio:
A lot of instances where some function args are not actually modified in any way, meaning that it is better for performance to convert them into const references. This prevents an additional copy, which can help performance.
This commit is contained in:
parent
ec63398042
commit
11398bb04e
40 changed files with 59 additions and 59 deletions
|
|
@ -91,7 +91,7 @@ class GuiContainer : public GuiControl
|
|||
inline void setAnchorRight(bool val) { mSizingOptions.mAnchorRight = val; }
|
||||
|
||||
ControlSizing getSizingOptions() const { return mSizingOptions; }
|
||||
void setSizingOptions(ControlSizing val) { mSizingOptions = val; }
|
||||
void setSizingOptions(const ControlSizing& val) { mSizingOptions = val; }
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ bool GuiSplitContainer::layoutControls( RectI &clientRect )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiSplitContainer::solvePanelConstraints( Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, RectI clientRect )
|
||||
void GuiSplitContainer::solvePanelConstraints(Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, const RectI& clientRect)
|
||||
{
|
||||
if( !firstPanel || !secondPanel )
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public:
|
|||
virtual inline Point2I getSplitPoint() { return mSplitPoint; };
|
||||
/// The Splitters entire Client Rectangle, this takes into account padding of this control
|
||||
virtual inline RectI getSplitRect() { return mSplitRect; };
|
||||
virtual void solvePanelConstraints( Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, RectI clientRect );
|
||||
virtual void solvePanelConstraints(Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, const RectI& clientRect);
|
||||
virtual Point2I getMinExtent() const;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ void GuiTabBookCtrl::renderTabs( const Point2I &offset, const RectI &tabRect )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiTabBookCtrl::renderTab( RectI tabRect, GuiTabPageCtrl *tab )
|
||||
void GuiTabBookCtrl::renderTab(const RectI& tabRect, GuiTabPageCtrl *tab)
|
||||
{
|
||||
StringTableEntry text = tab->getText();
|
||||
ColorI oldColor;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class GuiTabBookCtrl : public GuiContainer
|
|||
/// Tab rendering subroutine, renders one tab with specified options
|
||||
/// @param tabRect the rectangle to render the tab into
|
||||
/// @param tab pointer to the tab page control for which to render the tab
|
||||
void renderTab( RectI tabRect, GuiTabPageCtrl* tab );
|
||||
void renderTab(const RectI& tabRect, GuiTabPageCtrl* tab);
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ void GuiGradientCtrl::reInitSwatches( GuiGradientCtrl::PickMode )
|
|||
}
|
||||
}
|
||||
|
||||
void GuiGradientCtrl::addColorRange( Point2I pos, ColorF color )
|
||||
void GuiGradientCtrl::addColorRange(Point2I pos, const ColorF& color)
|
||||
{
|
||||
if( pos.x + mSwatchFactor < mBlendRangeBox.point.x &&
|
||||
pos.x + mSwatchFactor > mBlendRangeBox.extent.x )
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public:
|
|||
void inspectPreApply();
|
||||
void inspectPostApply();
|
||||
void reInitSwatches( GuiGradientCtrl::PickMode );
|
||||
void addColorRange( Point2I pos, ColorF color );
|
||||
void addColorRange(Point2I pos, const ColorF& color);
|
||||
void removeColorRange( GuiGradientSwatchCtrl* swatch );
|
||||
void sortColorRange();
|
||||
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, ColorF color
|
|||
object->setItemColor( index, color );
|
||||
}
|
||||
|
||||
void GuiListBoxCtrl::setItemColor( S32 index, ColorF color )
|
||||
void GuiListBoxCtrl::setItemColor(S32 index, const ColorF& color)
|
||||
{
|
||||
if ((index >= mItems.size()) || index < 0)
|
||||
{
|
||||
|
|
@ -1090,7 +1090,7 @@ void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
GFX->setClipRect( oldClipRect );
|
||||
}
|
||||
|
||||
void GuiListBoxCtrl::onRenderItem( RectI itemRect, LBItem *item )
|
||||
void GuiListBoxCtrl::onRenderItem(const RectI& itemRect, LBItem *item)
|
||||
{
|
||||
if( item->isSelected )
|
||||
GFX->getDrawUtil()->drawRectFill( itemRect, mProfile->mFillColorSEL );
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public:
|
|||
S32 insertItemWithColor( S32 index, StringTableEntry text, ColorF color = ColorF(-1, -1, -1), void *itemData = NULL);
|
||||
S32 findItemText( StringTableEntry text, bool caseSensitive = false );
|
||||
|
||||
void setItemColor(S32 index, ColorF color);
|
||||
void setItemColor(S32 index, const ColorF& color);
|
||||
void clearItemColor(S32 index);
|
||||
|
||||
void deleteItem( S32 index );
|
||||
|
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
// Rendering
|
||||
virtual void onRender( Point2I offset, const RectI &updateRect );
|
||||
virtual void onRenderItem( RectI itemRect, LBItem *item );
|
||||
virtual void onRenderItem(const RectI& itemRect, LBItem *item);
|
||||
void drawBox( const Point2I &box, S32 size, ColorI &outlineColor, ColorI &boxColor );
|
||||
bool renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText );
|
||||
void addFilteredItem( String item );
|
||||
|
|
|
|||
|
|
@ -1623,7 +1623,7 @@ void GuiMenuBar::closeMenu()
|
|||
}
|
||||
|
||||
// Called when a menu item is highlighted by the mouse
|
||||
void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, RectI bounds, Point2I cellSize)
|
||||
void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize)
|
||||
{
|
||||
S32 selstore = selectionIndex;
|
||||
|
||||
|
|
@ -1777,7 +1777,7 @@ void GuiMenuBar::onAction()
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
// Performs an action when a menu item that is a submenu is selected/highlighted
|
||||
void GuiMenuBar::onSubmenuAction(S32 selectionIndex, RectI bounds, Point2I cellSize)
|
||||
void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize)
|
||||
{
|
||||
if(!mouseOverSubmenu)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -182,12 +182,12 @@ public:
|
|||
static void addSubmenuItem(Menu *menu, MenuItem *submenu, MenuItem *newMenuItem );
|
||||
static void removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem);
|
||||
static void clearSubmenuItems(MenuItem *menuitem);
|
||||
void onSubmenuAction(S32 selectionIndex, RectI bounds, Point2I cellSize);
|
||||
void onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize);
|
||||
void closeSubmenu();
|
||||
void checkSubmenuMouseMove(const GuiEvent &event);
|
||||
MenuItem *findHitMenuItem(Point2I mousePoint);
|
||||
|
||||
void highlightedMenuItem(S32 selectionIndex, RectI bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse
|
||||
void highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse
|
||||
|
||||
// display/mouse functions
|
||||
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ void DICreateUndoAction::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void DICreateUndoAction::addDecal( DecalInstance decal )
|
||||
void DICreateUndoAction::addDecal(const DecalInstance& decal)
|
||||
{
|
||||
mDecalInstance = decal;
|
||||
mDatablockId = decal.mDataBlock->getId();
|
||||
|
|
@ -1006,7 +1006,7 @@ void DIDeleteUndoAction::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void DIDeleteUndoAction::deleteDecal( DecalInstance decal )
|
||||
void DIDeleteUndoAction::deleteDecal(const DecalInstance& decal)
|
||||
{
|
||||
mDecalInstance = decal;
|
||||
mDatablockId = decal.mDataBlock->getId();
|
||||
|
|
@ -1094,7 +1094,7 @@ void DBDeleteUndoAction::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void DBDeleteUndoAction::deleteDecal( DecalInstance decal )
|
||||
void DBDeleteUndoAction::deleteDecal(const DecalInstance& decal)
|
||||
{
|
||||
mDecalInstanceVec.increment();
|
||||
mDecalInstanceVec.last() = decal;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
DICreateUndoAction( const UTF8* actionName = "Create Decal " );
|
||||
virtual ~DICreateUndoAction();
|
||||
|
||||
void addDecal( DecalInstance decal );
|
||||
void addDecal(const DecalInstance& decal);
|
||||
|
||||
// UndoAction
|
||||
virtual void undo();
|
||||
|
|
@ -159,7 +159,7 @@ public:
|
|||
virtual ~DIDeleteUndoAction();
|
||||
|
||||
///
|
||||
void deleteDecal( DecalInstance decal );
|
||||
void deleteDecal(const DecalInstance& decal);
|
||||
|
||||
// UndoAction
|
||||
virtual void undo();
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
DBDeleteUndoAction( const UTF8* actionName = "Delete Decal Datablock" );
|
||||
virtual ~DBDeleteUndoAction();
|
||||
|
||||
void deleteDecal( DecalInstance decal );
|
||||
void deleteDecal(const DecalInstance& decal);
|
||||
|
||||
// UndoAction
|
||||
virtual void undo();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue