diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/paint.c | 7 | ||||
-rw-r--r-- | src/ui/paint.h | 1 | ||||
-rw-r--r-- | src/ui/visbuf.c | 3 |
3 files changed, 10 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) { | |||
59 | void endTarget_Paint(iPaint *d) { | 62 | void 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 | ||
diff --git a/src/ui/paint.h b/src/ui/paint.h index e894b62f..dfc9260d 100644 --- a/src/ui/paint.h +++ b/src/ui/paint.h | |||
@@ -33,6 +33,7 @@ struct Impl_Paint { | |||
33 | iWindow * dst; | 33 | iWindow * dst; |
34 | SDL_Texture *setTarget; | 34 | SDL_Texture *setTarget; |
35 | SDL_Texture *oldTarget; | 35 | SDL_Texture *oldTarget; |
36 | iInt2 oldOrigin; | ||
36 | uint8_t alpha; | 37 | uint8_t alpha; |
37 | }; | 38 | }; |
38 | 39 | ||
diff --git a/src/ui/visbuf.c b/src/ui/visbuf.c index 8f7a4c46..0097b12a 100644 --- a/src/ui/visbuf.c +++ b/src/ui/visbuf.c | |||
@@ -21,6 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
22 | 22 | ||
23 | #include "visbuf.h" | 23 | #include "visbuf.h" |
24 | #include "paint.h" | ||
24 | #include "window.h" | 25 | #include "window.h" |
25 | #include "util.h" | 26 | #include "util.h" |
26 | 27 | ||
@@ -224,6 +225,8 @@ void draw_VisBuf(const iVisBuf *d, const iInt2 topLeft, const iRangei yClipBound | |||
224 | continue; /* Outside the clipping area. */ | 225 | continue; /* Outside the clipping area. */ |
225 | #endif | 226 | #endif |
226 | } | 227 | } |
228 | dst.x += origin_Paint.x; | ||
229 | dst.y += origin_Paint.y; | ||
227 | #if defined (DEBUG_SCALE) | 230 | #if defined (DEBUG_SCALE) |
228 | dst.w *= DEBUG_SCALE; | 231 | dst.w *= DEBUG_SCALE; |
229 | dst.h *= DEBUG_SCALE; | 232 | dst.h *= DEBUG_SCALE; |