summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodger Combs <rodger.combs@gmail.com>2014-11-05 14:52:07 -0400
committerRodger Combs <rodger.combs@gmail.com>2014-11-05 14:52:45 -0400
commitde756cf85b851c423a397ff7f8e4d98dbb0f5abb (patch)
tree6dbfeeef14937139a4bca225ef8adf5cef25b427
parentc24292e83863d73ea1729cb946d744db5a74c7da (diff)
downloadlibass-de756cf85b851c423a397ff7f8e4d98dbb0f5abb.tar.bz2
libass-de756cf85b851c423a397ff7f8e4d98dbb0f5abb.tar.xz
Only use the subpixel value when shifting bitmaps. Fixes #142
-rw-r--r--libass/ass_bitmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
index a2dc293..1f719f8 100644
--- a/libass/ass_bitmap.c
+++ b/libass/ass_bitmap.c
@@ -329,6 +329,7 @@ void shift_bitmap(Bitmap *bm, int shift_x, int shift_y)
// Shift in x direction
if (shift_x > 0) {
+ shift_x &= 0x3F;
for (y = 0; y < h; y++) {
for (x = w - 1; x > 0; x--) {
b = (buf[x + y * s - 1] * shift_x) >> 6;
@@ -337,7 +338,7 @@ void shift_bitmap(Bitmap *bm, int shift_x, int shift_y)
}
}
} else if (shift_x < 0) {
- shift_x = -shift_x;
+ shift_x = -shift_x & 0x3F;
for (y = 0; y < h; y++) {
for (x = 0; x < w - 1; x++) {
b = (buf[x + y * s + 1] * shift_x) >> 6;
@@ -349,6 +350,7 @@ void shift_bitmap(Bitmap *bm, int shift_x, int shift_y)
// Shift in y direction
if (shift_y > 0) {
+ shift_y &= 0x3F;
for (x = 0; x < w; x++) {
for (y = h - 1; y > 0; y--) {
b = (buf[x + (y - 1) * s] * shift_y) >> 6;
@@ -357,7 +359,7 @@ void shift_bitmap(Bitmap *bm, int shift_x, int shift_y)
}
}
} else if (shift_y < 0) {
- shift_y = -shift_y;
+ shift_y = -shift_y & 0x3F;
for (x = 0; x < w; x++) {
for (y = 0; y < h - 1; y++) {
b = (buf[x + (y + 1) * s] * shift_y) >> 6;