| 325 | // pixels that are within the bounds of the XYMap. |
| 326 | template <typename XYVisitor> |
| 327 | void draw(const XYMap &xymap, XYVisitor &visitor) { |
| 328 | for (const auto &it : mSparseGrid) { |
| 329 | auto pt = it.first; |
| 330 | if (!xymap.has(pt.x, pt.y)) { |
| 331 | continue; |
| 332 | } |
| 333 | u32 index = xymap(pt.x, pt.y); |
| 334 | const CRGB &color = it.second; |
| 335 | // Only draw non-black pixels (since black represents "no data") |
| 336 | if (color.r != 0 || color.g != 0 || color.b != 0) { |
| 337 | visitor.draw(pt, index, color); |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | static const int kMaxCacheSize = 8; // Max size for tiny cache. |
| 343 | |