Browse Source

wallet: gfx, dont allow negative dim for viewport/scissor rect

darkfi 1 year ago
parent
commit
309474c633
1 changed files with 5 additions and 0 deletions
  1. 5 0
      bin/darkwallet/src/gfx/mod.rs

+ 5 - 0
bin/darkwallet/src/gfx/mod.rs

@@ -246,6 +246,11 @@ impl<'a> RenderContext<'a> {
         let view_w = view.w.round() as i32;
         let view_w = view.w.round() as i32;
         let view_h = view.h.round() as i32;
         let view_h = view.h.round() as i32;
 
 
+        // OpenGL does not like negative values here
+        if view_w <= 0 || view_h <= 0 {
+            return
+        }
+
         //if DEBUG_RENDER {
         //if DEBUG_RENDER {
         //    debug!(target: "gfx", "=> viewport {view_x} {view_y} {view_w} {view_h}");
         //    debug!(target: "gfx", "=> viewport {view_x} {view_y} {view_w} {view_h}");
         //}
         //}