diff options
author | ConfuSomu | 2024-03-24 21:10:57 -0400 |
---|---|---|
committer | ConfuSomu | 2024-03-24 21:10:57 -0400 |
commit | 4142690acd68dde59d0a6b16ccdda12f9195f304 (patch) | |
tree | cfeb5d2ec22335a765d4ee602cca2fd7a5c5bf71 /src/activitypub/apattachment.h | |
parent | 13c3f52f9b5027d5b1ead5f8b828da3bebd50937 (diff) | |
download | ActorViewer-4142690acd68dde59d0a6b16ccdda12f9195f304.tar ActorViewer-4142690acd68dde59d0a6b16ccdda12f9195f304.tar.gz ActorViewer-4142690acd68dde59d0a6b16ccdda12f9195f304.zip |
Recreate QPixmap in get_pixmap() if size differs
The pixmap should have the size requested and not the original size.
Note that it may be better to do resizing on the callee/method user side
as recreating a pixmap instead of scaling an existing one is expensive.
Diffstat (limited to 'src/activitypub/apattachment.h')
-rw-r--r-- | src/activitypub/apattachment.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/activitypub/apattachment.h b/src/activitypub/apattachment.h index f4e620b..83e9339 100644 --- a/src/activitypub/apattachment.h +++ b/src/activitypub/apattachment.h @@ -23,6 +23,14 @@ private: QString filename; // nicer descriptor of the attachment's path QPixmap* pixmap = nullptr; + struct { + int width = 0; + int height = 0; + // Compare with dimensions passed to get_pixmap() + inline bool is_equal(int comp_w, int comp_h) { + return width == comp_w and height == comp_h; + } + } pixmap_dimens; // requested dimensions of the pixmap }; class APAttachmentList : public std::vector<APAttachment>, APBase { |