| 412 | } |
| 413 | |
| 414 | Texture2D* TextureCache::getDummyTexture() |
| 415 | { |
| 416 | constexpr std::string_view key = "/dummy-texture"sv; |
| 417 | // Gets the texture by key firstly. |
| 418 | auto texture = this->getTextureForKey(key); |
| 419 | if (texture) |
| 420 | return texture; |
| 421 | |
| 422 | // If texture wasn't in cache, create it from RAW data. |
| 423 | #ifdef NDEBUG |
| 424 | unsigned char texls[] = {0, 0, 0, 0}; // 1*1 transparent picture |
| 425 | #else |
| 426 | unsigned char texls[] = {255, 0, 0, 255}; // 1*1 red picture |
| 427 | #endif |
| 428 | Image* image = new Image(); // Notes: andorid: VolatileTextureMgr traits image as dynmaic object |
| 429 | bool AX_UNUSED isOK = image->initWithRawData(texls, sizeof(texls), 1, 1, sizeof(unsigned char)); |
| 430 | texture = this->addImage(image, key); |
| 431 | image->release(); |
| 432 | return texture; |
| 433 | } |
| 434 | |
| 435 | Texture2D* TextureCache::addImage(std::string_view path) |
| 436 | { |
no test coverage detected