diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/config.h.cmake | 1 | ||||
-rw-r--r-- | src/common/image.cpp | 9 | ||||
-rw-r--r-- | src/common/image.h | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/common/config.h.cmake b/src/common/config.h.cmake index 022bb69..1595e09 100644 --- a/src/common/config.h.cmake +++ b/src/common/config.h.cmake @@ -5,7 +5,6 @@ #cmakedefine PLATFORM_LINUX @PLATFORM_LINUX@ #cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@ -#cmakedefine USE_GLEW @USE_GLEW@ #cmakedefine GLEW_STATIC #define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@" diff --git a/src/common/image.cpp b/src/common/image.cpp index ef8097e..be5711d 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -190,6 +190,15 @@ Math::IntPoint CImage::GetSize() const return Math::IntPoint(m_data->surface->w, m_data->surface->h); } +/** Image must be valid. */ +void CImage::Fill(Gfx::IntColor color) +{ + assert(m_data != nullptr); + + Uint32 c = SDL_MapRGBA(m_data->surface->format, color.r, color.g, color.b, color.a); + SDL_FillRect(m_data->surface, nullptr, c); +} + /** * Image must be valid and pixel coords in valid range. * diff --git a/src/common/image.h b/src/common/image.h index d23a6fa..d9da75b 100644 --- a/src/common/image.h +++ b/src/common/image.h @@ -79,6 +79,9 @@ public: //! Returns the image size Math::IntPoint GetSize() const; + //! Fills the whole image with given color + void Fill(Gfx::IntColor color); + //! Sets the color at given pixel void SetPixel(Math::IntPoint pixel, Gfx::Color color); |