void QTessellatorPrivate::emitEdges(QTessellator *tessellator) { //QDEBUG() << "TRAPS:"; if (!scanline.old_size) return; // emit edges if (winding) { // winding fill rule int w = 0; scanline.old[0]->y_left = y; for (int i = 0; i < scanline.old_size - 1; ++i) { Edge *left = scanline.old[i]; Edge *right = scanline.old[i+1]; w += left->winding; // qDebug() << "i=" << i << "edge->winding=" << left->winding << "winding=" << winding; if (w == 0) { left->y_right = y; right->y_left = y; } else if (!emit_clever || left->mark || right->mark) { Q27Dot5 top = qMax(left->y_right, right->y_left); if (top != y) { QTessellator::Trapezoid trap; fillTrapezoid(top, y, left->edge, right->edge, vertices, &trap); tessellator->addTrap(trap); // QDEBUG() << " top=" << Q27Dot5ToDouble(top) << "left=" << left->edge << "right=" << right->edge; } right->y_left = y; left->y_right = y; } left->mark = false; } if (scanline.old[scanline.old_size - 1]->mark) { scanline.old[scanline.old_size - 1]->y_right = y; scanline.old[scanline.old_size - 1]->mark = false; } } else { // odd-even fill rule for (int i = 0; i < scanline.old_size; i += 2) { Edge *left = scanline.old[i]; Edge *right = scanline.old[i+1]; if (!emit_clever || left->mark || right->mark) { Q27Dot5 top = qMax(left->y_right, right->y_left); if (top != y) { QTessellator::Trapezoid trap; fillTrapezoid(top, y, left->edge, right->edge, vertices, &trap); tessellator->addTrap(trap); } // QDEBUG() << " top=" << Q27Dot5ToDouble(top) << "left=" << left->edge << "right=" << right->edge; left->y_left = y; left->y_right = y; right->y_left = y; right->y_right = y; left->mark = right->mark = false; } } } }
void GridHealerVertical::doHealingOnBelowAndAboveRangePair (QImage &image, int yBelowStart, int yBelowEnd, int yAboveStart, int yAboveEnd) { // LOG4CPP_INFO_S is replaced by GridLog int x0 = m_blackPixelsBelow [yBelowStart]; int x1 = m_blackPixelsBelow [yBelowEnd ]; int x2 = m_blackPixelsAbove [yAboveEnd ]; int x3 = m_blackPixelsAbove [yAboveStart]; int y0 = yBelowStart; int y1 = yBelowEnd; int y2 = yAboveEnd; int y3 = yAboveStart; gridLog().showOutputTrapezoid (QPoint (x0, y0), QPoint (x1, y1), QPoint (x2, y2), QPoint (x3, y3)); if (pointsAreGood (image, x0, y0, x2, y2)) { // Big enough so keep it. Four points that define the trapezoid to be filled in fillTrapezoid (image, x0, y0, x1, y1, x2, y2, x3, y3); } }