comparison OrthancStone/Sources/Scene2D/Internals/CairoTextRenderer.cpp @ 1571:85e117739eca

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Sep 2020 17:46:39 +0200
parents 244ad1e4e76a
children 4fb8fdf03314
comparison
equal deleted inserted replaced
1570:9a04f42098a3 1571:85e117739eca
36 36
37 if (source.get() != NULL) 37 if (source.get() != NULL)
38 { 38 {
39 text_.SetSize(source->GetWidth(), source->GetHeight(), true); 39 text_.SetSize(source->GetWidth(), source->GetHeight(), true);
40 40
41 Orthanc::ImageAccessor target; 41 Orthanc::ImageAccessor accessor;
42 text_.GetWriteableAccessor(target); 42 text_.GetWriteableAccessor(accessor);
43 43
44 if (source->GetFormat() != Orthanc::PixelFormat_Grayscale8 || 44 if (source->GetFormat() != Orthanc::PixelFormat_Grayscale8 ||
45 target.GetFormat() != Orthanc::PixelFormat_BGRA32) 45 accessor.GetFormat() != Orthanc::PixelFormat_BGRA32)
46 { 46 {
47 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); 47 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
48 } 48 }
49 49
50 const unsigned int width = source->GetWidth(); 50 const unsigned int width = source->GetWidth();
51 const Color& color = layer.GetColor(); 51 const Color& color = layer.GetColor();
52 52
53 for (unsigned int y = 0; y < source->GetHeight(); y++) 53 for (unsigned int y = 0; y < source->GetHeight(); y++)
54 { 54 {
55 const uint8_t* p = reinterpret_cast<const uint8_t*>(source->GetConstRow(y)); 55 const uint8_t* p = reinterpret_cast<const uint8_t*>(source->GetConstRow(y));
56 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); 56 uint8_t* q = reinterpret_cast<uint8_t*>(accessor.GetRow(y));
57 57
58 for (unsigned int x = 0; x < width; x++) 58 for (unsigned int x = 0; x < width; x++)
59 { 59 {
60 unsigned int alpha = *p; 60 unsigned int alpha = *p;
61 61