diff --git a/src/eepp/graphics/ninepatch.cpp b/src/eepp/graphics/ninepatch.cpp index 59cff041a..4625fed96 100644 --- a/src/eepp/graphics/ninepatch.cpp +++ b/src/eepp/graphics/ninepatch.cpp @@ -112,15 +112,25 @@ TextureRegion * NinePatch::getTextureRegion( const int& side ) { } void NinePatch::createFromTexture(const Uint32 & TexId, int left, int top, int right, int bottom) { - mDrawable[ Left ] = TextureRegion::New( TexId, Rect( 0, top, left, mSize.getHeight() - bottom ) ); - mDrawable[ Right ] = TextureRegion::New( TexId, Rect( mSize.getWidth() - right, top, mSize.getWidth(), mSize.getHeight() - bottom ) ); - mDrawable[ Down ] = TextureRegion::New( TexId, Rect( left, mSize.getHeight() - bottom, mSize.getWidth() - right, mSize.getHeight() ) ); - mDrawable[ Up ] = TextureRegion::New( TexId, Rect( left, 0, mSize.getWidth() - right, top ) ); - mDrawable[ UpLeft ] = TextureRegion::New( TexId, Rect( 0, 0, left, top ) ); - mDrawable[ UpRight] = TextureRegion::New( TexId, Rect( mSize.getWidth() - right, 0, mSize.getWidth(), top ) ); - mDrawable[ DownLeft] = TextureRegion::New( TexId, Rect( 0, mSize.getHeight() - bottom, left, mSize.getHeight() ) ); - mDrawable[ DownRight ] = TextureRegion::New( TexId, Rect( mSize.getWidth() - right, mSize.getHeight() - bottom, mSize.getWidth(), mSize.getHeight() ) ); - mDrawable[ Center ] = TextureRegion::New( TexId, Rect( left, top, mSize.getWidth() - right, mSize.getHeight() - bottom ) ); + Rect r; + r = Rect( 0, top, left, mSize.getHeight() - bottom ); + mDrawable[ Left ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( mSize.getWidth() - right, top, mSize.getWidth(), mSize.getHeight() - bottom ); + mDrawable[ Right ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( left, mSize.getHeight() - bottom, mSize.getWidth() - right, mSize.getHeight() ); + mDrawable[ Down ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( left, 0, mSize.getWidth() - right, top ); + mDrawable[ Up ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( 0, 0, left, top ); + mDrawable[ UpLeft ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( mSize.getWidth() - right, 0, mSize.getWidth(), top ); + mDrawable[ UpRight] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( 0, mSize.getHeight() - bottom, left, mSize.getHeight() ); + mDrawable[ DownLeft] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( mSize.getWidth() - right, mSize.getHeight() - bottom, mSize.getWidth(), mSize.getHeight() ); + mDrawable[ DownRight ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); + r = Rect( left, top, mSize.getWidth() - right, mSize.getHeight() - bottom ); + mDrawable[ Center ] = TextureRegion::New( TexId, r, r.getSize().asFloat() ); mRect = Rect( left, top, right, bottom );