aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/main.cc
diff options
context:
space:
mode:
authorSergiusz Bazanski <q3k@q3k.org>2018-07-12 21:30:36 +0100
committerSergiusz Bazanski <q3k@q3k.org>2018-07-12 21:30:36 +0100
commit499951cb65ff31fe15aa360a6b44371b13815d66 (patch)
tree8a13613876b17e61b1717288d3cf97a862e270eb /ice40/main.cc
parentb8a42ff53b1fbb6e03d169d14e58180a750f4cad (diff)
downloadnextpnr-499951cb65ff31fe15aa360a6b44371b13815d66.tar.gz
nextpnr-499951cb65ff31fe15aa360a6b44371b13815d66.tar.bz2
nextpnr-499951cb65ff31fe15aa360a6b44371b13815d66.zip
Remove legacy graphics API
For now we do not optimize the OpenGL renderer against the new decal API, but this can be done in the future.
Diffstat (limited to 'ice40/main.cc')
-rw-r--r--ice40/main.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/ice40/main.cc b/ice40/main.cc
index 5fa58921..32864703 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -47,20 +47,22 @@
USING_NEXTPNR_NAMESPACE
-void svg_dump_el(const GraphicElement &el)
+void svg_dump_decal(const Context &ctx, const DecalXY &decal)
{
- float scale = 10.0, offset = 10.0;
- std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\"";
-
- if (el.type == GraphicElement::G_BOX) {
- std::cout << "<rect x=\"" << (offset + scale * el.x1) << "\" y=\"" << (offset + scale * el.y1) << "\" height=\""
- << (scale * (el.y2 - el.y1)) << "\" width=\"" << (scale * (el.x2 - el.x1)) << "\" " << style
- << "/>\n";
- }
+ 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)) {
+ if (el.type == GraphicElement::G_BOX) {
+ std::cout << "<rect x=\"" << (offset + scale * (decal.x + el.x1)) << "\" y=\"" << (offset + scale * (decal.y + el.y1)) << "\" height=\""
+ << (scale * (el.y2 - el.y1)) << "\" width=\"" << (scale * (el.x2 - el.x1)) << "\" " << style
+ << "/>\n";
+ }
- if (el.type == GraphicElement::G_LINE) {
- std::cout << "<line x1=\"" << (offset + scale * el.x1) << "\" y1=\"" << (offset + scale * el.y1) << "\" x2=\""
- << (offset + scale * el.x2) << "\" y2=\"" << (offset + scale * el.y2) << "\" " << style << "/>\n";
+ if (el.type == GraphicElement::G_LINE) {
+ std::cout << "<line x1=\"" << (offset + scale * (decal.x + el.x1)) << "\" y1=\"" << (offset + scale * (decal.y + el.y1)) << "\" x2=\""
+ << (offset + scale * (decal.x + el.x2)) << "\" y2=\"" << (offset + scale * (decal.y + el.y2)) << "\" " << style << "/>\n";
+ }
}
}
@@ -291,12 +293,10 @@ int main(int argc, char *argv[])
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
for (auto bel : ctx.getBels()) {
std::cout << "<!-- " << ctx.getBelName(bel).str(&ctx) << " -->\n";
- for (auto &el : ctx.getBelGraphics(bel))
- svg_dump_el(el);
+ svg_dump_decal(ctx, ctx.getBelDecal(bel));
}
std::cout << "<!-- Frame -->\n";
- for (auto &el : ctx.getFrameGraphics())
- svg_dump_el(el);
+ svg_dump_decal(ctx, ctx.getFrameDecal());
std::cout << "</svg>\n";
}