imageFormatsForMimeType: port to QBAV
to reduce allocations Change-Id: Ic48616d0627cb1dfee5f844bee263a59a430d9ba Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
cf066f7d03
commit
b770b0f8b9
@ -113,11 +113,11 @@ QList<QByteArray> supportedMimeTypes(Capability cap)
|
||||
return mimeTypes;
|
||||
}
|
||||
|
||||
QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability cap)
|
||||
QList<QByteArray> imageFormatsForMimeType(QByteArrayView mimeType, Capability cap)
|
||||
{
|
||||
QList<QByteArray> formats;
|
||||
if (mimeType.startsWith("image/")) {
|
||||
const QByteArray type = mimeType.mid(sizeof("image/") - 1);
|
||||
const QByteArrayView type = mimeType.mid(sizeof("image/") - 1);
|
||||
for (const auto &fmt : _qt_BuiltInFormats) {
|
||||
if (fmt.mimeType == type && !formats.contains(fmt.extension))
|
||||
formats << fmt.extension;
|
||||
|
@ -94,7 +94,7 @@ enum Capability {
|
||||
};
|
||||
QList<QByteArray> supportedImageFormats(Capability cap);
|
||||
QList<QByteArray> supportedMimeTypes(Capability cap);
|
||||
QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability cap);
|
||||
QList<QByteArray> imageFormatsForMimeType(QByteArrayView mimeType, Capability cap);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user