From 339ed7f63798fb5ccab05fa7fb9d0d95743c9c89 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Wed, 16 Mar 2016 21:34:59 +0100 Subject: 8.0 --- wx+/image_tools.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'wx+/image_tools.h') 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(std::min(255, c + level)); }); -- cgit