2.2.2.2.1.2.3 Cache Bitmap - Revision 2 (CACHE_BITMAP_REV2_ORDER)

The Cache Bitmap - Revision 2 Secondary Drawing Order is used by the server to instruct the client to store a bitmap in a particular Bitmap Cache entry. This order supports persistent disk bitmap caching and uses a compact encoding format. Support for the Revision 2 bitmap caches (section 3.1.1.1.1) is specified in the Revision 2 Bitmap Cache Capability Set ([MS-RDPBCGR] section 2.2.7.1.4.2).


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

header

...

key1 (optional)

...

key2 (optional)

...

bitmapWidth (variable)

...

bitmapHeight (variable)

...

bitmapLength (variable)

...

cacheIndex (variable)

...

bitmapComprHdr (optional)

...

bitmapDataStream (variable)

...

header (6 bytes): A Secondary Drawing Order Header (section 2.2.2.2.1.2.1.1). The embedded orderType field MUST be set to one of the following values.

Value

Meaning

TS_CACHE_BITMAP_UNCOMPRESSED_REV2

0x04

The bitmap data in the bitmapDataStream field is uncompressed.

TS_CACHE_BITMAP_COMPRESSED_REV2

0x05

The bitmap data in the bitmapDataStream field is compressed.

The format of the embedded extraFlags field is specified by the following bitmask diagram.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

cacheId

bitsPerPixelId

flags

cacheId (3 bits): A 3-bit, unsigned integer. The ID of the bitmap cache in which the bitmap data MUST be stored. This value MUST be greater than or equal to 0 and less than the number of bitmap caches being used for the connection. The number of bitmap caches being used is specified by the NumCellCaches field of the Revision 2 Bitmap Cache Capability Set ([MS-RDPBCGR] section 2.2.7.1.4.2).

bitsPerPixelId (4 bits): A 4-bit, unsigned integer. The color depth of the bitmap data in bits per pixel. MUST be one of the following values.

Value

Meaning

CBR2_8BPP

0x3

8 bits per pixel

CBR2_16BPP

0x4

16 bits per pixel

CBR2_24BPP

0x5

24 bits per pixel

CBR2_32BPP

0x6

32 bits per pixel

flags (9 bits): A 9-bit, unsigned integer. Operational flags.

Value

Meaning

CBR2_HEIGHT_SAME_AS_WIDTH

0x01

Implies that the bitmap height is the same as the bitmap width. If this flag is set, the bitmapHeight field MUST NOT be present.

CBR2_PERSISTENT_KEY_PRESENT

0x02

Implies that the bitmap is intended to be persisted, and the key1 and key2 fields MUST be present.

CBR2_NO_BITMAP_COMPRESSION_HDR

0x08

Indicates that the bitmapComprHdr field is not present (removed for bandwidth efficiency to save 8 bytes).

CBR2_DO_NOT_CACHE

0x10

Implies that the cacheIndex field MUST be ignored, and the bitmap MUST be placed in the last entry of the bitmap cache specified by cacheId field.

key1 (4 bytes): A 32-bit, unsigned integer. The low 32 bits of the 64-bit persistent bitmap cache key.

key2 (4 bytes): A 32-bit, unsigned integer. The high 32 bits of the 64-bit persistent bitmap cache key.

bitmapWidth (variable): A Two-Byte Unsigned Encoding (section 2.2.2.2.1.2.1.2) structure. The width of the bitmap in pixels.

bitmapHeight (variable): A Two-Byte Unsigned Encoding (section 2.2.2.2.1.2.1.2) structure. The height of the bitmap in pixels.

bitmapLength (variable): A Four-Byte Unsigned Encoding (section 2.2.2.2.1.2.1.4) structure. The size in bytes of the data in the bitmapComprHdr and bitmapDataStream fields.

cacheIndex (variable): A Two-Byte Unsigned Encoding (section 2.2.2.2.1.2.1.2) structure. The index of the target entry in the destination bitmap cache (specified by the cacheId field) where the bitmap data MUST be stored. If the CBR2_DO_NOT_CACHE flag is not set in the header field, the bitmap cache index MUST be greater than or equal to 0 and less than the maximum number of entries allowed in the destination bitmap cache. The maximum number of entries allowed in each individual bitmap cache is specified in the Revision 2 Bitmap Cache Capability Set ([MS-RDPBCGR] section 2.2.7.1.4.2) by the BitmapCache0CellInfo, BitmapCache1CellInfo, BitmapCache2CellInfo, BitmapCache3CellInfo, and BitmapCache4CellInfo fields. If the CBR2_DO_NOT_CACHE flag is set, the cacheIndex MUST be set to BITMAPCACHE_WAITING_LIST_INDEX (32767).

bitmapComprHdr (8 bytes): Optional Compressed Data Header structure (see [MS-RDPBCGR] section 2.2.9.1.1.3.1.2.3) describing the bitmap data in the bitmapDataStream. This field MUST be present if the TS_CACHE_BITMAP_COMPRESSED_REV2 (0x05) flag is present in the header field, but the CBR2_NO_BITMAP_COMPRESSION_HDR (0x08) flag is not.

bitmapDataStream (variable): A variable-length byte array containing bitmap data (the format of this data is defined in [MS-RDPBCGR] section 2.2.9.1.1.3.1.2.2).