Fix transmission by file

This commit is contained in:
Kovid Goyal 2025-10-09 09:35:06 +05:30
parent c6582e9f51
commit 2ac2c17929
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 4 deletions

View file

@ -179,9 +179,7 @@ func (self *GraphicsHandler) transmit(lp *loop.Loop, img *images.ImageData, m *i
gc := self.new_graphics_command()
gc.SetImageId(self.image_transmitted)
gc.SetDataWidth(uint64(frame.Width)).SetDataHeight(uint64(frame.Height))
if frame.Is_opaque {
gc.SetFormat(graphics.GRT_format_rgb)
}
gc.SetFormat(utils.IfElse(frame.Is_opaque, graphics.GRT_format_rgb, graphics.GRT_format_rgba))
switch frame_num {
case 0:
gc.SetAction(graphics.GRT_action_transmit)
@ -285,7 +283,7 @@ func (self *GraphicsHandler) RenderImagePreview(h *Handler, p *ImagePreview, x,
}
}
if files_supported {
self.transmit(h.lp, img, img_metadata, p.cached_data)
self.transmit(h.lp, img, img_metadata, cached_data)
} else {
if img == nil {
if img, err = load_image(cached_data); err != nil {

View file

@ -62,6 +62,10 @@ type SerializableImageFrame struct {
Size int
}
func (s SerializableImageFrame) NeededSize() int {
return utils.IfElse(s.Is_opaque, 3, 4) * s.Width * s.Height
}
func (s *ImageFrame) Serialize() SerializableImageFrame {
return SerializableImageFrame{
Width: s.Width, Height: s.Height, Left: s.Left, Top: s.Top,