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

@ -918,17 +918,18 @@ void GFont::importStrip(const char *fileName, U32 padding, U32 kerning)
// Allocate a new bitmap for this glyph, taking into account kerning and padding.
glyphList.increment();
glyphList.last().bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2*padding, mCharInfoList[i].height + 2*padding, false, strip->getFormat());
glyphList.last().charId = i;
GlyphMap& lastGlyphMap = glyphList.last();
lastGlyphMap.bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2 * padding, mCharInfoList[i].height + 2 * padding, false, strip->getFormat());
lastGlyphMap.charId = i;
// Copy the rect.
RectI ri(curWidth, getBaseline() - mCharInfoList[i].yOrigin, glyphList.last().bitmap->getWidth(), glyphList.last().bitmap->getHeight());
RectI ri(curWidth, getBaseline() - mCharInfoList[i].yOrigin, lastGlyphMap.bitmap->getWidth(), lastGlyphMap.bitmap->getHeight());
Point2I outRi(0,0);
glyphList.last().bitmap->copyRect(strip, ri, outRi);
lastGlyphMap.bitmap->copyRect(strip, ri, outRi);
// Update glyph attributes.
mCharInfoList[i].width = glyphList.last().bitmap->getWidth();
mCharInfoList[i].height = glyphList.last().bitmap->getHeight();
mCharInfoList[i].width = lastGlyphMap.bitmap->getWidth();
mCharInfoList[i].height = lastGlyphMap.bitmap->getHeight();
mCharInfoList[i].xOffset -= kerning + padding;
mCharInfoList[i].xIncrement += kerning;
mCharInfoList[i].yOffset -= padding;

View file

@ -1041,7 +1041,8 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
}
// inOutFormat is not modified by this method
bool chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
GFXCardProfiler* cardProfiler = GFX->getCardProfiler();
bool chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
if( !chekFmt )
{
@ -1057,16 +1058,16 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
{
case GFXFormatR8G8B8:
testingFormat = GFXFormatR8G8B8X8;
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
break;
case GFXFormatA8:
testingFormat = GFXFormatR8G8B8A8;
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
break;
default:
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
break;
}
}

View file

@ -114,10 +114,11 @@ void GFXVertexFormat::addElement( const String& semantic, GFXDeclType type, U32
{
mDirty = true;
mElements.increment();
mElements.last().mStreamIndex = stream;
mElements.last().mSemantic = semantic.intern();
mElements.last().mSemanticIndex = index;
mElements.last().mType = type;
GFXVertexElement& lastElement = mElements.last();
lastElement.mStreamIndex = stream;
lastElement.mSemantic = semantic.intern();
lastElement.mSemanticIndex = index;
lastElement.mType = type;
}
const String& GFXVertexFormat::getDescription() const