summaryrefslogtreecommitdiff
path: root/testxml/testxml.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-25 02:12:34 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-25 02:12:34 +0300
commitc0735c8fb47391632da0904bbbad064b0d2f7b64 (patch)
treee7bd4929f4aab542b907d8830a7d8940ff38f067 /testxml/testxml.py
parent3b64f9c48679e141001408a7a55fe92f2e244af5 (diff)
downloadevol-tools-c0735c8fb47391632da0904bbbad064b0d2f7b64.tar.gz
evol-tools-c0735c8fb47391632da0904bbbad064b0d2f7b64.tar.bz2
evol-tools-c0735c8fb47391632da0904bbbad064b0d2f7b64.tar.xz
evol-tools-c0735c8fb47391632da0904bbbad064b0d2f7b64.zip
testxml: check for power of two images size.
Diffstat (limited to 'testxml/testxml.py')
-rwxr-xr-xtestxml/testxml.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/testxml/testxml.py b/testxml/testxml.py
index ad7cccf..606024f 100755
--- a/testxml/testxml.py
+++ b/testxml/testxml.py
@@ -439,7 +439,12 @@ def testSpriteFile(id, fullPath, file, fileLoc, dnum, variant, iserr):
return
sizes = testImageFile(image, fullPath, 0, " " + fileLoc, iserr)
s1 = int(sizes[0] / int(width)) * int(width)
- if sizes[0] != s1:
+ if sizes[0] % 2 == 1:
+ stmp = sizes[0] - 1
+ else:
+ stmp = sizes[0]
+
+ if sizes[0] != s1 and stmp != s1:
if s1 == 0:
tmp = int(width)
else:
@@ -447,7 +452,12 @@ def testSpriteFile(id, fullPath, file, fileLoc, dnum, variant, iserr):
showMsgSprite(fileLoc, "image width " + str(sizes[0]) + \
" (need " + str(tmp) + ") is not multiply to frame size " + width + ", image:" + image, False)
s2 = int(sizes[1] / int(height)) * int(height)
- if sizes[1] != s2:
+ if sizes[1] % 2 == 1:
+ stmp = sizes[1] - 1
+ else:
+ stmp = sizes[1]
+
+ if sizes[1] != s2 and stmp != s2:
if s2 == 0:
tmp = int(height)
else:
@@ -766,6 +776,11 @@ def testImageFile(file, fullPath, sz, src, iserr):
+ "x" + str(sizes[1]) + ") should be (" + str(sz) + "x" \
+ str(sz) + ")", False)
+ if 2 * int(sizes[0] / 2) != sizes[0] or 2 * int(sizes[1] / 2) != sizes[1]:
+ showMsgFile(file, "image size should be power of two. If not some pixels can be"\
+ " lost in OpenGL mode. Current size " + str(sizes[0]) + "x" + str(sizes[1]),
+ False)
+
return sizes