Basically what !489 (closed) does, but with checking the actual needed scale factor instead of hardcoding 16.
It could still be done better - surface's scale factors are integers so we're only ever getting multiplies of 16 as icon size, but it makes the code simpler since this way cairo handles scale factors for us.
Closes: #139 (closed)