diff Framework/Layers/GrayscaleFrameRenderer.cpp @ 106:6a7c702a7531 wasm

optimization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Jun 2017 14:21:24 +0200
parents f5f54ed8d307
children 53025eecbc95
line wrap: on
line diff
--- a/Framework/Layers/GrayscaleFrameRenderer.cpp	Thu Jun 01 12:33:24 2017 +0200
+++ b/Framework/Layers/GrayscaleFrameRenderer.cpp	Wed Jun 14 14:21:24 2017 +0200
@@ -51,14 +51,17 @@
 
       lut = reinterpret_cast<const uint8_t*>(Orthanc::EmbeddedResources::GetFileResourceBuffer(style.lut_));
     }
-      
+
     Orthanc::ImageAccessor target = result->GetAccessor();
-    for (unsigned int y = 0; y < target.GetHeight(); y++)
+    const unsigned int width = target.GetWidth();
+    const unsigned int height = target.GetHeight();
+    
+    for (unsigned int y = 0; y < height; y++)
     {
       const float* p = reinterpret_cast<const float*>(frame_->GetConstRow(y));
       uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y));
 
-      for (unsigned int x = 0; x < target.GetWidth(); x++, p++, q += 4)
+      for (unsigned int x = 0; x < width; x++, p++, q += 4)
       {
         uint8_t v = 0;
         if (windowWidth >= 0.001f)  // Avoid division by zero