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

[fix] ReaderZooming: work around tiles that are too large #4608

Merged
merged 2 commits into from Feb 21, 2019

Conversation

Projects
None yet
2 participants
@Frenzie
Copy link
Member

Frenzie commented Feb 17, 2019

Zooms out until a page can fit in the cache. It's a bit ugly, but better than being stuck. Fixes #3491.

@Frenzie Frenzie added the bug label Feb 17, 2019

[fix] ReaderZooming: work around tiles that are too large
Zooms out until a page can fit in the cache. It's a bit ugly, but better than being stuck. Fixes #3491.

@Frenzie Frenzie force-pushed the Frenzie:zoom-out branch from 88cf2c5 to 938ef61 Feb 17, 2019

@@ -276,6 +277,23 @@ function ReaderZooming:getZoom(pageno)
elseif self.zoom_mode == "free" then
zoom = self.zoom
end
if zoom and zoom > 10 and not Cache:willAccept(zoom * (self.dimen.w * self.dimen.h + 64)) then
logger.dbg("zoom too large, adjusting")
while not Cache:willAccept(zoom * (self.dimen.w * self.dimen.h + 64)) do

This comment has been minimized.

@Frenzie

Frenzie Feb 21, 2019

Author Member

@poire-z There should be a second condition in here to prevent the possibility of endless loops, but I'm not sure what exactly. A simple max_iterations = 50?

This comment has been minimized.

@poire-z

poire-z Feb 21, 2019

Contributor

Dunno. When going towards zero, it should fit isn't it?
But at one point you'll reach zero, or a negative number, so you should probably take care of that too.

This comment has been minimized.

@Frenzie

Frenzie Feb 21, 2019

Author Member

Good point, a simple > 0 should do the trick.

@Frenzie Frenzie merged commit ca6c731 into koreader:master Feb 21, 2019

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@Frenzie Frenzie deleted the Frenzie:zoom-out branch Feb 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.