mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-20 23:59:55 +00:00
Restore Hextile SolidFill and Zlib encoding paths
This commit is contained in:
@@ -291,12 +291,11 @@ func (s *session) sendFullUpdate(img *image.RGBA) error {
|
||||
pf := s.pf
|
||||
useTight := s.useTight
|
||||
tight := s.tight
|
||||
useZlib := s.useZlib
|
||||
zlib := s.zlib
|
||||
s.encMu.RUnlock()
|
||||
|
||||
if useTight && tight != nil && pfIsTightCompatible(pf) {
|
||||
// Tight encodes arbitrary sizes natively (Fill for uniform, JPEG
|
||||
// for photo-like, Basic+zlib otherwise). Wrap the rect bytes with
|
||||
// the 4-byte FramebufferUpdate header.
|
||||
rectBuf := encodeTightRect(img, pf, 0, 0, w, h, tight)
|
||||
buf := make([]byte, 4+len(rectBuf))
|
||||
buf[0] = serverFramebufferUpdate
|
||||
@@ -308,6 +307,14 @@ func (s *session) sendFullUpdate(img *image.RGBA) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if useZlib && zlib != nil {
|
||||
buf := encodeZlibRect(img, pf, 0, 0, w, h, zlib)
|
||||
s.writeMu.Lock()
|
||||
_, err := s.conn.Write(buf)
|
||||
s.writeMu.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
buf := encodeRawRect(img, pf, 0, 0, w, h)
|
||||
s.writeMu.Lock()
|
||||
_, err := s.conn.Write(buf)
|
||||
@@ -366,13 +373,27 @@ func (s *session) sendDirtyAndMoves(img *image.RGBA, moves []copyRectMove, rects
|
||||
func (s *session) encodeTile(img *image.RGBA, x, y, w, h int) []byte {
|
||||
s.encMu.RLock()
|
||||
pf := s.pf
|
||||
useHextile := s.useHextile
|
||||
useTight := s.useTight
|
||||
tight := s.tight
|
||||
useZlib := s.useZlib
|
||||
zlib := s.zlib
|
||||
s.encMu.RUnlock()
|
||||
|
||||
if useHextile {
|
||||
if pixel, uniform := tileIsUniform(img, x, y, w, h); uniform {
|
||||
r := byte(pixel)
|
||||
g := byte(pixel >> 8)
|
||||
b := byte(pixel >> 16)
|
||||
return encodeHextileSolidRect(r, g, b, pf, rect{x, y, w, h})
|
||||
}
|
||||
}
|
||||
if useTight && tight != nil && pfIsTightCompatible(pf) {
|
||||
return encodeTightRect(img, pf, x, y, w, h, tight)
|
||||
}
|
||||
if useZlib && zlib != nil {
|
||||
return encodeZlibRect(img, pf, x, y, w, h, zlib)[4:]
|
||||
}
|
||||
return encodeRawRect(img, pf, x, y, w, h)[4:]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user