| 90 | } |
| 91 | |
| 92 | uint32_t * |
| 93 | Bitmap::scanline (unsigned int n) |
| 94 | { |
| 95 | if (m_scanlines.empty ()) { |
| 96 | m_scanlines.resize (m_height, 0); |
| 97 | } |
| 98 | |
| 99 | uint32_t *sl = m_scanlines [n]; |
| 100 | if (sl == 0) { |
| 101 | unsigned int b = (m_width + 31) / 32; |
| 102 | if (! m_free.empty ()) { |
| 103 | sl = m_scanlines [n] = m_free.back (); |
| 104 | m_free.pop_back (); |
| 105 | } else { |
| 106 | sl = m_scanlines [n] = new uint32_t [b]; |
| 107 | } |
| 108 | for (uint32_t *p = sl; b > 0; --b) { |
| 109 | *p++ = 0; |
| 110 | } |
| 111 | if (m_first_sl > n) { |
| 112 | m_first_sl = n; |
| 113 | } |
| 114 | if (m_last_sl <= n) { |
| 115 | m_last_sl = n + 1; |
| 116 | } |
| 117 | } |
| 118 | return sl; |
| 119 | } |
| 120 | |
| 121 | void |
| 122 | Bitmap::clear () |