# HG changeset patch # User Sebastien Jodogne # Date 1604681075 -3600 # Node ID 628201cb48c233190fa954859a90323168d928af # Parent 541a4aa63278e6af53affc174c83363163fb8cf8 fix build diff -r 541a4aa63278 -r 628201cb48c2 Framework/Enumerations.cpp --- a/Framework/Enumerations.cpp Tue Aug 04 17:13:35 2020 +0200 +++ b/Framework/Enumerations.cpp Fri Nov 06 17:44:35 2020 +0100 @@ -23,6 +23,8 @@ #include "Enumerations.h" #include "Jpeg2000Reader.h" + +#include #include #include #include diff -r 541a4aa63278 -r 628201cb48c2 Framework/ImageToolbox.cpp --- a/Framework/ImageToolbox.cpp Tue Aug 04 17:13:35 2020 +0200 +++ b/Framework/ImageToolbox.cpp Fri Nov 06 17:44:35 2020 +0100 @@ -93,13 +93,16 @@ 7152 * static_cast(g) + 0722 * static_cast(b)) / 10000; + const unsigned int width = image.GetWidth(); + const unsigned int height = image.GetHeight(); + switch (image.GetFormat()) { case Orthanc::PixelFormat_Grayscale8: { - for (unsigned int y = 0; y < image.GetHeight(); y++) + for (unsigned int y = 0; y < height; y++) { - memset(image.GetRow(y), grayscale, image.GetWidth()); + memset(image.GetRow(y), grayscale, width); } break; @@ -107,10 +110,10 @@ case Orthanc::PixelFormat_RGB24: { - for (unsigned int y = 0; y < image.GetHeight(); y++) + for (unsigned int y = 0; y < height; y++) { uint8_t* p = reinterpret_cast(image.GetRow(y)); - for (unsigned int x = 0; x < image.GetWidth(); x++, p += 3) + for (unsigned int x = 0; x < width; x++, p += 3) { p[0] = r; p[1] = g; @@ -330,14 +333,17 @@ const unsigned int bytesPerPixel = source.GetBytesPerPixel(); // Corresponds to the number of channels tx (*) std::unique_ptr target(Allocate(source.GetFormat(), - source.GetWidth() / 2, - source.GetHeight() / 2)); + source.GetWidth() / 2, + source.GetHeight() / 2)); - 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++) { uint8_t* q = reinterpret_cast(target->GetRow(y)); - for (unsigned int x = 0; x < target->GetWidth(); x++, q += bytesPerPixel) + for (unsigned int x = 0; x < width; x++, q += bytesPerPixel) { for (unsigned int c = 0; c < bytesPerPixel; c++) { @@ -360,8 +366,8 @@ Orthanc::ImageAccessor* Clone(const Orthanc::ImageAccessor& accessor) { std::unique_ptr result(Allocate(accessor.GetFormat(), - accessor.GetWidth(), - accessor.GetHeight())); + accessor.GetWidth(), + accessor.GetHeight())); Embed(*result, accessor, 0, 0); return result.release(); @@ -372,14 +378,18 @@ unsigned int level) { std::unique_ptr result(Allocate(pyramid.GetPixelFormat(), - pyramid.GetLevelWidth(level), - pyramid.GetLevelHeight(level))); + pyramid.GetLevelWidth(level), + pyramid.GetLevelHeight(level))); + + LOG(INFO) << "Rendering a tiled image of size " + << result->GetWidth() << "x" << result->GetHeight(); - LOG(INFO) << "Rendering a tiled image of size " << result->GetWidth() << "x" << result->GetHeight(); - - for (unsigned int y = 0; y < result->GetHeight(); y += pyramid.GetTileHeight()) + const unsigned int width = result->GetWidth(); + const unsigned int height = result->GetHeight(); + + for (unsigned int y = 0; y < height; y += pyramid.GetTileHeight()) { - for (unsigned int x = 0; x < result->GetWidth(); x += pyramid.GetTileWidth()) + for (unsigned int x = 0; x < width; x += pyramid.GetTileWidth()) { std::unique_ptr tile(pyramid.DecodeTile(level, x / pyramid.GetTileWidth(), diff -r 541a4aa63278 -r 628201cb48c2 Framework/Jpeg2000Reader.cpp --- a/Framework/Jpeg2000Reader.cpp Tue Aug 04 17:13:35 2020 +0200 +++ b/Framework/Jpeg2000Reader.cpp Fri Nov 06 17:44:35 2020 +0100 @@ -303,11 +303,14 @@ int32_t* q = image_->comps[channel].data; assert(q != NULL); - 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++) { uint8_t *p = reinterpret_cast(target.GetRow(y)) + channel; - for (unsigned int x = 0; x < target.GetWidth(); x++, p += targetIncrement) + for (unsigned int x = 0; x < width; x++, p += targetIncrement) { *p = *q; q++;