Revert "[Tizen] Fix SVACE error in pixel-buffer-impl.cpp"
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 26 Jul 2021 08:04:13 +0000 (17:04 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 26 Jul 2021 08:04:17 +0000 (17:04 +0900)
This reverts commit 35d250d3a52e8e610e040024074edb114cddae51.

Change-Id: Ib614cc083182a18aa0aa746d80a9225a75d15821

dali/internal/imaging/common/pixel-buffer-impl.cpp

index 6ed2e31..e69f2c8 100644 (file)
@@ -479,23 +479,19 @@ uint32_t PixelBuffer::GetBrightness() const
   {
     unsigned char* pixel      = mBuffer;
     const uint32_t bufferSize = mWidth * mHeight;
+    uint64_t       red        = 0;
+    uint64_t       green      = 0;
+    uint64_t       blue       = 0;
 
-    if(bufferSize) // avoid division by zero to calculate brightness
+    for(uint32_t i = 0; i < bufferSize; ++i)
     {
-      uint64_t red   = 0;
-      uint64_t green = 0;
-      uint64_t blue  = 0;
-
-      for(uint32_t i = 0; i < bufferSize; ++i)
-      {
-        red += ReadChannel(pixel, mPixelFormat, Adaptor::RED);
-        green += ReadChannel(pixel, mPixelFormat, Adaptor::GREEN);
-        blue += ReadChannel(pixel, mPixelFormat, Adaptor::BLUE);
-        pixel += bytesPerPixel;
-      }
-      // http://www.w3.org/TR/AERT#color-contrast
-      brightness = (red * BRIGHTNESS_CONSTANT_R + green * BRIGHTNESS_CONSTANT_G + blue * BRIGHTNESS_CONSTANT_B) / (1000uLL * bufferSize);
+      red += ReadChannel(pixel, mPixelFormat, Adaptor::RED);
+      green += ReadChannel(pixel, mPixelFormat, Adaptor::GREEN);
+      blue += ReadChannel(pixel, mPixelFormat, Adaptor::BLUE);
+      pixel += bytesPerPixel;
     }
+    // http://www.w3.org/TR/AERT#color-contrast
+    brightness = (red * BRIGHTNESS_CONSTANT_R + green * BRIGHTNESS_CONSTANT_G + blue * BRIGHTNESS_CONSTANT_B) / (1000uLL * bufferSize);
   }
 
   return brightness;