From c0735c8fb47391632da0904bbbad064b0d2f7b64 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 25 May 2012 02:12:34 +0300 Subject: testxml: check for power of two images size. --- testxml/testxml.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'testxml/testxml.py') 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 -- cgit v1.2.3-60-g2f50