4 new revisions:
Revision: a59131e8f8cf
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:07:34 2014 UTC
Log: fixed bytes vs str issues, a failing unpacking when the dds
variant wa...
http://code.google.com/p/pyglet/source/detail?r=a59131e8f8cf
Revision: be90eae71f6e
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:09:41 2014 UTC
Log: Python 3 compatibilty (strings vs bytes, PNG tests)...
http://code.google.com/p/pyglet/source/detail?r=be90eae71f6e
Revision: 1d7499251e0e
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:10:52 2014 UTC
Log: Python 3 compatibility, fixing tests using print...
http://code.google.com/p/pyglet/source/detail?r=1d7499251e0e
Revision: 9781eb46dca2
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:13:36 2014 UTC
Log: Python 3 compatibility fix...
http://code.google.com/p/pyglet/source/detail?r=9781eb46dca2
==============================================================================
Revision: a59131e8f8cf
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:07:34 2014 UTC
Log: fixed bytes vs str issues, a failing unpacking when the dds
variant was unknown, a type mismatch due to division changes in py2 to py3
Thanks to Daniel Niccoli for the initial and to Claudio Canepa for cleaning
the patch.
Closes issue #715.
http://code.google.com/p/pyglet/source/detail?r=a59131e8f8cf
Modified:
/pyglet/image/codecs/dds.py
=======================================
--- /pyglet/image/codecs/dds.py Fri Jan 3 15:22:59 2014 UTC
+++ /pyglet/image/codecs/dds.py Thu Apr 3 18:07:34 2014 UTC
@@ -37,6 +37,8 @@
Reference:
http://msdn2.microsoft.com/en-us/library/bb172993.aspx
'''
+from __future__ import division
+
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
@@ -143,12 +145,12 @@
]
_compression_formats = {
- ('DXT1', False): (GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
s3tc.decode_dxt1_rgb),
- ('DXT1', True): (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
s3tc.decode_dxt1_rgba),
- ('DXT3', False): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
- ('DXT3', True): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
- ('DXT5', False): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
- ('DXT5', True): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
+ (b'DXT1', False): (GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
s3tc.decode_dxt1_rgb),
+ (b'DXT1', True): (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
s3tc.decode_dxt1_rgba),
+ (b'DXT3', False): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
+ (b'DXT3', True): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
+ (b'DXT5', False): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
+ (b'DXT5', True): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
}
def _check_error():
@@ -163,7 +165,7 @@
def decode(self, file, filename):
header = file.read(DDSURFACEDESC2.get_size())
desc = DDSURFACEDESC2(header)
- if desc.dwMagic != 'DDS ' or desc.dwSize != 124:
+ if desc.dwMagic != b'DDS ' or desc.dwSize != 124:
raise DDSException('Invalid DDS file (incorrect header).')
width = desc.dwWidth
@@ -187,13 +189,13 @@
has_alpha = desc.ddpfPixelFormat.dwRGBAlphaBitMask != 0
- format, decoder = _compression_formats.get(
- (desc.ddpfPixelFormat.dwFourCC, has_alpha), None)
- if not format:
+ selector = (desc.ddpfPixelFormat.dwFourCC, has_alpha)
+ if selector not in _compression_formats:
raise DDSException('Unsupported texture compression %s' % \
desc.ddpfPixelFormat.dwFourCC)
- if format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ dformat, decoder = _compression_formats[selector]
+ if dformat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
block_size = 8
else:
block_size = 16
@@ -207,13 +209,13 @@
w = 1
if not h:
h = 1
- size = ((w + 3) / 4) * ((h + 3) / 4) * block_size
+ size = ((w + 3) // 4) * ((h + 3) // 4) * block_size
data = file.read(size)
datas.append(data)
w >>= 1
h >>= 1
- image = CompressedImageData(width, height, format, datas[0],
+ image = CompressedImageData(width, height, dformat, datas[0],
'GL_EXT_texture_compression_s3tc', decoder)
level = 0
for data in datas[1:]:
==============================================================================
Revision: be90eae71f6e
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:09:41 2014 UTC
Log: Python 3 compatibilty (strings vs bytes, PNG tests)
Thanks to Claudio Canepa for the patch.
Fixes issue #724.
http://code.google.com/p/pyglet/source/detail?r=be90eae71f6e
Modified:
/pyglet/image/__init__.py
=======================================
--- /pyglet/image/__init__.py Sat Mar 29 12:07:26 2014 UTC
+++ /pyglet/image/__init__.py Thu Apr 3 18:09:41 2014 UTC
@@ -1154,9 +1154,9 @@
self._ensure_string_data()
data = self._convert(self._current_format,
abs(self._current_pitch))
- rows = re.findall('.' * abs(self._current_pitch), data, re.DOTALL)
+ rows = re.findall(b'.' * abs(self._current_pitch), data, re.DOTALL)
rows = [row[x1:x2] for row in rows[self.y:self.y+self.height]]
- self._current_data = ''.join(rows)
+ self._current_data = b''.join(rows)
self._current_pitch = self.width * len(self._current_format)
self._current_texture = None
self.x = 0
==============================================================================
Revision: 1d7499251e0e
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:10:52 2014 UTC
Log: Python 3 compatibility, fixing tests using print
Thanks to Claudio Canepa for the patch!
Fixes issue #723.
http://code.google.com/p/pyglet/source/detail?r=1d7499251e0e
Modified:
/tests/image/MATRIX_RGB.py
/tests/image/MATRIX_RGBA.py
=======================================
--- /tests/image/MATRIX_RGB.py Sat Nov 10 01:09:58 2007 UTC
+++ /tests/image/MATRIX_RGB.py Thu Apr 3 18:10:52 2014 UTC
@@ -7,6 +7,8 @@
end the test.
'''
+from future import print_function
+
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
@@ -21,7 +23,7 @@
def load_image(self):
if not gl_info.have_extension('GL_ARB_imaging'):
- print 'GL_ARB_imaging is not present, skipping test.'
+ print('GL_ARB_imaging is not present, skipping test.')
self.has_exit = True
else:
# Load image as usual then rearrange components
=======================================
--- /tests/image/MATRIX_RGBA.py Sun Feb 17 12:45:54 2008 UTC
+++ /tests/image/MATRIX_RGBA.py Thu Apr 3 18:10:52 2014 UTC
@@ -7,6 +7,8 @@
end the test.
'''
+from future import print_function
+
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
@@ -21,7 +23,7 @@
def load_image(self):
if not gl_info.have_extension('GL_ARB_imaging'):
- print 'GL_ARB_imaging is not present, skipping test.'
+ print('GL_ARB_imaging is not present, skipping test.')
self.has_exit = True
else:
# Load image as usual then rearrange components
==============================================================================
Revision: 9781eb46dca2
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu Apr 3 18:13:36 2014 UTC
Log: Python 3 compatibility fix
Thanks to Risimi for the patch!
Fixes issue #722.
http://code.google.com/p/pyglet/source/detail?r=9781eb46dca2
Modified:
/tests/graphics/graphics_common.py
=======================================
--- /tests/graphics/graphics_common.py Thu Mar 20 19:29:32 2014 UTC
+++ /tests/graphics/graphics_common.py Thu Apr 3 18:13:36 2014 UTC
@@ -203,7 +203,7 @@
GraphicsGenericTestCase.setUp(self)
# we use half of the data so we repeat vertices.
- self.index_data = range(self.n_vertices/2) +
range(self.n_vertices/2)
+ self.index_data = range(self.n_vertices//2) * 2
random.seed(1)
random.shuffle(self.index_data)