Skip to content

Commit

Permalink
we can handle all YUV formats here
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jun 19, 2024
1 parent 207f02f commit 138fea3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions xpra/client/gui/window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ def paint_image_wrapper(self, encoding: str, img, x: int, y: int, width: int, he

def do_paint_image_wrapper(self, context, encoding: str, img, x: int, y: int, width: int, height: int,
options: typedict, callbacks: Iterable[Callable]) -> None:
rgb_format = img.get_pixel_format()
if rgb_format in ("NV12", "YUV420P"):
pixel_format = img.get_pixel_format()
if pixel_format in ("NV12", "YUV420P", "YUV422P", "YUV444P"):
# jpeg may be decoded to these formats by nvjpeg / nvdec
enc_width, enc_height = options.intpair("scaled_size", (width, height))
self.do_video_paint(encoding, img, x, y, enc_width, enc_height, width, height, options, callbacks)
Expand All @@ -588,19 +588,19 @@ def do_paint_image_wrapper(self, context, encoding: str, img, x: int, y: int, wi
raise ValueError(f"cannot handle {img.get_planes()} in this backend")
# if the backing can't handle this format,
# ie: tray only supports RGBA
if rgb_format not in self.get_rgb_formats():
if pixel_format not in self.get_rgb_formats():
# pylint: disable=import-outside-toplevel
from xpra.codecs.rgb_transform import rgb_reformat
has_alpha = rgb_format.find("A") >= 0 and self._alpha_enabled
has_alpha = pixel_format.find("A") >= 0 and self._alpha_enabled
rgb_reformat(img, self.get_rgb_formats(), has_alpha)
rgb_format = img.get_pixel_format()
pixel_format = img.get_pixel_format()
# replace with the actual rgb format we get from the decoder / rgb_reformat:
options["rgb_format"] = rgb_format
options["rgb_format"] = pixel_format
w = img.get_width()
h = img.get_height()
pixels = img.get_pixels()
stride = img.get_rowstride()
self.do_paint_rgb(context, encoding, rgb_format, pixels, x, y, w, h, width, height, stride, options, callbacks)
self.do_paint_rgb(context, encoding, pixel_format, pixels, x, y, w, h, width, height, stride, options, callbacks)
img.free()

def with_gfx_context(self, function: Callable, *args) -> None:
Expand Down

0 comments on commit 138fea3

Please sign in to comment.