Skip to content

Commit

Permalink
Merge pull request #313 from felix-salfelder/neg
Browse files Browse the repository at this point in the history
remove another two too optimistic assertions.
  • Loading branch information
guitorri committed Jul 18, 2015
2 parents b9ae939 + 855c0bf commit 3ab4c28
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions qucs/qucs/diagrams/graph.cpp
Expand Up @@ -17,6 +17,7 @@
#include "graph.h"

#include <stdlib.h>
#include <iostream>

#include <QPainter>
#include <QDebug>
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
Expand Down

0 comments on commit 3ab4c28

Please sign in to comment.