mirror of https://github.com/kivy/kivy.git
texturecompress: use a POT size of PVRTC (same for width/height), otherwise the OSX texturecompress will fail.
This commit is contained in:
parent
4ad0ba8ba1
commit
ec299657d5
|
@ -204,12 +204,17 @@ class PvrtcTool(Tool):
|
||||||
s2 = max(w2, h2)
|
s2 = max(w2, h2)
|
||||||
print('PVR need a square image, the texture will be {0}x{0}'.format(s2))
|
print('PVR need a square image, the texture will be {0}x{0}'.format(s2))
|
||||||
|
|
||||||
|
ext = self.source_fn.rsplit('.', 1)[-1]
|
||||||
|
tmpfile = '/tmp/ktexturecompress.{}'.format(ext)
|
||||||
|
image = image.resize((s2, s2))
|
||||||
|
image.save(tmpfile)
|
||||||
|
|
||||||
# 4. invoke texture tool
|
# 4. invoke texture tool
|
||||||
raw_tex_fn = self.tex_fn + '.raw'
|
raw_tex_fn = self.tex_fn + '.raw'
|
||||||
cmd = [self.texturetool]
|
cmd = [self.texturetool]
|
||||||
if self.options.mipmap:
|
if self.options.mipmap:
|
||||||
cmd += ['-m']
|
cmd += ['-m']
|
||||||
cmd += ['-e', 'PVRTC', '-o', raw_tex_fn, '-f', 'RAW', self.source_fn]
|
cmd += ['-e', 'PVRTC', '-o', raw_tex_fn, '-f', 'RAW', tmpfile]
|
||||||
try:
|
try:
|
||||||
self.runcmd(cmd)
|
self.runcmd(cmd)
|
||||||
with open(raw_tex_fn, 'rb') as fd:
|
with open(raw_tex_fn, 'rb') as fd:
|
||||||
|
|
Loading…
Reference in New Issue