aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergiusz Bazanski <q3k@q3k.org>2018-07-27 13:46:44 +0100
committerSergiusz Bazanski <q3k@q3k.org>2018-07-27 13:47:21 +0100
commitdc46eea24d37311e28bc5830e899a77a625a075e (patch)
treee4752b8dac91a03049db9ebd060be532a89576a0
parent96608c8d07dd149c033c98172e79d15e7bd2b69c (diff)
downloadnextpnr-dc46eea24d37311e28bc5830e899a77a625a075e.tar.gz
nextpnr-dc46eea24d37311e28bc5830e899a77a625a075e.tar.bz2
nextpnr-dc46eea24d37311e28bc5830e899a77a625a075e.zip
gui: allow building for ECP5 and on Windows
-rw-r--r--gui/fpgaviewwidget.h20
-rw-r--r--gui/quadtree.h10
2 files changed, 25 insertions, 5 deletions
diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h
index 690b12b8..73021dbe 100644
--- a/gui/fpgaviewwidget.h
+++ b/gui/fpgaviewwidget.h
@@ -143,12 +143,32 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
Inner(WireId _wire) : wire(_wire) {}
Inner(PipId _pip) : pip(_pip) {}
Inner(GroupId _group) : group(_group) {}
+ Inner() {}
} element;
float x, y; // Decal X and Y
PickedElement(BelId bel, float x, float y) : type(ElementType::BEL), element(bel), x(x), y(y) {}
PickedElement(WireId wire, float x, float y) : type(ElementType::WIRE), element(wire), x(x), y(y) {}
PickedElement(PipId pip, float x, float y) : type(ElementType::PIP), element(pip), x(x), y(y) {}
PickedElement(GroupId group, float x, float y) : type(ElementType::GROUP), element(group), x(x), y(y) {}
+ PickedElement(const PickedElement &other) : type(other.type)
+ {
+ switch (type) {
+ case ElementType::BEL:
+ element.bel = other.element.bel;
+ break;
+ case ElementType::WIRE:
+ element.wire = other.element.wire;
+ break;
+ case ElementType::PIP:
+ element.pip = other.element.pip;
+ break;
+ case ElementType::GROUP:
+ element.group = other.element.group;
+ break;
+ default:
+ NPNR_ASSERT_FALSE("Invalid ElementType");
+ }
+ }
DecalXY decal(Context *ctx) const
{
diff --git a/gui/quadtree.h b/gui/quadtree.h
index 22065c2f..b3ebf81c 100644
--- a/gui/quadtree.h
+++ b/gui/quadtree.h
@@ -157,7 +157,7 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
// - any of the 4 children nodes.
enum Quadrant
{
- THIS = -1,
+ THIS_NODE = -1,
NW = 0,
NE = 1,
SW = 2,
@@ -171,7 +171,7 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
Quadrant quadrant(const BoundingBox &b) const
{
if (children_ == nullptr) {
- return THIS;
+ return THIS_NODE;
}
bool west0 = b.x0_ < splitx_;
@@ -187,7 +187,7 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
return SW;
if (!west0 && !west1 && !north0 && !north1)
return SE;
- return THIS;
+ return THIS_NODE;
}
// Checks whether this node should split.
@@ -252,7 +252,7 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
// Put the element either recursively into a child if it fits
// entirely or keep it for ourselves if not.
auto quad = quadrant(k);
- if (quad == THIS) {
+ if (quad == THIS_NODE) {
elems_.push_back(BoundElement(k, std::move(v)));
} else {
return children_[quad].insert(k, std::move(v));
@@ -286,7 +286,7 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
auto it = elems_.begin();
while (it != elems_.end()) {
auto quad = quadrant(it->bb_);
- if (quad != THIS) {
+ if (quad != THIS_NODE) {
// Move to one of the children.
if (!children_[quad].insert(it->bb_, std::move(it->elem_)))
return false;