Skip to content

Commit

Permalink
ensure we always call gl_end after calling gl_begin (via gl_init) - a…
Browse files Browse the repository at this point in the history
…nd remove redundant glFlush (also done in gl_end)

git-svn-id: https://xpra.org/svn/Xpra/trunk@2357 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Dec 25, 2012
1 parent 76f83dd commit 721fffb
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions src/xpra/gl/gl_window_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,40 @@ def gl_expose_event(self, glarea, event):
finally:
self.gl_end(drawable)

def _do_paint_rgb24(self, img_data, x, y, width, height, rowstride, options, callbacks):
log("do_paint_rgb24(%s bytes, %s, %s, %s, %s, %s, %s, %s)", len(img_data), x, y, width, height, rowstride, options, callbacks)
def _do_paint_rgb24(self, img_data, x, y, w, h, rowstride, options, callbacks):
log("do_paint_rgb24(%s bytes, %s, %s, %s, %s, %s, %s, %s)", len(img_data), x, y, w, h, rowstride, options, callbacks)
ww, wh = self.size
if x+width>ww or y+height>wh:
if x+w>ww or y+h>wh:
log("do_paint_rgb24: ignoring paint which would overflow the backing area")
return
drawable = self.gl_init()
#cleanup if we were doing yuv previously:
if self.pixel_format!=GLPixmapBacking.RGB24:
self.remove_shader()
self.pixel_format = GLPixmapBacking.RGB24

glEnable(GL_TEXTURE_RECTANGLE_ARB)
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[0])
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowstride/3)
for texture in (GL_TEXTURE1, GL_TEXTURE2):
glActiveTexture(texture)
glDisable(GL_TEXTURE_RECTANGLE_ARB)

glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, img_data)

glBegin(GL_QUADS)
for rx,ry in ((x, y), (x, y+height), (x+width, y+height), (x+width, y)):
glTexCoord2i(rx, ry)
glVertex2i(rx, ry)
glEnd()
glFlush()
self.gl_end(drawable)
if not drawable:
log("do_paint_rgb24: cannot paint yet..")
return
try:
#cleanup if we were doing yuv previously:
if self.pixel_format!=GLPixmapBacking.RGB24:
self.remove_shader()
self.pixel_format = GLPixmapBacking.RGB24

glEnable(GL_TEXTURE_RECTANGLE_ARB)
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[0])
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowstride/3)
for texture in (GL_TEXTURE1, GL_TEXTURE2):
glActiveTexture(texture)
glDisable(GL_TEXTURE_RECTANGLE_ARB)

glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, x, y, w, h, GL_RGB, GL_UNSIGNED_BYTE, img_data)

glBegin(GL_QUADS)
for rx,ry in ((x, y), (x, y+h), (x+w, y+h), (x+w, y)):
glTexCoord2i(rx, ry)
glVertex2i(rx, ry)
glEnd()
finally:
self.gl_end(drawable)

def do_video_paint(self, coding, img_data, x, y, w, h, options, callbacks):
log("do_video_paint: options=%s, decoder=%s", options, type(self._video_decoder))
Expand Down

0 comments on commit 721fffb

Please sign in to comment.