* @ignore
(src, color)
| 227 | * @ignore |
| 228 | */ |
| 229 | tint(src, color) { |
| 230 | // make sure the src is in the cache |
| 231 | let image_cache = this.tinted.get(src); |
| 232 | |
| 233 | if (image_cache === undefined) { |
| 234 | image_cache = new Map(); |
| 235 | this.tinted.set(src, image_cache); |
| 236 | } |
| 237 | |
| 238 | if (!image_cache.has(color)) { |
| 239 | image_cache.set(color, this.renderer.tint(src, color, "multiply")); |
| 240 | } |
| 241 | |
| 242 | return image_cache.get(color); |
| 243 | } |
| 244 | } |
| 245 | export default TextureCache; |