diff options
Diffstat (limited to 'wx+/image_tools.h')
-rw-r--r-- | wx+/image_tools.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/wx+/image_tools.h b/wx+/image_tools.h index 554e7b49..c8077aa4 100644 --- a/wx+/image_tools.h +++ b/wx+/image_tools.h @@ -127,10 +127,9 @@ double getAvgBrightness(const wxImage& img) inline void brighten(wxImage& img, int level) { - const int pixelCount = img.GetWidth() * img.GetHeight(); - auto pixBegin = img.GetData(); - if (pixBegin) + if (auto pixBegin = img.GetData()) { + const int pixelCount = img.GetWidth() * img.GetHeight(); auto pixEnd = pixBegin + 3 * pixelCount; //RGB if (level > 0) std::for_each(pixBegin, pixEnd, [&](unsigned char& c) { c = static_cast<unsigned char>(std::min(255, c + level)); }); |