From db7d8e789ae898bc661092964a0ec0b0573b0958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 18 May 2013 20:10:57 +0200 Subject: [PATCH] Added convenience member alternative for AbstractImage::pixelSize(). --- src/AbstractImage.h | 15 +++++++++++++-- src/BufferImage.cpp | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 3f3e1ea1f..2a03db61c 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -64,7 +64,7 @@ class MAGNUM_EXPORT AbstractImage { /** * @brief Format of pixel data * - * @see pixelSize() + * @see pixelSize(Format, Type) */ enum class Format: GLenum { /** @@ -263,7 +263,7 @@ class MAGNUM_EXPORT AbstractImage { /** * @brief Data type of pixel data * - * @see pixelSize() + * @see pixelSize(Format, Type) */ enum class Type: GLenum { /** Each component unsigned byte. */ @@ -493,6 +493,8 @@ class MAGNUM_EXPORT AbstractImage { * @brief Pixel size (in bytes) * @param format Format of the pixel * @param type Data type of the pixel + * + * @see pixelSize() const */ static std::size_t pixelSize(Format format, Type type); @@ -512,6 +514,15 @@ class MAGNUM_EXPORT AbstractImage { /** @brief Data type of pixel data */ inline Type type() const { return _type; } + /** + * @brief Pixel size (in bytes) + * + * Convenience member alternative for pixelSize(Format, Type). + */ + inline std::size_t pixelSize() const { + return pixelSize(_format, _type); + } + #ifdef DOXYGEN_GENERATING_OUTPUT private: #else diff --git a/src/BufferImage.cpp b/src/BufferImage.cpp index 63ec57b3d..65666f033 100644 --- a/src/BufferImage.cpp +++ b/src/BufferImage.cpp @@ -31,7 +31,7 @@ template void BufferImage::setData(const typ _format = format; _type = type; _size = size; - _buffer.setData(pixelSize(format, type)*size.product(), data, usage); + _buffer.setData(pixelSize()*size.product(), data, usage); } #ifndef DOXYGEN_GENERATING_OUTPUT