summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-07-31 17:34:35 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-08-05 17:21:12 +0200
commitb51a15abb93a0dd0fc491419d12ea58637ebf089 (patch)
tree1bd857fa1684e882de13ab72e5ca386a1728b8bb /src/resources/image.cpp
parent542570896e1e0ce73ebfc442b48e741c2ea32377 (diff)
downloadmana-client-b51a15abb93a0dd0fc491419d12ea58637ebf089.tar.gz
mana-client-b51a15abb93a0dd0fc491419d12ea58637ebf089.tar.bz2
mana-client-b51a15abb93a0dd0fc491419d12ea58637ebf089.tar.xz
mana-client-b51a15abb93a0dd0fc491419d12ea58637ebf089.zip
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
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp15
1 files changed, 8 insertions, 7 deletions
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);
-}