Skip to content

Commit

Permalink
remove extra pixel copy and workaround PyOpenGL's "No array-type hand…
Browse files Browse the repository at this point in the history
…ler for type <type 'buffer'>" using a python string as wrapper rather than a buffer

git-svn-id: https://xpra.org/svn/Xpra/trunk@4017 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 30, 2013
1 parent 1df722d commit e7ecee0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/xpra/client/gl/gl_window_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def update_planar_textures(self, x, y, width, height, img, pixel_format, scaling
glActiveTexture(texture)
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[index])
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowstrides[index])
pixel_data = img_data[index][:]
pixel_data = img_data[index]
debug("texture %s: div=%s, rowstride=%s, %sx%s, data=%s bytes", index, divs[index], rowstrides[index], width/div_w, height/div_h, len(pixel_data))
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, x, y, width/div_w, height/div_h, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixel_data)
if index == 1:
Expand Down
6 changes: 3 additions & 3 deletions src/xpra/codecs/dec_avcodec/decoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cdef extern from *:
cdef extern from "Python.h":
ctypedef int Py_ssize_t
ctypedef object PyObject
object PyBuffer_FromMemory(void *ptr, Py_ssize_t size)
object PyString_FromStringAndSize(const char *v, Py_ssize_t len)
object PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size)
int PyObject_AsReadBuffer(object obj, void ** buffer, Py_ssize_t * buffer_len) except -1

Expand Down Expand Up @@ -451,13 +451,13 @@ cdef class Decoder:
stride = self.frame.linesize[i]
size = height * stride
outsize += size
plane = PyBuffer_FromMemory(<void *>self.frame.data[i], size)
plane = PyString_FromStringAndSize(<const char *>self.frame.data[i], size)
out.append(plane)
strides.append(stride)
else:
strides = self.frame.linesize[0]+self.frame.linesize[1]+self.frame.linesize[2]
outsize = self.codec_ctx.height * strides
out = PyBuffer_FromMemory(<void *>self.frame.data[0], outsize)
out = PyString_FromStringAndSize(<const char *>self.frame.data[0], outsize)
nplanes = 0
if outsize==0:
raise Exception("output size is zero!")
Expand Down

0 comments on commit e7ecee0

Please sign in to comment.