More code clean up, some minor optimizations in cImage::CopyImage

This commit is contained in:
Martín Lucas Golini
2013-08-19 15:20:15 -03:00
parent 20dcd26b29
commit 90222e6445
2 changed files with 13 additions and 7 deletions

View File

@@ -389,9 +389,19 @@ void cImage::CopyImage( cImage * image, const Uint32& x, const Uint32& y ) {
eeUint dWidth = image->Width();
eeUint dHeight = image->Height();
for ( eeUint ty = 0; ty < dHeight; ty++ ) {
for ( eeUint tx = 0; tx < dWidth; tx++ ) {
SetPixel( x + tx, y + ty, image->GetPixel( tx, ty ) );
if ( mChannels != image->Channels() ) {
for ( eeUint ty = 0; ty < dHeight; ty++ ) {
for ( eeUint tx = 0; tx < dWidth; tx++ ) {
SetPixel( x + tx, y + ty, image->GetPixel( tx, ty ) );
}
}
} else {
// Copy per row
for ( eeUint ty = 0; ty < dHeight; ty++ ) {
Uint8 * pDst = &mPixels[ ( x + ( ( ty + y ) * mWidth ) ) * mChannels ];
const Uint8 * pSrc = &( ( image->GetPixelsPtr() )[ ( ty * dWidth ) * mChannels ] );
memcpy( pDst, pSrc, mChannels * dWidth );
}
}
}

View File

@@ -339,10 +339,6 @@ void cTTFFont::RebuildFromGlyphs() {
for (eeUint i = 0; i < mNumChars; i++) {
tGlyph = mGlyphs[i];
if ( 99 == i ) {
Top++;
}
tR.Left = (eeFloat)tGlyph.CurX / Tex->Width();
tR.Top = (eeFloat)tGlyph.CurY / Tex->Height();