aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2019-09-29 21:34:24 +0200
committerEugene Sandulenko2019-09-29 23:26:05 +0200
commit45ef1eb16683ea876758b35eef48a54be34d5f2a (patch)
treefcb06a9b23fb427b0b8e6c06309014227af6b2c6 /graphics
parentf2079e9af9bbcd0ac204bcf81e0392a8b97e677f (diff)
downloadscummvm-rg350-45ef1eb16683ea876758b35eef48a54be34d5f2a.tar.gz
scummvm-rg350-45ef1eb16683ea876758b35eef48a54be34d5f2a.tar.bz2
scummvm-rg350-45ef1eb16683ea876758b35eef48a54be34d5f2a.zip
GRAPHICS: Fix padding calculation for 9-patch images
Diffstat (limited to 'graphics')
-rw-r--r--graphics/nine_patch.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp
index fc1999dee8..75f3a6e1e2 100644
--- a/graphics/nine_patch.cpp
+++ b/graphics/nine_patch.cpp
@@ -170,12 +170,12 @@ NinePatchBitmap::NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bi
while (i < bmp->w) {
bmp->format.colorToARGB(*(uint32 *)bmp->getBasePtr(i, bmp->h - 1), a, r, g, b);
- if (r + g + b == 0 && a == 1) {
+ if (r + g + b == 0 && a == 255) {
if (_padding.left == -1)
_padding.left = i - 1;
else if (_padding.right != -1)
goto bad_bitmap;
- } else if (a == 0 || r + g + b + a == 4) {
+ } else if (a == 0 || r + g + b == 0) {
if (_padding.left != -1 && _padding.right == -1)
_padding.right = bmp->w - i - 1;
}
@@ -186,12 +186,12 @@ NinePatchBitmap::NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bi
while (i < bmp->h) {
bmp->format.colorToARGB(*(uint32 *)bmp->getBasePtr(bmp->w - 1, i), a, r, g, b);
- if (r + g + b == 0 && a == 1) {
+ if (r + g + b == 0 && a == 255) {
if (_padding.top == -1)
_padding.top = i - 1;
else if (_padding.bottom != -1)
goto bad_bitmap;
- } else if (a == 0 || r + g + b + a == 4) {
+ } else if (a == 0 || r + g + b == 0) {
if (_padding.top != -1 && _padding.bottom == -1)
_padding.bottom = bmp->h - i - 1;
}