MCPcopy Create free account
hub / github.com/KLayout/klayout / render_fill

Method render_fill

src/laybasic/laybasic/layBitmap.cc:431–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429};
430
431void
432Bitmap::render_fill (std::vector<lay::RenderEdge> &edges)
433{
434 // sort the edges so we can operate on the sorted list
435 tl::sort (edges.begin (), edges.end ());
436
437 double y = std::max (0.0, floor (edges.begin ()->y1 ()));
438 std::vector<lay::RenderEdge>::iterator done = edges.begin ();
439
440 // this is generic case
441 while (done != edges.end () && y < height ()) {
442
443 for ( ; done != edges.end (); ++done) {
444 if (! done->done (y)) {
445 break;
446 }
447 }
448
449 std::vector<lay::RenderEdge>::iterator todo = done;
450
451 for ( ; todo != edges.end (); ++todo) {
452 if (todo->done (y)) {
453 std::swap (*done, *todo);
454 ++done;
455 }
456 if (todo->todo (y)) {
457 break;
458 }
459 }
460
461 std::vector<lay::RenderEdge>::iterator e;
462 for (e = done; e != todo; ++e) {
463 e->set_pos (e->x1 () + e->slope () * (y - e->y1 ()));
464 }
465
466 PosCompareF f;
467 tl::sort (done, todo, f);
468
469 int c = 0;
470 bool x1set = false;
471 double x1 = 0;
472 unsigned int yint = (unsigned int) (y + 0.5);
473
474 for (e = done; e != todo; ++e) {
475 if (! e->is_horizontal ()) {
476 c += e->delta ();
477 if (c == 0) { // this is implementing the != 0 rule
478 if (e->pos () > 0) {
479 unsigned int x1int = 0;
480 if (x1 > 0.0) {
481 x1int = (unsigned int) x1;
482 if (double (x1int) != x1) {
483 ++x1int;
484 }
485 }
486 fill (yint, x1int, (unsigned int) std::min (double (width () - 1), e->pos ()) + 1);
487 }
488 x1set = false;

Callers 1

layRenderer.ccFile · 0.45

Calls 15

sortFunction · 0.85
maxFunction · 0.85
minFunction · 0.85
y1Method · 0.80
todoMethod · 0.80
set_posMethod · 0.80
slopeMethod · 0.80
is_horizontalMethod · 0.80
deltaMethod · 0.80
heightFunction · 0.70
widthFunction · 0.70
swapFunction · 0.50

Tested by

no test coverage detected