MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / loadBMP

Method loadBMP

lib/YAWidgets/src/BitmapWidget.cpp:267–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267bool BitmapWidget::loadBMP(FS& fs, const String& filename)
268{
269 bool isSuccessful = false;
270 BmpImgLoader loader;
271 BmpImgLoader::Ret ret = loader.load(fs, filename, m_bitmap);
272
273 if (BmpImgLoader::RET_OK != ret)
274 {
275 if (BmpImgLoader::RET_FILE_NOT_FOUND == ret)
276 {
277 LOG_ERROR("Failed to open file %s.", filename.c_str());
278 }
279 else if (BmpImgLoader::RET_FILE_FORMAT_INVALID == ret)
280 {
281 LOG_ERROR("File %s has invalid format.", filename.c_str());
282 }
283 else if (BmpImgLoader::RET_FILE_FORMAT_UNSUPPORTED == ret)
284 {
285 LOG_ERROR("File %s has unsupported format.", filename.c_str());
286 }
287 else if (BmpImgLoader::RET_IMG_TOO_BIG == ret)
288 {
289 LOG_ERROR("File %s is too big.", filename.c_str());
290 }
291 else
292 {
293 LOG_ERROR("Failed to load %s because of internal error.", filename.c_str());
294 }
295 }
296 else
297 {
298 /* Release unused memory. */
299 m_gifPlayer.close();
300
301 /* Select image type. */
302 m_imgType = IMG_TYPE_BMP;
303
304 isSuccessful = true;
305 }
306
307 return isSuccessful;
308}
309
310bool BitmapWidget::loadGIF(FS& fs, const String& filename)
311{

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
loadMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected