| 429 | } |
| 430 | |
| 431 | bool LoaderNative::readDimensions() { |
| 432 | if (!valid()) |
| 433 | return false; |
| 434 | if (width_ != 0 || height_ != 0) |
| 435 | return true; |
| 436 | |
| 437 | const DataBuf data = getData(); |
| 438 | if (data.empty()) |
| 439 | return false; |
| 440 | |
| 441 | try { |
| 442 | auto image = ImageFactory::open(data.c_data(), data.size()); |
| 443 | if (!image) |
| 444 | return false; |
| 445 | image->readMetadata(); |
| 446 | |
| 447 | width_ = image->pixelWidth(); |
| 448 | height_ = image->pixelHeight(); |
| 449 | } catch (const Error& /* error */) { |
| 450 | #ifndef SUPPRESS_WARNINGS |
| 451 | EXV_WARNING << "Invalid native preview image.\n"; |
| 452 | #endif |
| 453 | return false; |
| 454 | } |
| 455 | return true; |
| 456 | } |
| 457 | |
| 458 | LoaderExifJpeg::LoaderExifJpeg(PreviewId id, const Image& image, int parIdx) : Loader(id, image) { |
| 459 | const ExifData& exifData = image_.exifData(); |
no test coverage detected