orders

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: GPL-3.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package orders renders the drawing orders a server sends when the client says it supports them.

Orders are how RDP drew things before bitmap updates and EGFX. The server puts bitmaps into a cache with secondary orders and then blits them to the screen with MEMBLT, often with a couple of fills alongside. That is the whole model in practice: a session measured against Windows 10 consisted of 1770 MEMBLTs, 1000 cache fills and 62 alternate secondary orders, and nothing else.

Whether to advertise support is a trade: the server stops sending bitmap updates entirely, so a client that cannot render orders gets a blank screen rather than a slower one. See docs/windows-verification.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache holds the bitmaps the server stores with secondary orders and reads back with MEMBLT.

Entries are dropped rather than reused when the server overwrites a slot, which is what it does when its own cache fills up: the protocol has no eviction message for the client because the client is not expected to hand anything back.

func NewCache

func NewCache() *Cache

NewCache returns an empty cache.

func (*Cache) Get

func (c *Cache) Get(cacheID uint32, index uint32) *Entry

Get returns a cache entry, or nil if the slot is empty. The caller must not modify the pixels.

func (*Cache) Len

func (c *Cache) Len() int

Len is the number of entries held, for tests and diagnostics.

func (*Cache) Put

func (c *Cache) Put(cb *pdu.CacheBitmap)

Put stores a bitmap from a cache order. Entries the server says not to keep are still stored, because a MEMBLT usually follows immediately and expects to find them; they are simply not relied upon to last.

The order's own pixels are in the bitmap's pixel format and are converted to BGRA here, so that blitting is a copy.

func (*Cache) Reset

func (c *Cache) Reset()

Reset empties the cache. A reset graphics or a new connection invalidates everything in it.

type Entry

type Entry struct {
	Width  int
	Height int
	// Pixels are BGRA, top down.
	Pixels []byte
}

Entry is one bitmap in the cache, already decoded to BGRA.

type Screen

type Screen struct {

	// Cache holds the bitmaps the server blits from. Without it MEMBLT has
	// nothing to read.
	Cache *Cache
	// contains filtered or unexported fields
}

Screen is a framebuffer that renders drawing orders. It holds BGRA pixels, top down, like the surfaces EGFX uses.

func NewScreen

func NewScreen(width, height int) *Screen

NewScreen returns a black screen of the given size.

func (*Screen) Draw

func (s *Screen) Draw(pdus []pdu.OrderPdu) (image.Rectangle, error)

Draw renders a batch of orders and returns the area they changed, which is empty when nothing was drawn. The returned error is for a batch that could not be applied at all; orders that are merely unsupported are counted instead, since the rest of the batch is still worth drawing.

func (*Screen) Pixels

func (s *Screen) Pixels() []byte

Pixels returns a copy of the screen as BGRA, top down.

func (*Screen) Resize

func (s *Screen) Resize(width, height int)

Resize discards the contents and changes the size. Servers send a fresh set of orders after a resize, so there is nothing worth keeping.

func (*Screen) Size

func (s *Screen) Size() (int, int)

Size returns the screen size.

func (*Screen) Unsupported

func (s *Screen) Unsupported() map[string]int

Unsupported reports how many orders were recognised but not drawn, by kind. A stream of MEMBLTs with an unhandled ROP shows up here rather than as a silently wrong screen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL