From 367c92d1ac584eb7ad5812f717aea27456f44e5f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Mar 2016 18:13:13 +0300 Subject: Remove getter getAlpha form image class. --- src/resources/image.h | 12 +----------- src/resources/sprite/animatedsprite.cpp | 10 +++------- src/resources/sprite/imagesprite.cpp | 2 +- 3 files changed, 5 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/resources/image.h b/src/resources/image.h index aa38f7a22..55f28a055 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -120,12 +120,6 @@ class Image notfinal : public Resource */ virtual void setAlpha(const float alpha); - /** - * Returns the alpha value of this image. - */ - float getAlpha() const A_WARN_UNUSED - { return mAlpha; } - /** * Creates a new image with the desired clipping rectangle. * @@ -197,13 +191,9 @@ class Image notfinal : public Resource SDL_Rect mBounds; - protected: - // ----------------------- - // Generic protected members - // ----------------------- - float mAlpha; + protected: // ----------------------- // SDL protected members // ----------------------- diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp index 08d73c2c5..34aca4706 100644 --- a/src/resources/sprite/animatedsprite.cpp +++ b/src/resources/sprite/animatedsprite.cpp @@ -323,9 +323,7 @@ void AnimatedSprite::draw(Graphics *restrict const graphics, return; Image *restrict const image = mFrame->image; - if (image->getAlpha() != mAlpha) - image->setAlpha(mAlpha); - + image->setAlpha(mAlpha); graphics->drawImage(image, posX + mFrame->offsetX, posY + mFrame->offsetY); } @@ -338,9 +336,7 @@ void AnimatedSprite::drawRaw(Graphics *restrict const graphics, return; Image *restrict const image = mFrame->image; - if (image->getAlpha() != mAlpha) - image->setAlpha(mAlpha); - + image->setAlpha(mAlpha); graphics->drawImage(image, posX, posY); @@ -416,7 +412,7 @@ void AnimatedSprite::setAlpha(float alpha) restrict2 if (mFrame) { Image *restrict const image = mFrame->image; - if (image && image->getAlpha() != mAlpha) + if (image) image->setAlpha(mAlpha); } } diff --git a/src/resources/sprite/imagesprite.cpp b/src/resources/sprite/imagesprite.cpp index c3258ca44..790bcadf8 100644 --- a/src/resources/sprite/imagesprite.cpp +++ b/src/resources/sprite/imagesprite.cpp @@ -30,7 +30,7 @@ ImageSprite::ImageSprite(Image *const image) : { if (mImage) { - mAlpha = mImage->getAlpha(); + mAlpha = mImage->mAlpha; mImage->incRef(); } else -- cgit v1.2.3-70-g09d2