From 630a4153243ffd95fb327ec752a72243e27f8052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 25 Aug 2012 01:01:22 +0200 Subject: [PATCH] Non-constant access to image data. Sometimes something needs to modify the data (in similar way it modifies e.g. MeshData) and there is no reason to forbid that, as the data must be non-const for delete[] operator anyway. There might be slight problem with ImageWrapper, which should be able to wrap const data, but currently nothing needs it. --- src/Image.h | 3 ++- src/ImageWrapper.h | 3 ++- src/Trade/ImageData.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Image.h b/src/Image.h index 64557ea23..fd83832a7 100644 --- a/src/Image.h +++ b/src/Image.h @@ -76,7 +76,8 @@ template class Image: public AbstractImage { inline constexpr const Math::Vector& dimensions() const { return _dimensions; } /** @brief Pointer to raw data */ - inline constexpr const void* data() const { return _data; } + inline void* data() { return _data; } + inline constexpr const void* data() const { return _data; } /**< @overload */ /** * @brief Set image data diff --git a/src/ImageWrapper.h b/src/ImageWrapper.h index b4dc0e4e6..3a4ca8ce3 100644 --- a/src/ImageWrapper.h +++ b/src/ImageWrapper.h @@ -81,7 +81,8 @@ template class ImageWrapper: public AbstractImage { inline constexpr const Math::Vector& dimensions() const { return _dimensions; } /** @brief Pointer to raw data */ - inline constexpr const void* data() const { return _data; } + inline void* data() { return _data; } + inline constexpr const void* data() const { return _data; } /**< @overload */ /** * @brief Set image data diff --git a/src/Trade/ImageData.h b/src/Trade/ImageData.h index 587fb0bc9..f054f6464 100644 --- a/src/Trade/ImageData.h +++ b/src/Trade/ImageData.h @@ -70,7 +70,8 @@ template class ImageData: public AbstractImage { inline constexpr const Math::Vector& dimensions() const { return _dimensions; } /** @brief Pointer to raw data */ - inline constexpr const void* data() const { return _data; } + inline void* data() { return _data; } + inline constexpr const void* data() const { return _data; } /**< @overload */ private: std::string _name;