SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Vita: Fixed absence of clipping when viewport is set

Open Wohlstand opened this issue 6 months ago • 2 comments

Resolves a problem of viewport on the Vita set by SDL_RenderSetViewport() that doesn't sets any clipping by default.

How it looked before the fix: изображение

How it supposed to look everywhere (after fix): изображение

Description

This solution sets the cliprect in shadow when real cliprect is unused. And when cliprect gets reset, the viewport's rect gets set when viewport is set (the width and height gets compared to the size of the drawable area such as screen or texture).

Existing Issue(s)

#13034

Wohlstand avatar Jun 08 '25 22:06 Wohlstand

This fix is much better than the existing behavior, but I think it might not handle the case where a manually-specified clip rect is larger than the viewport.

ds-sloth avatar Jun 09 '25 00:06 ds-sloth

This fix is much better than the existing behavior, but I think it might not handle the case where a manually-specified clip rect is larger than the viewport.

A good case, then it's need to cut down the clip rect when viewport is set, and rectangle is out of viewport's range.

Wohlstand avatar Jun 09 '25 01:06 Wohlstand

@slouken, ping? I also made the limiting of the scope so true croprect will never go out of viewport's range. And I tested that behaviour on my end already. Now it should be ready to merge, but if any objections, please tell me what I should to change in the code, and I'll apply that as fast as possible.

Wohlstand avatar Jun 18 '25 22:06 Wohlstand

I went ahead and merged this. Can you make a similar PR for SDL3?

slouken avatar Jun 20 '25 20:06 slouken

I went ahead and merged this. Can you make a similar PR for SDL3?

Let me make an attempt...

Wohlstand avatar Jun 20 '25 21:06 Wohlstand