-
Notifications
You must be signed in to change notification settings - Fork 187
Simplify newImageData pass integer zoom instead of zoomContext #2803
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
base: master
Are you sure you want to change the base?
Simplify newImageData pass integer zoom instead of zoomContext #2803
Conversation
51d9bc0 to
766cc96
Compare
|
@arunjose696 @akoch-yatta I'd like to make you aware of where I found the whole concept of passing zoom values (only) both hard to use reliable (e.g. zoom is only integer value while one requires sometimes fractional) and unflexible (one has to compute a suitable zoom level in the "upper layer" to get a matching image while one usually knows the target size quite well. I therefore like to suggest to rethink the concept of zoom levels really match well for image providers (I think it does not). and not unify this to instead always use a target size what can trivially be derived from a given initial size and zoom level. Such a FYI @HeikoKlare |
|
@laeubi I’m not sure if PR 3431 I’m also slightly confused by the approach in your proposal: having default values for height and width in the TargetSize record feels a bit counterintuitive. I would expect this to be seperated, or wouldnt the callers requesting image at a target size need to know about the default size of the image? That said, I think these two PRs are unrelated and can be treated separately and if we need to have a target size along with zoom that would be a different proposal. I have also breifly reviewed the open PR |
All callers currently use a zoom context with targetZoom == nativeZoom. This change passes a single integer zoom to AbstractImageProviderWrapper::newImageData, removing the unnecessary zoomContext parameter.
766cc96 to
a58a38d
Compare
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change is a pure refactoring/simplification and fine as such. I have two minor comments.
| ImageData newImageData(ZoomContext zoomContext) { | ||
| int targetZoom = zoomContext.targetZoom(); | ||
| ImageData newImageData(int zoom) { | ||
| int targetZoom = zoom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetZoom could be completely removed here
| ImageData newImageData(int zoom) { | ||
| Function<Integer, ImageData> imageDataRetrieval = zoomToRetrieve -> { | ||
| ImageHandle handle = initializeHandleFromSource(zoomContext); | ||
| ImageHandle handle = initializeHandleFromSource(new ZoomContext(zoom)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of consistency, shouldn't this anyway be ... ?
| ImageHandle handle = initializeHandleFromSource(new ZoomContext(zoom)); | |
| ImageHandle handle = initializeHandleFromSource(new ZoomContext(zoomToRetrieve)); |
All callers currently use a zoom context with targetZoom == nativeZoom. This change passes a single integer zoom to AbstractImageProviderWrapper::newImageData, removing the unnecessary zoomContext parameter.