From 855c0bf6e783dc1a35cee05e8368008c79a25b5e Mon Sep 17 00:00:00 2001 From: Felix Salfelder Date: Thu, 16 Jul 2015 11:32:05 +0200 Subject: [PATCH] remove another two too optimistic assertions. negative screen coordinates are used to control the painter. just not always. eject a warning for now. --- qucs/qucs/diagrams/graph.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/qucs/qucs/diagrams/graph.cpp b/qucs/qucs/diagrams/graph.cpp index 840ba1e4f0..eb6355dba2 100644 --- a/qucs/qucs/diagrams/graph.cpp +++ b/qucs/qucs/diagrams/graph.cpp @@ -17,6 +17,7 @@ #include "graph.h" #include +#include #include #include @@ -312,14 +313,21 @@ bool Graph::ScrPt::isStrokeEnd() const{return ScrX<=STROKEEND;} bool Graph::ScrPt::isBranchEnd() const{return ScrX<=BRANCHEND;} bool Graph::ScrPt::isGraphEnd() const{return ScrX<=GRAPHEND;} +/*! + * set screen coordinate for graph sampling point + * these must be nonnegative, but sometimes aren't, + * eg. between calcCoordinate and clip. + * (negative values are reserved for control.) + */ void Graph::ScrPt::setScrX(float x) { - assert(x>=0); - if(ScrX>=0){ - ScrX = x; - }else{ - assert(false); // incomplete; + if(x<0){ + std::cerr << "dangerous: negative screen coordinate" << x; + } + if(ScrX<0){ + std::cerr << "dangerous: (maybe) overwriting control token" << x; } + ScrX = x; } void Graph::ScrPt::setScrY(float x) { @@ -345,7 +353,9 @@ void Graph::ScrPt::setDep(double x) } float Graph::ScrPt::getScrX() const { - assert(ScrX>=0); + if(ScrX<0){ + std::cerr << "dangerous: returning negative screen coordinate" << ScrX; + } return ScrX; } float Graph::ScrPt::getScrY() const