From b51a15abb93a0dd0fc491419d12ea58637ebf089 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Tue, 31 Jul 2012 17:34:35 +0200 Subject: Removed 'virtual' from methods of Image Maybe it used to be necessary for these methods to be virtual, but this is no longer the case. Hence we can avoid wasting CPU ticks searching through virtual function tables, especially for frequently used methods like getWidth, getHeight and setAlpha. MapLayer::getTile was inlined. Reviewed-by: Erik Schilling --- src/resources/image.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/resources/image.cpp') diff --git a/src/resources/image.cpp b/src/resources/image.cpp index b7e6c200..7e592198 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -576,11 +576,17 @@ Image *Image::getSubImage(int x, int y, int width, int height) // Create a new clipped sub-image #ifdef USE_OPENGL if (mUseOpenGL) - return new SubImage(this, mGLImage, x, y, width, height, + return new SubImage(this, mGLImage, + mBounds.x + x, + mBounds.y + y, + width, height, mTexWidth, mTexHeight); #endif - return new SubImage(this, mSDLSurface, x, y, width, height); + return new SubImage(this, mSDLSurface, + mBounds.x + x, + mBounds.y + y, + width, height); } void Image::SDLterminateAlphaCache() @@ -647,8 +653,3 @@ SubImage::~SubImage() #endif mParent->decRef(); } - -Image *SubImage::getSubImage(int x, int y, int w, int h) -{ - return mParent->getSubImage(mBounds.x + x, mBounds.y + y, w, h); -} -- cgit v1.2.3-70-g09d2