I have a program where I need to "tile" a texture onto a rectangle whose dimensions are not exactly dividable into the texture's dimensions. So I have to crop the image at the right and bottom edges of the rectangle since I start drawing it at the top left. But when I draw these cropped, edge images, the program runs out of memory. Here is my code:
See the continue statements? They are there so that it does not end up drawing the image after I crop it. If I remove the continue statements in the above code, my program crashes from a memory leak very quickly. If I keep the continue statements, it runs perfectly normal. Any idea on how to fix this or why this is happening?