From 7dafdb23163a8cff412eb39e07a3c1d0e451f31a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 8 Jul 2025 23:36:44 +0200 Subject: [PATCH] Fixing bug in first place. Needs testing. --- src/db/db/dbFillTool.cc | 4 ++-- src/db/unit_tests/dbFillToolTests.cc | 32 +++++++++++++++++++++++++++ testdata/algo/fill_tool_au6.oas | Bin 0 -> 484 bytes 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 testdata/algo/fill_tool_au6.oas diff --git a/src/db/db/dbFillTool.cc b/src/db/db/dbFillTool.cc index 0dd69de06..bdd504ab3 100644 --- a/src/db/db/dbFillTool.cc +++ b/src/db/db/dbFillTool.cc @@ -77,14 +77,14 @@ public: } // because the rasterizer can't handle overlapping cells we need to multiply the row and columns steps - // with an integer until the effective rasterizer pitch get big enough. + // with an integer until the effective rasterizer pitch gets big enough. m_row_steps *= (m_dim.x () - 1) / (m_row_steps * m_row_step.x ()) + 1; m_column_steps *= (m_dim.y () - 1) / (m_column_steps * m_column_step.y ()) + 1; db::Box fp_bbox = fp.box (); // compensate for distortion by sheared kernel - fp_bbox.enlarge (db::Vector (db::coord_traits::rounded (double (fp_bbox.height ()) * std::abs (m_column_step.x ()) / dy), db::coord_traits::rounded (double (fp_bbox.width ()) * std::abs (m_row_step.y ()) / dx))); + fp_bbox.enlarge (db::Vector (m_column_step.x () * m_column_steps, m_row_step.y () * m_row_steps)); int columns_per_rows = (int (m_row_steps) * m_row_step.y ()) / dy; int rows_per_columns = (int (m_column_steps) * m_column_step.x ()) / dx; diff --git a/src/db/unit_tests/dbFillToolTests.cc b/src/db/unit_tests/dbFillToolTests.cc index 97ebbfefb..4ce7b53bb 100644 --- a/src/db/unit_tests/dbFillToolTests.cc +++ b/src/db/unit_tests/dbFillToolTests.cc @@ -345,3 +345,35 @@ TEST(5) CHECKPOINT(); db::compare_layouts (_this, ly, tl::testdata () + "/algo/fill_tool_au5.oas", db::WriteOAS); } + +// issue #2087 +TEST(6) +{ + db::Layout ly; + { + std::string fn (tl::testdata ()); + fn += "/algo/fill_tool6.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + db::cell_index_type fill_cell = ly.cell_by_name ("FILL_CELL").second; + db::cell_index_type top_cell = ly.cell_by_name ("TOP").second; + unsigned int fill_layer = ly.get_layer (db::LayerProperties (1, 0)); + + db::Region fill_region (db::RecursiveShapeIterator (ly, ly.cell (top_cell), fill_layer)); + + db::Region remaining_polygons; + + db::Vector rs (2500, 0); + db::Vector cs (650, 2500); + db::Box fc_box = ly.cell (fill_cell).bbox (); + db::fill_region (&ly.cell (top_cell), fill_region, fill_cell, fc_box, rs, cs, db::Point (), false, &remaining_polygons); + + unsigned int l100 = ly.insert_layer (db::LayerProperties (100, 0)); + remaining_polygons.insert_into (&ly, top_cell, l100); + + CHECKPOINT(); + db::compare_layouts (_this, ly, tl::testdata () + "/algo/fill_tool_au6.oas", db::WriteOAS); +} diff --git a/testdata/algo/fill_tool_au6.oas b/testdata/algo/fill_tool_au6.oas new file mode 100644 index 0000000000000000000000000000000000000000..8d679848d672af81b978f97b0f77bff9a0429d3a GIT binary patch literal 484 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKC?n3q!6L)YEF;ds&!EJR>XUoMnybM;fb~F; z;|1o9>4KX(8~>b$4qRRSKbqrK6n{_8gJqfj7kjM>`uae4i==@p6@o7xl`!g z!kWSDvPx3&UChJk1+@vX=X;}N7IkU%=$?`0sg@8wrO$9k{LSJo8n&NaEd89SzT$0! wCN~2!r<