In my answer to this question - Finding the no. of possible right angled triangle. - I derived this result:
If a right triangle has integer sides $a, b, c$ and integer inradius $r$, then all possible values of $a$ and $b$ can be gotten in terms of $r$ as follows:
For every possible divisor $d$ of $2r^2$, $a = 2r+d$ and $b = 2r+\dfrac{2r^2}{d}$. These are exactly the solutions.
From this, of course, the number of solutions depends only on the prime factorization of $r$.
My answer involved some annoyingly complicated algebra.
My question is "is there a geometrical way to show that the expressions for $a$ and $b$ are true?"
(Added later)
Another way to phrase this, without mentioning divisibility:
Take a rectangle of area $2r^2$. Extend the sides by $2r$. Then the inradius of the resulting right triangle is $r$.
As shown in this answer by using Heron's formula, if a generic triangle has integer inradius $r$ and integer sides $a$, $b$, $c$, then its sides can be written as $a=x+y$, $b=x+z$, $c=y+z$, where positive integers $x$, $y$, $z$ satisfy $$ r^2(x+y+z)=xyz. $$ If the triangle is rectangle, Pythagoras' constraint $a^2+b^2=c^2$ translates into the additional relation $x+y+z=yz/x$, which substituted into the above equation gives $x=r$. One can then set $x=r$ in the same equation and solve for $z$, to find: $$ z=r{y+r\over y-r}, \quad\hbox{that is:}\quad z=r+{2r^2\over d}, \ \hbox{where}\ d=y-r. $$ For $z$ to be integer $d$ must be a divisor of $2r^2$ and substituting $x=r$, $y=r+d$, $z=r+2r^2/d$ into the expressions for $a$, $b$ one finds the expressions reported in the question: $$ a=2r+d,\quad b=2r+{2r^2\over d}. $$
EDIT.
There is a simpler geometrical way of getting the same result. As one can see from the diagram below, in a right triangle with legs $a$, $b$, hypotenuse $c$ and inradius $r$ one has: $$ c=a+b-2r. $$
Squaring both sides of that equation gives
$$ 2r(a+b)=2r^2+ab, $$ and one can solve for $b$ to obtain:
$$ b=2r{a-r\over a-2r}. $$ Defining $d=a-2r$ this can be rewritten as $$ b=2r{d+r\over d}=2r+{2r^2\over d}. $$ From that it is apparent that $d$ must be a divisor of $2r^2$ for $a$, $b$ and $r$ to be integers, and one recovers the same results obtained above.