From 537085e221d25f710ed7162e1fc8add8ffe4a72f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 31 Dec 2016 05:04:16 +0300 Subject: Improve fringe map layers drawing. Pre cache next tile position with image. --- src/resources/image/image.cpp | 30 ++++++++++++++++++++++++++++++ src/resources/image/image.h | 5 +++++ 2 files changed, 35 insertions(+) (limited to 'src/resources/image') diff --git a/src/resources/image/image.cpp b/src/resources/image/image.cpp index 379a1c074..a3bb1b0ce 100644 --- a/src/resources/image/image.cpp +++ b/src/resources/image/image.cpp @@ -45,6 +45,36 @@ #include "debug.h" +#ifdef UNITTESTS +Image::Image(const int width, + const int height) : + Resource(), +#ifdef USE_OPENGL + mGLImage(0), + mTexWidth(0), + mTexHeight(0), +#endif // USE_OPENGL + mBounds(), + mAlpha(1.0F), + mSDLSurface(nullptr), +#ifdef USE_SDL2 + mTexture(nullptr), +#endif // USE_SDL2 + mAlphaChannel(nullptr), + mAlphaCache(), + mLoaded(false), + mHasAlphaChannel(false), + mUseAlphaCache(false), + mIsAlphaVisible(true), + mIsAlphaCalculated(false) +{ + mBounds.x = 0; + mBounds.y = 0; + mBounds.w = width; + mBounds.h = height; +} +#endif // UNITTESTS + #ifdef USE_SDL2 Image::Image(SDL_Texture *restrict const image, const int width, const int height) : diff --git a/src/resources/image/image.h b/src/resources/image/image.h index ca5a8a12e..0a6060fef 100644 --- a/src/resources/image/image.h +++ b/src/resources/image/image.h @@ -81,6 +81,11 @@ class Image notfinal : public Resource #endif // USE_OPENGL public: +#ifdef UNITTESTS + Image(const int width, + const int height); +#endif // UNITTESTS + A_DELETE_COPY(Image) /** -- cgit v1.2.3-60-g2f50