| 93 | } |
| 94 | |
| 95 | static bool |
| 96 | skip_quad (const db::Box &qb, const lay::Bitmap *vertex_bitmap, const db::CplxTrans &trans) |
| 97 | { |
| 98 | double threshold = 32 / trans.mag (); // only check cells below 32x32 pixels |
| 99 | if (qb.empty () || qb.width () > threshold || qb.height () > threshold || !vertex_bitmap) { |
| 100 | return false; |
| 101 | } |
| 102 | |
| 103 | db::DBox qb_trans = (trans * qb) & db::DBox (0, 0, vertex_bitmap->width () - 1.0 - 1e-6, vertex_bitmap->height () - 1.0 - 1e-6); |
| 104 | if (qb_trans.empty ()) { |
| 105 | return true; |
| 106 | } |
| 107 | |
| 108 | int ixmin = (unsigned int)(qb_trans.left () + 0.5); |
| 109 | int ixmax = (unsigned int)(qb_trans.right () + 0.5); |
| 110 | int iymin = (unsigned int)(qb_trans.bottom () + 0.5); |
| 111 | int iymax = (unsigned int)(qb_trans.top () + 0.5); |
| 112 | if (! has_zero_bit (vertex_bitmap, ixmin, iymin, ixmax, iymax)) { |
| 113 | return true; // skip |
| 114 | } else { |
| 115 | return false; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | inline void |
| 120 | copy_bitmap (const lay::Bitmap *from, lay::Bitmap *to, int dx, int dy) |