Skip to content

Commit

Permalink
tidy up: use None for "uninitialized", fix log string, remove whitesp…
Browse files Browse the repository at this point in the history
…ace and fix pydev warning

git-svn-id: https://xpra.org/svn/Xpra/trunk@943 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 22, 2012
1 parent 5c33bfd commit 642e97f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/xpra/gl_client_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, client, wid, x, y, w, h, metadata, override_redirect):
self.glarea.show()
self.add(self.glarea)
self._on_close = []
self.textures = [ 0 ] # OpenGL texture IDs
self.textures = None # OpenGL texture IDs
self.current_mode = 0 # 0 = uninitialized 1 = RGB 2 = YUV

def do_configure_event(self, event):
Expand All @@ -83,7 +83,7 @@ def do_configure_event(self, event):
raise Exception("** Cannot create OpenGL rendering context!")

w, h = self.get_size()
log("Configure widget size size is %d, %d" % (w, h))
log("Configure widget size: %d x %d" % (w, h))
glViewport(0, 0, w, h)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
Expand All @@ -93,7 +93,7 @@ def do_configure_event(self, event):
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
glDisable(GL_FRAGMENT_PROGRAM_ARB)

if self.textures[0] == 0:
if self.textures is None:
self.textures = glGenTextures(3)

drawable.gl_end()
Expand Down Expand Up @@ -124,7 +124,7 @@ def draw_region(self, x, y, width, height, coding, img_data, rowstride):
self.paint_with_video_decoder(DECODERS, Decoder, "x264", img_data, x, y, width, height, rowstride)
elif coding == "vpx":
assert "vpx" in ENCODINGS
from xpra.vpx.codec import DECODERS, Decoder #@UnresolvedImport
from xpra.vpx.codec import DECODERS, Decoder #@UnresolvedImport @Reimport
self.paint_with_video_decoder(DECODERS, Decoder, "vpx", img_data, x, y, width, height, rowstride)
else:
raise Exception("** No JPEG/PNG support for OpenGL")
Expand Down Expand Up @@ -173,6 +173,7 @@ def update_texture_rgb24(self, img_data, x, y, width, height, rowstride):
context = self.glarea.get_gl_context()
if not drawable.gl_begin(context):
raise Exception("** Cannot create OpenGL rendering context!")
assert self.textures is not None

glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[0])
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowstride/3)
Expand Down Expand Up @@ -200,6 +201,7 @@ def update_texture_yuv420(self, img_data, x, y, width, height, rowstrides):
window_width, window_height = self.get_size()
if not drawable.gl_begin(context):
raise Exception("** Cannot create OpenGL rendering context!")
assert self.textures is not None

if self.current_mode == 1:
raise Exception("** RGB -> YUV mode change unimplemented!")
Expand Down

0 comments on commit 642e97f

Please sign in to comment.