summaryrefslogtreecommitdiff
path: root/src/ui/paint.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-12-02 19:34:30 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-12-02 19:34:30 +0200
commitaa7d9295e56c87802f2bfd3b6b69a56f351aabeb (patch)
tree8d1e0383b3bf2346e1978477c03efd5ff559c796 /src/ui/paint.c
parent8e7c651faa2e7525cc2e4251516585f89b822ab8 (diff)
VisBuf: Respect the Paint origin
Diffstat (limited to 'src/ui/paint.c')
-rw-r--r--src/ui/paint.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c
index b92be27e..439bdd37 100644
--- a/src/ui/paint.c
+++ b/src/ui/paint.c
@@ -41,6 +41,7 @@ void init_Paint(iPaint *d) {
41 d->dst = get_Window(); 41 d->dst = get_Window();
42 d->setTarget = NULL; 42 d->setTarget = NULL;
43 d->oldTarget = NULL; 43 d->oldTarget = NULL;
44 d->oldOrigin = zero_I2();
44 d->alpha = 255; 45 d->alpha = 255;
45} 46}
46 47
@@ -48,6 +49,8 @@ void beginTarget_Paint(iPaint *d, SDL_Texture *target) {
48 SDL_Renderer *rend = renderer_Paint_(d); 49 SDL_Renderer *rend = renderer_Paint_(d);
49 if (!d->setTarget) { 50 if (!d->setTarget) {
50 d->oldTarget = SDL_GetRenderTarget(rend); 51 d->oldTarget = SDL_GetRenderTarget(rend);
52 d->oldOrigin = origin_Paint;
53 origin_Paint = zero_I2();
51 SDL_SetRenderTarget(rend, target); 54 SDL_SetRenderTarget(rend, target);
52 d->setTarget = target; 55 d->setTarget = target;
53 } 56 }
@@ -59,8 +62,10 @@ void beginTarget_Paint(iPaint *d, SDL_Texture *target) {
59void endTarget_Paint(iPaint *d) { 62void endTarget_Paint(iPaint *d) {
60 if (d->setTarget) { 63 if (d->setTarget) {
61 SDL_SetRenderTarget(renderer_Paint_(d), d->oldTarget); 64 SDL_SetRenderTarget(renderer_Paint_(d), d->oldTarget);
65 origin_Paint = d->oldOrigin;
66 d->oldOrigin = zero_I2();
62 d->oldTarget = NULL; 67 d->oldTarget = NULL;
63 d->setTarget = NULL; 68 d->setTarget = NULL;
64 } 69 }
65} 70}
66 71