# HG changeset patch # User Sebastien Jodogne # Date 1521548760 -3600 # Node ID cd7b854dbc05022d3899b9a45513c19f2ad903be # Parent 771c1c14628c5ba0280f3dfd7284185d74d16eb4 convert grayscale16 to bgra32 diff -r 771c1c14628c -r cd7b854dbc05 Core/Images/ImageProcessing.cpp --- a/Core/Images/ImageProcessing.cpp Mon Mar 19 10:04:48 2018 +0100 +++ b/Core/Images/ImageProcessing.cpp Tue Mar 20 13:26:00 2018 +0100 @@ -572,6 +572,28 @@ } if (target.GetFormat() == PixelFormat_BGRA32 && + source.GetFormat() == PixelFormat_Grayscale16) + { + for (unsigned int y = 0; y < source.GetHeight(); y++) + { + const uint16_t* p = reinterpret_cast(source.GetConstRow(y)); + uint8_t* q = reinterpret_cast(target.GetRow(y)); + for (unsigned int x = 0; x < source.GetWidth(); x++) + { + uint8_t value = (*p < 256 ? *p : 255); + q[0] = value; + q[1] = value; + q[2] = value; + q[3] = 255; + p += 1; + q += 4; + } + } + + return; + } + + if (target.GetFormat() == PixelFormat_BGRA32 && source.GetFormat() == PixelFormat_RGB24) { for (unsigned int y = 0; y < source.GetHeight(); y++)