MCPcopy Create free account
hub / github.com/axmolengine/axmol / getDummyTexture

Method getDummyTexture

core/renderer/TextureCache.cpp:414–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414Texture2D* 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
435Texture2D* TextureCache::addImage(std::string_view path)
436{

Callers 1

setTextureMethod · 0.80

Calls 4

getTextureForKeyMethod · 0.95
addImageMethod · 0.95
initWithRawDataMethod · 0.80
releaseMethod · 0.45

Tested by

no test coverage detected