Commit Graph

35 Commits

Author SHA1 Message Date
Prince Gupta dafc146cf8 qt: fix leak of network resources from RoundImage
also add documentation to address ambiguity in object ownership
2024-03-23 09:13:35 +00:00
Prince Gupta cc922574c6 qt: fix possible infinite loading in RoundImage
correctly handle error for custom generators
2024-03-23 09:13:35 +00:00
Pierre Lamot e1b09a5bf5 qt: optimize RoundImage generation
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.
2023-05-31 09:35:34 +00:00
Johannes Kauffmann 35209fff7c Remove double trailing semicolons
Only matching ";;\n", replaced with:

  grep -lIR --include=*.{c,h,cpp,hpp} ";;\$" | xargs sed -i 's/;;\{1,\}$/;/'
2023-04-27 06:24:26 +00:00
Alexandre Janniaux 739964544b qt: roundimage: fix missing return 2023-01-11 14:35:06 +00:00
Pierre Lamot fe07979f55 qt: fix crash when cancelling round image generation
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.
2022-09-27 19:03:20 +00:00
Johannes Kauffmann 9cd160830b qt: roundimage: add missing override 2022-08-11 07:26:56 +00:00
Fatih Uzunoglu 0f9b7e6871 qt: fix dpr adjustment in RoundImage
A window is assigned to a QQuickItem after it gets constructed.
2022-07-29 06:19:05 +00:00
Fatih Uzunoglu 4436ec7539 qt: use custom geometry instead of clipping the image in RoundImage
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.
2022-07-29 06:19:05 +00:00
Fatih Uzunoglu 996deea589 qt: rename applyRadius() to prepareImage() in RoundImage
applyRadius() does more than its name suggests.
2022-07-29 06:19:05 +00:00
Prince Gupta 75f7213abf qt: fix image response handling
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.
```
2022-07-25 18:25:04 +00:00
Prince Gupta 8afb6b9b54 qt: remove unused class 2022-07-25 18:25:04 +00:00
Prince Gupta 7e4fe56034 qt: add status() in roundimage 2022-06-19 12:32:30 +05:30
Prince Gupta 1cc9f502ea qt: improve round image generation in roundimage
adapt qquickimageresponse to generate round image directly instead of
doing it as a separate task

this saves extra qobject allocation and main loop interruptions
2022-06-18 16:11:27 +00:00
Prince Gupta 048417069f qt: increase cache size of round image
this is done to improve caching of generated cover
2022-06-11 15:44:58 +00:00
Prince Gupta 2aa6e7220d qt: improve network image reading in roundimage
removes blocking call when reading network image
2022-06-11 15:44:58 +00:00
Prince Gupta 4082222dd8 qt: support image provider in RoundImage 2022-06-11 15:44:58 +00:00
Prince Gupta 19cc1b3574 qt: simplify image assignment in roundimage 2022-06-11 15:44:58 +00:00
Prince Gupta 34ef225b1f qt: reset old contents while loading new in roundimage
fixes #26990
2022-05-28 12:46:19 +00:00
Pierre Lamot 0768eef6ce qt: fix warning when generating RoundImage with no source
fix: #26671
2022-04-03 16:39:51 +00:00
Fatih Uzunoglu 4333661cdf qt: remove unnecessary member in RoundImage 2022-04-01 12:24:27 +00:00
Fatih Uzunoglu 88c518596b qt: remove getPath() from RoundImage 2022-04-01 12:24:27 +00:00
Fatih Uzunoglu 38c2a7ecbf qt: avoid explicit QPainter calls in RoundImage 2022-04-01 12:24:27 +00:00
Fatih Uzunoglu 9cbeacfcf7 qt: handle case when radius is 0 in RoundImage 2022-04-01 12:24:27 +00:00
Fatih Uzunoglu f2df0011a4 qt: prefer Format_ARGB32_Premultiplied to Format_ARGB32 in RoundImage 2022-04-01 12:24:27 +00:00
Lyndon Brown eb0b785fdf qt: use strongly-typed connects
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.
2022-02-25 06:47:40 +00:00
Prince Gupta 5c9ae3119a qt/RoundImage: handle network reply error 2022-02-13 10:20:31 +00:00
Prince Gupta 9734618e40 qt/RoundImage: fix typo in variable name 2022-02-13 10:20:31 +00:00
Prince Gupta 42dd825cff qt/RoundImage: fix incorrect image displayed
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
2022-02-13 10:20:31 +00:00
Fatih Uzunoglu d7aac5eaec qt: set TextureCanUseAtlas flag in RoundImage 2022-01-28 17:38:16 +00:00
Fatih Uzunoglu 76379ba010 qt: use scene graph to render RoundImage 2022-01-09 11:53:29 +00:00
Prince Gupta a0d14a303c qt/roundimage: implement caching 2021-05-22 19:04:05 +00:00
Prince Gupta a2afa3a6f3 qt/roundimage: use QImageReader 2021-05-22 19:04:05 +00:00
Prince Gupta ecbe4ea69d qt/roundimage: unify loading and round image generation stage
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
2021-05-22 19:04:05 +00:00
Prince Gupta dcdaff4091 qt, qml: provide RoundImage implementation from cpp
previously RoundImage was implemented in QML using Opacitymask which was
slow, new implementation done in cpp using QQuickPaintedItem is around ~5x faster
2021-04-29 12:15:36 +00:00