Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
105:e0ddd8cad909 | 106:6a7c702a7531 |
---|---|
49 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | 49 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
50 } | 50 } |
51 | 51 |
52 lut = reinterpret_cast<const uint8_t*>(Orthanc::EmbeddedResources::GetFileResourceBuffer(style.lut_)); | 52 lut = reinterpret_cast<const uint8_t*>(Orthanc::EmbeddedResources::GetFileResourceBuffer(style.lut_)); |
53 } | 53 } |
54 | 54 |
55 Orthanc::ImageAccessor target = result->GetAccessor(); | 55 Orthanc::ImageAccessor target = result->GetAccessor(); |
56 for (unsigned int y = 0; y < target.GetHeight(); y++) | 56 const unsigned int width = target.GetWidth(); |
57 const unsigned int height = target.GetHeight(); | |
58 | |
59 for (unsigned int y = 0; y < height; y++) | |
57 { | 60 { |
58 const float* p = reinterpret_cast<const float*>(frame_->GetConstRow(y)); | 61 const float* p = reinterpret_cast<const float*>(frame_->GetConstRow(y)); |
59 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); | 62 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); |
60 | 63 |
61 for (unsigned int x = 0; x < target.GetWidth(); x++, p++, q += 4) | 64 for (unsigned int x = 0; x < width; x++, p++, q += 4) |
62 { | 65 { |
63 uint8_t v = 0; | 66 uint8_t v = 0; |
64 if (windowWidth >= 0.001f) // Avoid division by zero | 67 if (windowWidth >= 0.001f) // Avoid division by zero |
65 { | 68 { |
66 if (*p >= x1) | 69 if (*p >= x1) |