-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support multi frame image load #148
base: master
Are you sure you want to change the base?
Conversation
As title. Log: Support multi frame image load. Influence: quickprint
ed671d7
to
d0c05bb
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rb-union The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
TAG Bot New tag: 1.0.47 |
deepin pr auto review代码审查意见:
综合以上意见,建议对代码进行如下修改: QImageReader reader(imagePtr->filePath);
if (s_SingleFrame != imagePtr->frame) {
if (!reader.jumpToImage(imagePtr->frame)) {
qWarning() << QString("Load multi frame image failed(jump to image): %1, file: %2, frame: %3")
.arg(reader.errorString()).arg(imagePtr->filePath).arg(imagePtr->frame);
imagePtr->state = ContentError;
return false;
}
}
if (!reader.canRead()) {
qWarning() << QString("Load multi frame image failed: %1, file: %2, frame: %3")
.arg(reader.errorString()).arg(imagePtr->filePath).arg(imagePtr->frame);
imagePtr->state = ContentError;
return false;
}
imagePtr->data = reader.read();
if (imagePtr->data.isNull()) {
qWarning() << QString("Load multi frame image failed: %1, file: %2, frame: %3")
.arg(reader.errorString()).arg(imagePtr->filePath).arg(imagePtr->frame);
imagePtr->state = ContentError;
return false;
}
try {
// 其他可能抛出异常的代码
} catch (const std::exception &e) {
qCritical() << qPrintable("Exception: load image failed!") << qPrintable(e.what())
<< "File: " << imagePtr->filePath << "Frame: " << imagePtr->frame;
// 处理异常
} 以上修改旨在提高代码的可读性、健壮性和可维护性。 |
TAG Bot New tag: 6.5.0 |
As title.
Log: Support multi frame image load.
Influence: quickprint