Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak Avatar::Private::get() #711

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Tweak Avatar::Private::get() #711

merged 1 commit into from
Oct 27, 2023

Conversation

KitsuneRal
Copy link
Member

@KitsuneRal KitsuneRal commented Oct 24, 2023

This (further) improves network traffic for Quaternion 0.0.96, now that its image provider is Avatar-aware.

The logic remains mostly the same, except that:

  1. nullptr callbacks are simply ignored, not even reported in Debug mode
  2. The newly requested size has to exceed that of the existing image on both dimensions, not any of them. This allows to freely request sizes like 32x65535 and then 65535x64 without invalidating the cache.
  3. After receiving the image from the network it is stored as is, without immediate scaling to whatever size the request has been initiated with - it is scaled to the requested size before returning the image anyway.
  4. Most of request errors except NetworkError and Timeout (think 400, 403, 404 etc.) invalidate the image source entirely now, avoiding repeated attempts to retrieve an image that is not retrievable.

The rest is mostly better names (_largestRequestedSize instead of _requestedSize, Invalid instead of Banned, etc.), comments and code readability improvements.

The logic remains mostly the same, except that:
1) nullptr callbacks are simply ignored, not even reported in Debug mode
2) The newly requested size has to exceed that of the existing image on
   both dimensions, not any of them. This allows to freely request sizes
   like 32x65535 and then 65535x64 without invalidating the cache.
3) After receiving the image from the network it is stored as is,
   without immediate scaling to whatever size the request has been
   initiated with - it is scaled to the requested size before returning
   the image anyway.
4) Most of request errors except NetworkError and Timeout (think 400,
   403, 404 etc.) invalidate the image source entirely now, avoiding
   repeated attempts to retrieve an image that is not retrievable.

The rest is mostly better names (_largestRequestedSize instead of
_requestedSize, Invalid instead of Banned, etc.), comments and code
readability improvements.
@KitsuneRal KitsuneRal added the enhancement A feature or change request for the library label Oct 24, 2023
@KitsuneRal KitsuneRal merged commit 5af4e78 into dev Oct 27, 2023
28 of 29 checks passed
@KitsuneRal KitsuneRal deleted the kitsune/tweak-avatar-get branch October 27, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or change request for the library
Projects
Status: 0.8 - Done
Development

Successfully merging this pull request may close these issues.

1 participant