Skip to content

Commit

Permalink
merge the same code into just one if statement
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@19706 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 25, 2018
1 parent 41fc6e3 commit d841576
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/xpra/client/gtk3/cairo_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ def __repr__(self):

def _do_paint_rgb(self, cairo_format, has_alpha, img_data, x, y, width, height, rowstride, options):
""" must be called from UI thread """
log("cairo._do_paint_rgb(%s, %s, %s %s,%s,%s,%s,%s,%s,%s) set_image_surface_data=%s, use pixbuf=%s", FORMATS.get(cairo_format, cairo_format), has_alpha, len(img_data), type(img_data), x, y, width, height, rowstride, options, set_image_surface_data, CAIRO_USE_PIXBUF)
log("cairo._do_paint_rgb(%s, %s, %s %s, %s, %s, %s, %s, %s, %s) set_image_surface_data=%s, use pixbuf=%s", FORMATS.get(cairo_format, cairo_format), has_alpha, len(img_data), type(img_data), x, y, width, height, rowstride, options, set_image_surface_data, CAIRO_USE_PIXBUF)
rgb_format = options.strget(b"rgb_format", "RGB")
if set_image_surface_data and not CAIRO_USE_PIXBUF:
if cairo_format==cairo.FORMAT_RGB24 and rgb_format in ("RGB", "BGR"):
img_surface = cairo.ImageSurface(cairo_format, width, height)
set_image_surface_data(img_surface, rgb_format, img_data, width, height, rowstride)
self.cairo_paint_surface(img_surface, x, y, options)
return True
if cairo_format==cairo.FORMAT_ARGB32 and rgb_format in ("RGBX", "BGRX"):
if (cairo_format==cairo.FORMAT_RGB24 and rgb_format in ("RGB", "BGR")) or \
(cairo_format==cairo.FORMAT_ARGB32 and rgb_format in ("RGBX", "BGRX")):
img_surface = cairo.ImageSurface(cairo_format, width, height)
set_image_surface_data(img_surface, rgb_format, img_data, width, height, rowstride)
self.cairo_paint_surface(img_surface, x, y, options)
Expand All @@ -65,5 +61,6 @@ def _do_paint_rgb(self, cairo_format, has_alpha, img_data, x, y, width, height,
self.cairo_paint_pixbuf(pixbuf, x, y, options)
return True

img_data = memoryview(img_data)
self.nasty_rgb_via_png_paint(cairo_format, has_alpha, img_data, x, y, width, height, rowstride, rgb_format)
return True

0 comments on commit d841576

Please sign in to comment.