Skip to content

Commit

Permalink
* ensure we always call gl_end after calling gl_begin (via gl_init)
Browse files Browse the repository at this point in the history
* fix garbage which was shown beyond the buffer's edge: textures are limited to the window's dimensions, render is not

git-svn-id: https://xpra.org/svn/Xpra/trunk@2354 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Dec 25, 2012
1 parent 561db69 commit dd4ec2b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/xpra/gl/gl_window_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ def gl_expose_event(self, glarea, event):
drawable = self.gl_init()
log.info("gl_expose_event(%s, %s) drawable=%s", glarea, event, drawable)
if drawable:
self.render_image(x, y, w, h)
self.gl_end(drawable)
try:
self.render_image(x, y, w, h)
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)
Expand Down Expand Up @@ -154,7 +156,7 @@ def _do_paint_rgb24(self, img_data, x, y, width, height, rowstride, options, cal
glFlush()
self.gl_end(drawable)

def do_video_paint(self, coding, img_data, x, y, width, height, options, callbacks):
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))
err, rowstrides, img_data = self._video_decoder.decompress_image_to_yuv(img_data, options)
csc_pixel_format = options.get("csc_pixel_format", -1)
Expand All @@ -165,7 +167,7 @@ def do_paint():
#this function runs in the UI thread, no video_decoder lock held
if not success:
log.error("do_video_paint: %s decompression error %s on %s bytes of picture data for %sx%s pixels, options=%s",
coding, err, len(img_data), width, height, options)
coding, err, len(img_data), w, h, options)
self.fire_paint_callbacks(callbacks, False)
return
drawable = self.gl_init()
Expand All @@ -175,10 +177,9 @@ def do_paint():
return
try:
try:
self.update_texture_yuv(img_data, x, y, width, height, rowstrides, pixel_format)
self.update_texture_yuv(img_data, x, y, w, h, rowstrides, pixel_format)
if self.paint_screen:
w, h = self.size
self.render_image(0, 0, w, h)
self.render_image(x, y, x+w, y+h)
self.fire_paint_callbacks(callbacks, True)
except Exception, e:
log.error("OpenGL paint error: %s", e, exc_info=True)
Expand Down

0 comments on commit dd4ec2b

Please sign in to comment.