aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scale.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/scale.c b/scale.c
index 99d0189..2f21ddc 100644
--- a/scale.c
+++ b/scale.c
@@ -108,6 +108,7 @@ static void scale_nearest(unsigned w, unsigned h, size_t pitch, const void *src,
int dy = -dst_h;
unsigned lines = h;
bool copy = false;
+ size_t cpy_w = dst_w * SCREEN_BPP;
dst += dst_offs;
@@ -118,7 +119,7 @@ static void scale_nearest(unsigned w, unsigned h, size_t pitch, const void *src,
if (copy) {
copy = false;
- memcpy(dst, dst - SCREEN_PITCH, SCREEN_PITCH);
+ memcpy(dst, dst - SCREEN_PITCH, cpy_w);
dst += SCREEN_PITCH;
dy += h;
} else if (dy < 0) {