diff options
Diffstat (limited to 'src/ui/paint.c')
-rw-r--r-- | src/ui/paint.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c index af62f908..71ebb81d 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c | |||
@@ -65,10 +65,33 @@ void endTarget_Paint(iPaint *d) { | |||
65 | 65 | ||
66 | void setClip_Paint(iPaint *d, iRect rect) { | 66 | void setClip_Paint(iPaint *d, iRect rect) { |
67 | //rect = intersect_Rect(rect, rect_Root(get_Root())); | 67 | //rect = intersect_Rect(rect, rect_Root(get_Root())); |
68 | addv_I2(&rect.pos, origin_Paint); | ||
68 | if (isEmpty_Rect(rect)) { | 69 | if (isEmpty_Rect(rect)) { |
69 | rect = init_Rect(0, 0, 1, 1); | 70 | rect = init_Rect(0, 0, 1, 1); |
70 | } | 71 | } |
71 | addv_I2(&rect.pos, origin_Paint); | 72 | // iRect root = rect_Root(get_Root()); |
73 | iRect targetRect = zero_Rect(); | ||
74 | SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d)); | ||
75 | if (target) { | ||
76 | SDL_QueryTexture(target, NULL, NULL, &targetRect.size.x, &targetRect.size.y); | ||
77 | rect = intersect_Rect(rect, targetRect); | ||
78 | } | ||
79 | else { | ||
80 | rect = intersect_Rect(rect, rect_Root(get_Root())); | ||
81 | } | ||
82 | |||
83 | /*if (rect.pos.x < 0) { | ||
84 | adjustEdges_Rect(&rect, 0, 0, 0, -rect.pos.x); | ||
85 | } | ||
86 | if (rect.pos.y < 0) { | ||
87 | adjustEdges_Rect(&rect, -rect.pos.y, 0, 0, 0); | ||
88 | } | ||
89 | if (right_Rect(rect) > right_Rect(root)) { | ||
90 | adjustEdges_Rect(&rect, 0, right_Rect(root) - right_Rect(rect), 0, 0); | ||
91 | } | ||
92 | if (bottom_Rect(rect) > bottom_Rect(root)) { | ||
93 | adjustEdges_Rect(&rect, 0, bottom_Rect(root) - bottom_Rect(rect), 0, 0); | ||
94 | }*/ | ||
72 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); | 95 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); |
73 | } | 96 | } |
74 | 97 | ||