https://bugs.kde.org/show_bug.cgi?id=448593

--- Comment #9 from caulier.gil...@gmail.com ---
Another important remark :

In this function :
https://github.com/cathaysia/digikamflowplugin/blob/master/src/PicFlowView.cpp#L169

you access to image directly by a QPixmap() call to later create label in GUI
over a loop. This is so far not optimal.

1/ Do not use QPixmap directly. digiKam has a multithread image preview API
with a cache mechanism to speed up image data handling with huge album
contents. It's accessible from plugins of course. Look use of PreviewLoadThread
in Slideshow plugin here :

https://invent.kde.org/graphics/digikam/-/blob/master/core/dplugins/generic/view/slideshow/widgets/slideimage.cpp#L76

2 instances are used, internally, both use a common cache to optimize memory
usage. One instance preload image in cache, one is used to load current image.
Both instance will use a separated thread to run. A signal is emitted when
image is available as DImg which thread safe (in opposite of QPixmap). You can
convert DImg as QImage or QPixmap of course.

API :

DImg :
https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/dimg/dimg.h
PreviewLoadThread :
https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/threadimageio/preview/previewloadthread.h

2/ The forever loop here :

https://github.com/cathaysia/digikamflowplugin/blob/master/src/PicFlowView.cpp#L258

...will be time consuming to render large album. Use preview load thread and
signal/slot mechanism to not freeze GUI. If you need to play with image data,
use a separated thread with QImage, not QPixmap. Only play with widget on main
thread at end. All consuming CPU task as loop must be done in separated thread.
Use profiling for that. if necessary

3/ Remove definitively the database headers
https://github.com/cathaysia/digikamflowplugin/blob/master/src/PicFlowView.cpp#L258
Generic plugin must not use database at all.

4/ why do you mix Qt and C++ API where Qt propose equivalent, optimized, and
portable classes ? c++::semaphore for ex.

5/ Please use English comments and documentations everywhere. It's difficult to
use a translator over source code to read explanations.

6/ In dependencies list i can see spdlog API. Do not add this extra dependency
if.... Qt do the job with QDebug API and is enough for a plugin...

I don't yet compiled your code. I will do it later.

Best regards

Gilles Caulier

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to