fix: isFormatSupported now correctly extracts extension

Address review comment #6:
- isFormatSupported() was passing the full path to supportsFormat()
  which only matches extensions like ".jpg", so it always returned false
- Delegate to getDecoder() which correctly extracts the extension first
This commit is contained in:
Martin Brook 2026-01-30 17:48:40 +00:00
parent 72c2cea089
commit 12e9c3e29a

View File

@ -50,13 +50,7 @@ ImageToFramebufferDecoder* ImageDecoderFactory::getDecoder(const std::string& im
}
bool ImageDecoderFactory::isFormatSupported(const std::string& imagePath) {
if (jpegDecoder && jpegDecoder->supportsFormat(imagePath)) {
return true;
}
if (pngDecoder && pngDecoder->supportsFormat(imagePath)) {
return true;
}
return false;
return getDecoder(imagePath) != nullptr;
}
std::vector<std::string> ImageDecoderFactory::getSupportedFormats() {