diff OrthancStone/Sources/Fonts/GlyphTextureAlphabet.cpp @ 1571:85e117739eca

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Sep 2020 17:46:39 +0200
parents 244ad1e4e76a
children 4fb8fdf03314
line wrap: on
line diff
--- a/OrthancStone/Sources/Fonts/GlyphTextureAlphabet.cpp	Mon Sep 21 14:50:26 2020 +0200
+++ b/OrthancStone/Sources/Fonts/GlyphTextureAlphabet.cpp	Mon Sep 21 17:46:39 2020 +0200
@@ -56,7 +56,7 @@
     }
       
     virtual void Visit(uint32_t unicode,
-                       const Glyph& glyph)
+                       const Glyph& glyph) ORTHANC_OVERRIDE
     {
       maxWidth_ = std::max(maxWidth_, glyph.GetWidth());
       maxHeight_ = std::max(maxHeight_, glyph.GetHeight());
@@ -125,7 +125,7 @@
       
       
     virtual void Visit(uint32_t unicode,
-                       const Glyph& glyph)
+                       const Glyph& glyph) ORTHANC_OVERRIDE
     {
       if (!glyph.HasPayload())
       {
@@ -138,9 +138,6 @@
         throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
       }
 
-      unsigned int x = column_ * glyphMaxWidth_;
-      unsigned int y = row_ * glyphMaxHeight_;
-
       const Orthanc::ImageAccessor& source = dynamic_cast<const DynamicBitmap&>(glyph.GetPayload()).GetBitmap();
 
       if (source.GetFormat() != Orthanc::PixelFormat_Grayscale8)
@@ -148,10 +145,14 @@
         throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
       }
         
-      targetAlphabet_.Register(unicode, glyph, new TextureLocation(x, y));
+      Orthanc::ImageAccessor target;
 
-      Orthanc::ImageAccessor target;
-      texture_->GetRegion(target, x, y, source.GetWidth(), source.GetHeight());
+      {
+        unsigned int x = column_ * glyphMaxWidth_;
+        unsigned int y = row_ * glyphMaxHeight_;
+        targetAlphabet_.Register(unicode, glyph, new TextureLocation(x, y));
+        texture_->GetRegion(target, x, y, source.GetWidth(), source.GetHeight());
+      }
 
       //Orthanc::ImageProcessing::Copy(target, bitmap->GetBitmap());
 
@@ -214,7 +215,7 @@
                        int y,
                        unsigned int width,
                        unsigned int height,
-                       const Orthanc::IDynamicObject* payload)
+                       const Orthanc::IDynamicObject* payload) ORTHANC_OVERRIDE
     {
       int left = x + offsetX_;
       int top = y + offsetY_;