MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / load

Method load

src/server/gui/core/resources/TextureData.cpp:139–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139bool TextureData::load() {
140 bool retval = false;
141
142 // Need to load. See if there is a file
143 if (!mPath.empty()) {
144 std::shared_ptr<ResourceManager>& rm = ResourceManager::getInstance();
145 const ResourceData& data = rm->getFileData(mPath);
146
147 if (data.length == 0) {
148 LOG(LogError) << "TextureData::load(): failed to get data for path: " << mPath;
149 return retval;
150 }
151
152 // is it an SVG?
153 if (mPath.substr(mPath.size() - 4, std::string::npos) == ".svg") {
154 mScalable = true;
155 retval = initSVGFromMemory((const unsigned char*) data.ptr.get(), data.length);
156 }
157 else {
158 retval = initImageFromMemory((const unsigned char*) data.ptr.get(), data.length);
159 }
160 }
161
162 return retval;
163}
164
165
166bool TextureData::isLoaded()

Callers 5

waitMethod · 0.45
TextureResourceMethod · 0.45
getMethod · 0.45
rasterizeAtMethod · 0.45
reloadMethod · 0.45

Calls 4

getFileDataMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected