From a8c84e90a39c54174dd24b5b76bd17aed8311481 Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Fri, 13 Jul 2018 20:53:52 +0100 Subject: Make GUI nice and smooth. --- ice40/arch.cc | 10 +++++++--- ice40/arch.h | 8 ++++++-- ice40/main.cc | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index af6e922c..547dbcd6 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -534,9 +534,8 @@ DecalXY Arch::getGroupDecal(GroupId group) const return decalxy; }; -std::vector Arch::getDecalGraphics(DecalId decal) const +std::vector ArchRProxyMethods::getDecalGraphics(DecalId decal) const { - boost::shared_lock_guard lock(mtx_); std::vector ret; if (decal.type == DecalId::TYPE_FRAME) { @@ -568,7 +567,7 @@ std::vector Arch::getDecalGraphics(DecalId decal) const BelId bel; bel.index = decal.index; - auto bel_type = getBelType(bel); + auto bel_type = parent_->getBelType(bel); if (bel_type == TYPE_ICESTORM_LC) { GraphicElement el; @@ -954,4 +953,9 @@ CellInfo *ArchRWProxyMethods::getCell(IdString cell) return parent_->cells.at(cell).get(); } +UIUpdatesRequired ArchRWProxyMethods::getUIUpdatesRequired(void) +{ + return parent_->getUIUpdatesRequired(); +} + NEXTPNR_NAMESPACE_END diff --git a/ice40/arch.h b/ice40/arch.h index da1e583a..4311f4a5 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -604,8 +604,6 @@ public: // ------------------------------------------------- - std::vector getDecalGraphics(DecalId decal) const; - DecalXY getFrameDecal() const; DecalXY getBelDecal(BelId bel) const; DecalXY getWireDecal(WireId wire) const; @@ -691,6 +689,8 @@ public: IdString getBoundBelCell(BelId bel) const; BelId getBelByName(IdString name) const; + + std::vector getDecalGraphics(DecalId decal) const; }; // A proxy object that keeps an Arch shared/readonly lock until it goes out @@ -750,6 +750,10 @@ public: void bindBel(BelId bel, IdString cell, PlaceStrength strength); // Returned pointer is valid as long as Proxy object exists. CellInfo *getCell(IdString cell); + + + // Methods to be used by UI for detecting whether we need to redraw. + UIUpdatesRequired getUIUpdatesRequired(void); }; // A proxy object that keeps an Arch readwrite lock until it goes out of scope. diff --git a/ice40/main.cc b/ice40/main.cc index e77bdd34..d38c786c 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -51,7 +51,8 @@ void svg_dump_decal(const Context *ctx, const DecalXY &decal) const float scale = 10.0, offset = 10.0; const std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\""; - for (auto &el : ctx->getDecalGraphics(decal.decal)) { + auto &&proxy = ctx->rproxy(); + for (auto &el : proxy.getDecalGraphics(decal.decal)) { if (el.type == GraphicElement::G_BOX) { std::cout << "