| 148 | // pixels that are within the bounds of the XYMap. |
| 149 | template <typename XYVisitor> |
| 150 | void draw(const XYMap &xymap, XYVisitor &visitor) { |
| 151 | for (const auto &it : mSparseGrid) { |
| 152 | auto pt = it.first; |
| 153 | if (!xymap.has(pt.x, pt.y)) { |
| 154 | continue; |
| 155 | } |
| 156 | u32 index = xymap(pt.x, pt.y); |
| 157 | u8 value = it.second; |
| 158 | if (value > 0) { // Something wrote here. |
| 159 | visitor.draw(pt, index, value); |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | static const int kMaxCacheSize = 8; // Max size for tiny cache. |
| 165 |