SDL clip regions

Hello!

I am currently trying to port a very low level window/dialog manager to linux with SDL. The platform I am porting it from has very low level high performance clipping functions for rectangles (e.g. clipSetRect(), clipAddRect(), clipIntersect(), clipUnion()…) which reduces the overdraw factor a lot when blitting/redrawing dirty regions. T

Is this possible for SDL as well? I am aware that a surface can have a single clip rectangle, but the context of a clip “region” is not implemented afaik?

I have tried the code in this thread and faked a clip region with a blending layer:

But the performance is not as good as I expected (at least on my embedded platform) since I have to apply the clipping/blending very often.

Do you have an idea how to implement “fast” clip regions in SDL?
Thanks!