Merge pull request #1352 from Areloch/PVS_Cleanup_807

Unnecessarily repeated expressions
This commit is contained in:
Daniel Buckmaster 2015-07-16 15:45:32 +10:00
commit 86e0e67496
38 changed files with 465 additions and 371 deletions

View file

@ -1091,8 +1091,9 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
}
// Render Up Arrow.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[upArrowBitmap] );
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[upArrowBitmap]);
// Update Pos.
pos.y += mBitmapBounds[upArrowBitmap].extent.y;
@ -1118,8 +1119,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
if ( trackRect.extent.y > 0 )
{
// Render Track.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, trackRect, mBitmapBounds[trackBitmap] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(mTextureObject, trackRect, mBitmapBounds[trackBitmap]);
}
// Update Pos.
@ -1137,8 +1138,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
}
// Render Down Arrow.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[downArrowBitmap] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[downArrowBitmap]);
// Render the Thumb?
if ( !mVBarEnabled )
@ -1163,8 +1164,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
}
// Render Thumb Top.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapTop] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapTop]);
// Update Pos.
pos.y += mBitmapBounds[thumbBitmapTop].extent.y;
@ -1179,16 +1180,16 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
if ( thumbRect.extent.y > 0 )
{
// Render Track.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle]);
}
// Update Pos.
pos.y += thumbRect.extent.y;
// Render the Thumb Bottom.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapBottom] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapBottom]);
}
//-----------------------------------------------------------------------------
@ -1215,8 +1216,9 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
}
// Render Up Arrow.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[leftArrowBitmap] );
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[leftArrowBitmap]);
// Update Pos.
pos.x += mBitmapBounds[leftArrowBitmap].extent.x;
@ -1242,8 +1244,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
if ( trackRect.extent.x > 0 )
{
// Render Track.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, trackRect, mBitmapBounds[trackBitmap] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(mTextureObject, trackRect, mBitmapBounds[trackBitmap]);
}
// Update Pos.
@ -1261,8 +1263,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
}
// Render Right Arrow.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[rightArrowBitmap] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[rightArrowBitmap]);
// Render the Thumb?
if ( !mHBarEnabled )
@ -1287,8 +1289,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
}
// Render Thumb Left.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapLeft] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapLeft]);
// Update Pos.
pos.x += mBitmapBounds[thumbBitmapLeft].extent.x;
@ -1303,16 +1305,16 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
if ( thumbRect.extent.x > 0 )
{
// Render Track.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle]);
}
// Update Pos.
pos.x += thumbRect.extent.x;
// Render the Thumb Bottom.
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapRight] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapRight]);
}
//-----------------------------------------------------------------------------

View file

@ -1294,11 +1294,13 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
winRect.extent.x += 1;
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
mBitmapBounds[topBase + 1]);
RectI destRect;
@ -1308,7 +1310,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
destRect.extent.y = mBitmapBounds[topBase + 2].extent.y;
RectI stretchRect = mBitmapBounds[topBase + 2];
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[topBase].extent.y;
@ -1316,7 +1318,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
destRect.extent.y = getHeight() - mBitmapBounds[topBase].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;
@ -1325,10 +1327,10 @@ void GuiWindowCtrl::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;
@ -1338,13 +1340,13 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[BorderBottom];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
// Draw the title
// dhc addition: copied/modded from renderJustifiedText, since we enforce a
// different color usage here. NOTE: it currently CAN overdraw the controls
// if mis-positioned or 'scrunched' in a small width.
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor);
drawUtil->setBitmapModulation(mProfile->mFontColor);
S32 textWidth = mProfile->mFont->getStrWidth((const UTF8 *)mText);
Point2I start(0,0);
@ -1359,7 +1361,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
if( textWidth > winRect.extent.x ) start.set( 0, 0 );
// center the vertical
// start.y = ( winRect.extent.y - ( font->getHeight() - 2 ) ) / 2;
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset + mProfile->mTextOffset, mText );
drawUtil->drawText( mProfile->mFont, start + offset + mProfile->mTextOffset, mText );
// Deal with rendering the titlebar controls
AssertFatal(root, "Unable to get the root GuiCanvas.");
@ -1378,8 +1380,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
bmp += BmpHilite;
}
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
}
// Draw the maximize button
@ -1397,8 +1399,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
bmp += BmpHilite;
}
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
}
// Draw the minimize button
@ -1416,8 +1418,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
bmp += BmpHilite;
}
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
}
if( !mMinimized )

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);
}

View file

@ -465,6 +465,8 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
GFont *font = mTooltipProfile->mFont;
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
// Support for multi-line tooltip text...
Vector<U32> startLineOffsets, lineLengths;
@ -521,12 +523,12 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
GFX->setClipRect( rect );
// Draw Filler bit, then border on top of that
GFX->getDrawUtil()->drawRectFill( rect, mTooltipProfile->mFillColor );
GFX->getDrawUtil()->drawRect( rect, mTooltipProfile->mBorderColor );
drawUtil->drawRectFill( rect, mTooltipProfile->mFillColor );
drawUtil->drawRect( rect, mTooltipProfile->mBorderColor );
// Draw the text centered in the tool tip box...
GFX->getDrawUtil()->setBitmapModulation( mTooltipProfile->mFontColor );
drawUtil->setBitmapModulation( mTooltipProfile->mFontColor );
for ( U32 i = 0; i < lineLengths.size(); i++ )
{
@ -534,7 +536,7 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
const UTF8 *line = renderTip.c_str() + startLineOffsets[i];
U32 lineLen = lineLengths[i];
GFX->getDrawUtil()->drawTextN( font, start + offset, line, lineLen, mProfile->mFontColors );
drawUtil->drawTextN( font, start + offset, line, lineLen, mProfile->mFontColors );
}
GFX->setClipRect( oldClip );

View file

@ -41,15 +41,17 @@ void renderRaisedBox( const RectI &bounds, GuiControlProfile *profile )
S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1;
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1;
GFX->getDrawUtil()->drawRectFill( bounds, profile->mFillColor);
GFX->getDrawUtil()->drawLine(l, t, l, b - 1, colorWhite);
GFX->getDrawUtil()->drawLine(l, t, r - 1, t, colorWhite);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
GFX->getDrawUtil()->drawLine(l, b, r, b, colorBlack);
GFX->getDrawUtil()->drawLine(r, b - 1, r, t, colorBlack);
drawUtil->drawRectFill( bounds, profile->mFillColor);
drawUtil->drawLine(l, t, l, b - 1, colorWhite);
drawUtil->drawLine(l, t, r - 1, t, colorWhite);
GFX->getDrawUtil()->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor);
GFX->getDrawUtil()->drawLine(r - 1, b - 2, r - 1, t + 1, profile->mBorderColor);
drawUtil->drawLine(l, b, r, b, colorBlack);
drawUtil->drawLine(r, b - 1, r, t, colorBlack);
drawUtil->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor);
drawUtil->drawLine(r - 1, b - 2, r - 1, t + 1, profile->mBorderColor);
}
void renderSlightlyRaisedBox( const RectI &bounds, GuiControlProfile *profile )
@ -70,16 +72,18 @@ void renderLoweredBox( const RectI &bounds, GuiControlProfile *profile )
S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1;
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1;
GFX->getDrawUtil()->drawRectFill( bounds, profile->mFillColor);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
GFX->getDrawUtil()->drawLine(l, b, r, b, colorWhite);
GFX->getDrawUtil()->drawLine(r, b - 1, r, t, colorWhite);
drawUtil->drawRectFill( bounds, profile->mFillColor);
GFX->getDrawUtil()->drawLine(l, t, r - 1, t, colorBlack);
GFX->getDrawUtil()->drawLine(l, t + 1, l, b - 1, colorBlack);
drawUtil->drawLine(l, b, r, b, colorWhite);
drawUtil->drawLine(r, b - 1, r, t, colorWhite);
GFX->getDrawUtil()->drawLine(l + 1, t + 1, r - 2, t + 1, profile->mBorderColor);
GFX->getDrawUtil()->drawLine(l + 1, t + 2, l + 1, b - 2, profile->mBorderColor);
drawUtil->drawLine(l, t, r - 1, t, colorBlack);
drawUtil->drawLine(l, t + 1, l, b - 1, colorBlack);
drawUtil->drawLine(l + 1, t + 1, r - 2, t + 1, profile->mBorderColor);
drawUtil->drawLine(l + 1, t + 2, l + 1, b - 2, profile->mBorderColor);
}
void renderSlightlyLoweredBox( const RectI &bounds, GuiControlProfile *profile )
@ -87,11 +91,13 @@ void renderSlightlyLoweredBox( const RectI &bounds, GuiControlProfile *profile )
S32 l = bounds.point.x + 1, r = bounds.point.x + bounds.extent.x - 1;
S32 t = bounds.point.y + 1, b = bounds.point.y + bounds.extent.y - 1;
GFX->getDrawUtil()->drawRectFill( bounds, profile->mFillColor);
GFX->getDrawUtil()->drawLine(l, b, r, b, profile->mBorderColor);
GFX->getDrawUtil()->drawLine(r, t, r, b - 1, profile->mBorderColor);
GFX->getDrawUtil()->drawLine(l, t, l, b - 1, profile->mBorderColor);
GFX->getDrawUtil()->drawLine(l + 1, t, r - 1, t, profile->mBorderColor);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
drawUtil->drawRectFill( bounds, profile->mFillColor);
drawUtil->drawLine(l, b, r, b, profile->mBorderColor);
drawUtil->drawLine(r, t, r, b - 1, profile->mBorderColor);
drawUtil->drawLine(l, t, l, b - 1, profile->mBorderColor);
drawUtil->drawLine(l + 1, t, r - 1, t, profile->mBorderColor);
}
void renderBorder( const RectI &bounds, GuiControlProfile *profile )

View file

@ -1278,12 +1278,13 @@ void GuiMenuBar::onMouseUp(const GuiEvent &event)
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
{
RectI ctrlRect(offset, getExtent());
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
//if opaque, fill the update rect with the fill color
if (mProfile->mOpaque)
GFX->getDrawUtil()->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor);
drawUtil->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor);
//if there's a border, draw the border
if (mProfile->mBorder)
@ -1327,20 +1328,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
Point2I bitmapstart(start);
bitmapstart.y = walk->bounds.point.y + ( walk->bounds.extent.y - rect.extent.y ) / 2;
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
// Should we also draw the text?
if(!walk->drawBitmapOnly)
{
start.x += mBitmapMargin;
GFX->getDrawUtil()->setBitmapModulation( fontColor );
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
drawUtil->setBitmapModulation( fontColor );
drawUtil->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
}
} else
{
GFX->getDrawUtil()->setBitmapModulation( fontColor );
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
drawUtil->setBitmapModulation( fontColor );
drawUtil->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
}
}

View file

@ -287,33 +287,35 @@ void GuiRectHandles::onRender(Point2I offset, const RectI &updateRect)
Point2I size(extent.x*mHandleRect.extent.x, extent.y*mHandleRect.extent.y);
RectI box(offset+pos, size);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
// Draw border
GFX->getDrawUtil()->drawRect(box, handleColor);
drawUtil->drawRect(box, handleColor);
// Draw each handle
Point2I handleSize(mHandleSize, mHandleSize);
RectI handleRect(box.point, handleSize);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper left
drawUtil->drawRectFill(handleRect, handleColor); // Upper left
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper right
drawUtil->drawRectFill(handleRect, handleColor); // Upper right
handleRect.point = Point2I(box.point.x, box.point.y+size.y-handleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower left
drawUtil->drawRectFill(handleRect, handleColor); // Lower left
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y+size.y-handleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower right
drawUtil->drawRectFill(handleRect, handleColor); // Lower right
Point2I halfSize = size / 2;
Point2I halfHandleSize = handleSize / 2;
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper middle
drawUtil->drawRectFill(handleRect, handleColor); // Upper middle
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y+size.y-handleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower middle
drawUtil->drawRectFill(handleRect, handleColor); // Lower middle
handleRect.point = Point2I(box.point.x, box.point.y+halfSize.y-halfHandleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Left middle
drawUtil->drawRectFill(handleRect, handleColor); // Left middle
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y+halfSize.y-halfHandleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Right middle
drawUtil->drawRectFill(handleRect, handleColor); // Right middle
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y+halfSize.y-halfHandleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Middle
drawUtil->drawRectFill(handleRect, handleColor); // Middle
renderChildControls(offset, updateRect);
}

View file

@ -330,10 +330,11 @@ void GuiShapeEdPreview::setCurrentDetail(S32 dl)
{
if ( mModel )
{
S32 smallest = mModel->getShape()->mSmallestVisibleDL;
mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->details.size()-1;
TSShape* shape = mModel->getShape();
S32 smallest = shape->mSmallestVisibleDL;
shape->mSmallestVisibleDL = shape->details.size() - 1;
mModel->setCurrentDetail( dl );
mModel->getShape()->mSmallestVisibleDL = smallest;
shape->mSmallestVisibleDL = smallest;
// Match the camera distance to this detail if necessary
//@todo if ( !gui->mFixedDetail )
@ -359,19 +360,21 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
mModel = new TSShapeInstance( model, true );
AssertFatal( mModel, avar("GuiShapeEdPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName ));
TSShape* shape = mModel->getShape();
// Initialize camera values:
mOrbitPos = mModel->getShape()->center;
mOrbitPos = shape->center;
// Set camera move and zoom speed according to model size
mMoveSpeed = mModel->getShape()->radius / sMoveScaler;
mZoomSpeed = mModel->getShape()->radius / sZoomScaler;
mMoveSpeed = shape->radius / sMoveScaler;
mZoomSpeed = shape->radius / sZoomScaler;
// Reset node selection
mHoverNode = -1;
mSelectedNode = -1;
mSelectedObject = -1;
mSelectedObjDetail = 0;
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
mProjectedNodes.setSize( shape->nodes.size() );
// Reset detail stats
mCurrentDL = 0;
@ -683,9 +686,11 @@ void GuiShapeEdPreview::refreshShape()
mModel->initNodeTransforms();
mModel->initMeshObjects();
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
TSShape* shape = mModel->getShape();
if ( mSelectedObject >= mModel->getShape()->objects.size() )
mProjectedNodes.setSize( shape->nodes.size() );
if ( mSelectedObject >= shape->objects.size() )
{
mSelectedObject = -1;
mSelectedObjDetail = 0;
@ -694,22 +699,22 @@ void GuiShapeEdPreview::refreshShape()
// Re-compute the collision mesh stats
mColMeshes = 0;
mColPolys = 0;
for ( S32 i = 0; i < mModel->getShape()->details.size(); i++ )
for ( S32 i = 0; i < shape->details.size(); i++ )
{
const TSShape::Detail& det = mModel->getShape()->details[i];
const String& detName = mModel->getShape()->getName( det.nameIndex );
const TSShape::Detail& det = shape->details[i];
const String& detName = shape->getName( det.nameIndex );
if ( ( det.subShapeNum < 0 ) || !detName.startsWith( "collision-" ) )
continue;
mColPolys += det.polyCount;
S32 od = det.objectDetailNum;
S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum];
S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum];
S32 start = shape->subShapeFirstObject[det.subShapeNum];
S32 end = start + shape->subShapeNumObjects[det.subShapeNum];
for ( S32 j = start; j < end; j++ )
{
const TSShape::Object &obj = mModel->getShape()->objects[j];
const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + od] : NULL;
const TSShape::Object &obj = shape->objects[j];
const TSMesh* mesh = ( od < obj.numMeshes ) ? shape->meshes[obj.startMeshIndex + od] : NULL;
if ( mesh )
mColMeshes++;
}
@ -1542,10 +1547,12 @@ void GuiShapeEdPreview::renderSunDirection() const
GFXStateBlockDesc desc;
desc.setZReadWrite( true, true );
GFX->getDrawUtil()->drawArrow( desc, start, end, color );
GFX->getDrawUtil()->drawArrow( desc, start + up, end + up, color );
GFX->getDrawUtil()->drawArrow( desc, start + right, end + right, color );
GFX->getDrawUtil()->drawArrow( desc, start + up + right, end + up + right, color );
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
drawUtil->drawArrow( desc, start, end, color );
drawUtil->drawArrow( desc, start + up, end + up, color );
drawUtil->drawArrow( desc, start + right, end + right, color );
drawUtil->drawArrow( desc, start + up + right, end + up + right, color );
}
}

View file

@ -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 );

View file

@ -575,12 +575,13 @@ void MessageVector::registerSpectator(SpectatorCallback callBack, void *spectato
}
mSpectators.increment();
mSpectators.last().callback = callBack;
mSpectators.last().key = spectatorKey;
SpectatorRef& lastSpectatorRef = mSpectators.last();
lastSpectatorRef.callback = callBack;
lastSpectatorRef.key = spectatorKey;
// Need to message this spectator of all the lines currently inserted...
for (i = 0; i < mMessageLines.size(); i++) {
(*mSpectators.last().callback)(mSpectators.last().key,
(*lastSpectatorRef.callback)(lastSpectatorRef.key,
LineInserted, i);
}
}

View file

@ -1449,14 +1449,15 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
// walk the points in the selection
for(U32 i = 0; i < sel.size(); i++)
{
Point2I gPos = sel[i].mGridPoint.gridPos;
GridPoint selectedGridPoint = sel[i].mGridPoint;
Point2I gPos = selectedGridPoint.gridPos;
GFXVertexPC *verts = &(vertexBuffer[i * 5]);
bool center = gridToWorld(sel[i].mGridPoint, verts[0].point);
gridToWorld(Point2I(gPos.x + 1, gPos.y), verts[1].point, sel[i].mGridPoint.terrainBlock);
gridToWorld(Point2I(gPos.x + 1, gPos.y + 1), verts[2].point, sel[i].mGridPoint.terrainBlock);
gridToWorld(Point2I(gPos.x, gPos.y + 1), verts[3].point, sel[i].mGridPoint.terrainBlock);
bool center = gridToWorld(selectedGridPoint, verts[0].point);
gridToWorld(Point2I(gPos.x + 1, gPos.y), verts[1].point, selectedGridPoint.terrainBlock);
gridToWorld(Point2I(gPos.x + 1, gPos.y + 1), verts[2].point, selectedGridPoint.terrainBlock);
gridToWorld(Point2I(gPos.x, gPos.y + 1), verts[3].point, selectedGridPoint.terrainBlock);
verts[4].point = verts[0].point;
F32 weight = sel[i].mWeight;

View file

@ -1631,10 +1631,11 @@ void WorldEditor::renderScreenObj( SceneObject *obj, const Point3F& projPos, con
// Save an IconObject for performing icon-click testing later.
mIcons.increment();
mIcons.last().object = obj;
mIcons.last().rect = renderRect;
mIcons.last().dist = projPos.z;
mIcons.last().alpha = iconAlpha;
IconObject& lastIcon = mIcons.last();
lastIcon.object = obj;
lastIcon.rect = renderRect;
lastIcon.dist = projPos.z;
lastIcon.alpha = iconAlpha;
}
//