| @@ -197,11 +197,9 @@ template<PixelFormat T> typename PixelType<T>::type *Image::Lock() | |||||
| } | } | ||||
| /* The Lock2D() method */ | /* The Lock2D() method */ | ||||
| template<PixelFormat T> array2d<typename PixelType<T>::type> &Image::Lock2D() | |||||
| void *Image::Lock2DHelper(PixelFormat T) | |||||
| { | { | ||||
| SetFormat(T); | |||||
| return *(array2d<typename PixelType<T>::type> *)m_data->m_pixels[(int)T]->Data2D(); | |||||
| return m_data->m_pixels[(int)T]->Data2D(); | |||||
| } | } | ||||
| template<typename T> | template<typename T> | ||||
| @@ -87,7 +87,12 @@ public: | |||||
| void Unlock(void const *pixels); | void Unlock(void const *pixels); | ||||
| template<PixelFormat T> | template<PixelFormat T> | ||||
| array2d<typename PixelType<T>::type> &Lock2D(); | |||||
| inline array2d<typename PixelType<T>::type> &Lock2D() | |||||
| { | |||||
| /* Hack: this indirection is needed because of a Visual Studio ICE */ | |||||
| return *(array2d<typename PixelType<T>::type> *)Lock2DHelper(T); | |||||
| } | |||||
| template<typename T> | template<typename T> | ||||
| void Unlock2D(array2d<T> const &); | void Unlock2D(array2d<T> const &); | ||||
| @@ -150,6 +155,8 @@ public: | |||||
| static Image Difference(Image &src1, Image &src2); | static Image Difference(Image &src1, Image &src2); | ||||
| private: | private: | ||||
| void *Lock2DHelper(PixelFormat T); | |||||
| class ImageData *m_data; | class ImageData *m_data; | ||||
| }; | }; | ||||
| @@ -257,8 +257,10 @@ private: | |||||
| { | { | ||||
| ptrdiff_t total_size = 1; | ptrdiff_t total_size = 1; | ||||
| for (auto size : m_sizes) | |||||
| total_size *= size; | |||||
| /* HACK: we can't use for (auto s : m_sizes) because of an ICE in | |||||
| * the Visual Studio compiler. */ | |||||
| for (int i = 0; i < N; ++i) | |||||
| total_size *= m_sizes[i]; | |||||
| this->Resize(total_size, e); | this->Resize(total_size, e); | ||||
| } | } | ||||