| 217 | } |
| 218 | |
| 219 | void TilemapLayer::DrawTileImpl(Bitmap& dst, Bitmap& tileset, Bitmap& tone_tileset, int x, int y, int row, int col, uint32_t tone_hash, ImageOpacity op, bool allow_fast_blit) { |
| 220 | |
| 221 | auto rect = Rect{ col * TILE_SIZE, row * TILE_SIZE, TILE_SIZE, TILE_SIZE }; |
| 222 | |
| 223 | auto* src = &tileset; |
| 224 | |
| 225 | // Create tone changed tile |
| 226 | if (tone != Tone()) { |
| 227 | if (chipset_tone_tiles.insert(tone_hash).second) { |
| 228 | tone_tileset.ToneBlit(col * TILE_SIZE, row * TILE_SIZE, tileset, rect, tone, Opacity::Opaque()); |
| 229 | } |
| 230 | src = &tone_tileset; |
| 231 | } |
| 232 | |
| 233 | bool use_fast_blit = fast_blit && allow_fast_blit; |
| 234 | if (op == ImageOpacity::Opaque || use_fast_blit) { |
| 235 | dst.BlitFast(x, y, *src, rect, 255); |
| 236 | } else { |
| 237 | dst.Blit(x, y, *src, rect, 255); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | static uint32_t MakeFTileHash(int id) { |
| 242 | return static_cast<uint32_t>(id); |