lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master f7e2663: Fix clipping defect (VZ)


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f7e2663: Fix clipping defect (VZ)
Date: Thu, 31 May 2018 12:15:20 -0400 (EDT)

branch: master
commit f7e2663350f61c25a6c4f40a43c75859c35ed506
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Fix clipping defect (VZ)
    
    The corrected anomaly was that a table that extended onto the second
    page of a group quote was printed upside down on that page. That
    anomaly was not observed with the 20180323T1138 release, and is no
    longer observed with HEAD after this commit.
---
 financial.hpp          |  7 ++++++-
 ledger_invariant.cpp   | 17 +++++++++--------
 wx_table_generator.cpp |  6 +++---
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/financial.hpp b/financial.hpp
index c38bbae..b1f489a 100644
--- a/financial.hpp
+++ b/financial.hpp
@@ -25,9 +25,12 @@
 #include "config.hpp"
 
 #include "assert_lmi.hpp"
+#include "bourn_cast.hpp"
 #include "mc_enum_type_enums.hpp"       // mcenum_mode
 #include "zero.hpp"
 
+#include <iterator>                     // iterator_traits
+
 class calendar_date;
 
 // TODO ?? Things to reconsider later:
@@ -188,7 +191,9 @@ OutputIterator const irr
     InputIterator1 bfts = first1;
     for(;pmts != last0; ++bfts, ++result)
         {
-        *result = irr_helper<InputIterator0>(first0, ++pmts, *bfts, 
decimals)();
+        auto z = irr_helper<InputIterator0>(first0, ++pmts, *bfts, decimals)();
+        typedef typename std::iterator_traits<OutputIterator>::value_type T;
+        *result = bourn_cast<T>(z);
         }
     return result;
 }
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 7162dd6..c354215 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -26,6 +26,7 @@
 #include "alert.hpp"
 #include "assert_lmi.hpp"
 #include "basic_values.hpp"
+#include "bourn_cast.hpp"
 #include "contains.hpp"                 // for CalculateIrrs()
 #include "crc32.hpp"
 #include "database.hpp"
@@ -1321,20 +1322,20 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
     LedgerVariant const& Curr_ = LedgerValues.GetCurrFull();
     LedgerVariant const& Guar_ = LedgerValues.GetGuarFull();
 
-    irr(Outlay, Guar_.CSVNet,      IrrCsvGuarInput, Guar_.LapseYear, m, n);
-    irr(Outlay, Guar_.EOYDeathBft, IrrDbGuarInput,  Guar_.LapseYear, m, n);
-    irr(Outlay, Curr_.CSVNet,      IrrCsvCurrInput, Curr_.LapseYear, m, n);
-    irr(Outlay, Curr_.EOYDeathBft, IrrDbCurrInput,  Curr_.LapseYear, m, n);
+    irr(Outlay, Guar_.CSVNet,      IrrCsvGuarInput, 
bourn_cast<int>(Guar_.LapseYear), m, n);
+    irr(Outlay, Guar_.EOYDeathBft, IrrDbGuarInput,  
bourn_cast<int>(Guar_.LapseYear), m, n);
+    irr(Outlay, Curr_.CSVNet,      IrrCsvCurrInput, 
bourn_cast<int>(Curr_.LapseYear), m, n);
+    irr(Outlay, Curr_.EOYDeathBft, IrrDbCurrInput,  
bourn_cast<int>(Curr_.LapseYear), m, n);
 
     if(zero_sepacct_interest_bases_undefined) {irr_initialized_ = true; 
return;}
 
     LedgerVariant const& Curr0 = LedgerValues.GetCurrZero();
     LedgerVariant const& Guar0 = LedgerValues.GetGuarZero();
 
-    irr(Outlay, Guar0.CSVNet,      IrrCsvGuar0,     Guar0.LapseYear, m, n);
-    irr(Outlay, Guar0.EOYDeathBft, IrrDbGuar0,      Guar0.LapseYear, m, n);
-    irr(Outlay, Curr0.CSVNet,      IrrCsvCurr0,     Curr0.LapseYear, m, n);
-    irr(Outlay, Curr0.EOYDeathBft, IrrDbCurr0,      Curr0.LapseYear, m, n);
+    irr(Outlay, Guar0.CSVNet,      IrrCsvGuar0,     
bourn_cast<int>(Guar0.LapseYear), m, n);
+    irr(Outlay, Guar0.EOYDeathBft, IrrDbGuar0,      
bourn_cast<int>(Guar0.LapseYear), m, n);
+    irr(Outlay, Curr0.CSVNet,      IrrCsvCurr0,     
bourn_cast<int>(Curr0.LapseYear), m, n);
+    irr(Outlay, Curr0.EOYDeathBft, IrrDbCurr0,      
bourn_cast<int>(Curr0.LapseYear), m, n);
 
     irr_initialized_ = true;
 }
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index eb19080..ffaa46d 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -755,14 +755,14 @@ void wx_table_generator::do_output_single_row
                 // Make sure that any failure in this chain of assumptions
                 // doesn't result in (undefined) negative clipping.
                 LMI_ASSERT(0 <= ci.col_width() - column_margin());
-                wxDCClipper clip
-                    (dc_
-                    ,wxRect
+                dc_.SetClippingRegion
+                    (wxRect
                         {wxPoint{pos_x, y_top}
                         ,wxSize{ci.col_width() - column_margin(), row_height_}
                         }
                     );
                 dc_.DrawText(s, x_text, y_text);
+                dc_.DestroyClippingRegion();
                 }
             else
                 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]