Closed bartek-wesolowski closed 8 years ago
This is not really possible, because the code generator does not know anything about the Picture instance, it is coming from the static template.
However, the template can be changed to do a call to a render method which will then be split up into several methods without referring to the Picture instance. I will fix this soon.
The generated code is split into multiple render functions which have the following structure:
public Picture renderToPicture(int width, int height) { ... render_0(canvas); }
private void render_0(Canvas canvas) { ... render_1(canvas); }
private void render_n(Canvas canvas) { .... return picture; }
renderToPicture function does not return any value. The picture is returned only in the last function, which has a void return type.
To fix the bug, the render function should return Picture as well, so the methods could look like this:
public Picture renderToPicture(int width, int height) { ... return render_0(canvas, picture); }
private Picture render_0(Canvas canvas, Picture picture) { ... render_1(canvas, picture); }
private void render_n(Canvas canvas, Picture picture) { .... return picture; }