MCPcopy Create free account
hub / github.com/Tencent/tgfx / readTexture

Method readTexture

src/platform/ImageReader.cpp:91–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91std::shared_ptr<TextureView> ImageReader::readTexture(uint64_t contentVersion, Context* context,
92 bool mipmapped) {
93 std::lock_guard<std::mutex> autoLock(locker);
94 if (contentVersion == textureVersion) {
95 return textureView;
96 }
97 if (contentVersion < bufferVersion) {
98 LOGE(
99 "ImageReader::readTexture(): Failed to read the texture view, the target ImageBuffer is "
100 "already expired!");
101 return nullptr;
102 }
103 bool success = true;
104 if (textureView == nullptr) {
105 textureView = stream->onMakeTexture(context, mipmapped);
106 success = textureView != nullptr;
107 } else {
108 success = stream->onUpdateTexture(textureView);
109 }
110 if (success) {
111 textureView->removeUniqueKey();
112 textureVersion = contentVersion;
113 }
114 return textureView;
115}
116} // namespace tgfx

Callers 1

onMakeTextureMethod · 0.45

Calls 3

onMakeTextureMethod · 0.45
onUpdateTextureMethod · 0.45
removeUniqueKeyMethod · 0.45

Tested by

no test coverage detected