RoundImage are generated asynchronously, so if a view request again the same
image before it generation ends and reach the cache, a new request is recreated
and the image is re-generated. This patch optimize the image generation by
exposing the request as a shared objects that will be shared amongst the
different image that makes the same request.
the cancel signal will call the handleImageResponseFinished callback which calls
resetImageResponse again, the nested call will set m_activeImageResponse to
null, then the first call will try to use disconnect on a null object.
This is an optimization for the rendering by making textures opaque when source image is also opaque.
Instead of clipping the image, a custom geometry denoting rounded rectangular shape is defined.
only delete image response on finished
documentation of QQuickImageResponse mentions that a response may only
be deleted after QQuickImageResponse::finished signal
quote from QQuickImageResponse::cancel signal
```
Note: finished() should not be emitted until the response is complete,
regardless of whether or not cancel() was called. If it is called
prematurely, the engine may destroy the response while it is still active
, leading to a crash.
```
adapt qquickimageresponse to generate round image directly instead of
doing it as a separate task
this saves extra qobject allocation and main loop interruptions
This replaces almost all use of `SIGNAL()` and `SLOT()` with Qt5-style
strongly-typed connections. The `CONNECT()`, and `DCONNECT()` helpers
built around them have been removed.
Cases involving the `BUTTON_*` macros will be tackled in a separate
commit to improve clarity.
A few cases remain using `SIGNAL()` and `SLOT()` for now due to
complications that should be dealt with separately.
previously when the image is found in the cache, the generator
was not reset, this caused an invalid image to be loaded
reset the image generator on update request
they were seperated to optimize conditions when the width and height
changes too frequently, but they occur seldomly, plus caching both
source image and round image costs double memory
previously RoundImage was implemented in QML using Opacitymask which was
slow, new implementation done in cpp using QQuickPaintedItem is around ~5x faster