summaryrefslogtreecommitdiff
path: root/src/particle/imageparticle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-07 17:13:01 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-07 17:13:01 +0300
commit852617a2ea3cfe83c1d0aec134d9369aa5c3af7b (patch)
treea5a2620aa927c6a4868d2061b24f3f9d446cdc0a /src/particle/imageparticle.cpp
parenteea33c9a746a7e44f7f61d13d679c9c9535a7244 (diff)
downloadplus-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.tar.gz
plus-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.tar.bz2
plus-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.tar.xz
plus-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.zip
Improve a bit imageparticle draw.
Diffstat (limited to 'src/particle/imageparticle.cpp')
-rw-r--r--src/particle/imageparticle.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp
index d6914eafc..5a67886c0 100644
--- a/src/particle/imageparticle.cpp
+++ b/src/particle/imageparticle.cpp
@@ -75,15 +75,17 @@ void ImageParticle::draw(Graphics *restrict const graphics,
if (mAlive != AliveStatus::ALIVE || !mImage)
return;
+ const int w = mImage->mBounds.w;
+ const int h = mImage->mBounds.h;
const int screenX = CAST_S32(mPos.x)
- + offsetX - mImage->mBounds.w / 2;
+ + offsetX - w / 2;
const int screenY = CAST_S32(mPos.y) - CAST_S32(mPos.z)
- + offsetY - mImage->mBounds.h / 2;
+ + offsetY - h / 2;
// Check if on screen
- if (screenX + mImage->mBounds.w < 0 ||
+ if (screenX + w < 0 ||
screenX > graphics->mWidth ||
- screenY + mImage->mBounds.h < 0 ||
+ screenY + h < 0 ||
screenY > graphics->mHeight)
{
return;