Question About Drawing Off-Screen

I'm experimenting with the C API. I made a 2D camera system and for that I implemented some custom draw functions that work with transformed coordinates. I'm using drawLine and drawBitmap here mostly as a base. Since I don't have my unit yet, I can't stress test stuff but I'm wondering about performance when drawing things with coordinates outside of the screen.

How are lines and bitmaps handled when coordinates are passed which are outside the screen? Should I implement my own culling?

1 Like

Just chiming in because I'm very much wondering this as well.

You could just do a performance benchmark, right? Where you take an image and compare:

-draw it fully on screen
-draw it fully off screen
-use a bounding box check and only draw it if it is inside the camera view. Use coordinates that are fully off screen

Do the above in a 1000 iterations loop and measure the time it takes.

A very interesting result would be that the bounding box method would be slower than the fully off screen case. That would mean the api does its own internal check and if you implement it yourself you are doubling the cpu time spent on that

In the meantime I did implement bounds checking and that was very much faster than drawing offscreen

Oh, I glossed over the part where you said you don't have a playdate yet. In that case, this should be relevant to you.