HEIF: Implement CGDataProviderReleaseInfoCallback

We don't do any releasing, but logging makes it clearer when
CG is done with the data provider we give it.

Change-Id: I520807d0097ff13202849b7ccbc553006436aa1a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-08-15 15:44:28 +02:00 committed by Volker Hilsheimer
parent 896a517b63
commit a4acd375ef
1 changed files with 8 additions and 2 deletions

View File

@ -71,6 +71,10 @@ static size_t cbPutBytes(void *info, const void *buffer, size_t count)
return size_t(qMax(qint64(0), res)); return size_t(qMax(qint64(0), res));
} }
static void cbRelease(void *info)
{
qCDebug(lcImageIO) << "Releasing" << info;
}
QImageIOPlugin::Capabilities QIIOFHelpers::systemCapabilities(const QString &uti) QImageIOPlugin::Capabilities QIIOFHelpers::systemCapabilities(const QString &uti)
{ {
@ -109,8 +113,6 @@ QIIOFHelper::QIIOFHelper(QImageIOHandler *q)
bool QIIOFHelper::initRead() bool QIIOFHelper::initRead()
{ {
static const CGDataProviderSequentialCallbacks cgCallbacks = { 0, &cbGetBytes, &cbSkipForward, &cbRewind, nullptr };
if (cgImageSource) if (cgImageSource)
return true; return true;
if (!q_ptr || !q_ptr->device()) if (!q_ptr || !q_ptr->device())
@ -121,6 +123,10 @@ bool QIIOFHelper::initRead()
const void *rawData = b->data().constData() + b->pos(); const void *rawData = b->data().constData() + b->pos();
cgDataProvider = CGDataProviderCreateWithData(nullptr, rawData, size_t(b->data().size() - b->pos()), nullptr); cgDataProvider = CGDataProviderCreateWithData(nullptr, rawData, size_t(b->data().size() - b->pos()), nullptr);
} else { } else {
static const CGDataProviderSequentialCallbacks cgCallbacks = {
0, // Version, always 0
&cbGetBytes, &cbSkipForward, &cbRewind, &cbRelease
};
cgDataProvider = CGDataProviderCreateSequential(q_ptr->device(), &cgCallbacks); cgDataProvider = CGDataProviderCreateSequential(q_ptr->device(), &cgCallbacks);
} }