Skip to content

Conversation

@IntraCherche
Copy link

Size image involves w * h * scale squared

Size image involves w * h * scale squared
@THausherr
Copy link
Contributor

why squared?

@IntraCherche
Copy link
Author

IntraCherche commented Dec 31, 2020

Because the code checks if ((long) widthPx * (long) heightPx > Integer.MAX_VALUE) and widthPx and heightPx are defined as

int widthPx = (int) Math.max(Math.floor(widthPt * scale), 1);
int heightPx = (int) Math.max(Math.floor(heightPt * scale), 1);

But then the error message uses widthPt and heightPt (not widthPx and heightPx as in the if check). So if you rewrite the the if check (just to understand) with widthPt and heightPt instead of widthPx and heightPx, you get :
widthPx * heightPx = widthPt * scale * heightPt * scale which in turn yields to widthPt * heightPt * scale * scale or widthPt * heightPt * scale ^ 2 which is the proposed update.

@THausherr
Copy link
Contributor

Of course 😂
Good observation!

asfgit pushed a commit that referenced this pull request Dec 31, 2020
@asfgit asfgit closed this in 4f83fb4 Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants