The TS_FP_POINTERATTRIBUTE structure is the fast-path variant of the TS_POINTERATTRIBUTE structure.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_8_1_2_1_8.xml
Наследование: TS_FP_UPDATE
Пример #1
0
        private byte[] EncodeNewPtr(TS_FP_POINTERATTRIBUTE ptrData)
        {
            List<byte> totalBuffer = new List<byte>();
            List<byte> buffer = new List<byte>();

            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.xorBpp);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.cacheIndex);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.hotSpot.xPos);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.hotSpot.yPos);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.width);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.height);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.lengthAndMask);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.lengthXorMask);
            if (ptrData.newPointerUpdateData.colorPtrAttr.xorMaskData != null)
            {
                RdpbcgrEncoder.EncodeBytes(buffer, ptrData.newPointerUpdateData.colorPtrAttr.xorMaskData);
            }
            if (ptrData.newPointerUpdateData.colorPtrAttr.andMaskData != null)
            {
                RdpbcgrEncoder.EncodeBytes(buffer, ptrData.newPointerUpdateData.colorPtrAttr.andMaskData);
            }
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.newPointerUpdateData.colorPtrAttr.pad);

            if (ptrData.compressionFlags != compressedType_Values.None)
            {
                RdpbcgrEncoder.EncodeBytes(
                    totalBuffer, serverSessionContext.Compress(ptrData.compressionFlags, buffer.ToArray()));
            }
            else
            {
                RdpbcgrEncoder.EncodeBytes(totalBuffer, buffer.ToArray());
            }
            return totalBuffer.ToArray();
        }
        /// <summary>
        /// Parse TS_FP_POINTERATTRIBUTE
        /// </summary>
        /// <param name="updateHeader">update header</param>
        /// <param name="compressionFlags">compression flags</param>
        /// <param name="size">update data size(before decompression)</param>
        /// <param name="updateData">update data(decompressed)</param>
        /// <returns>TS_FP_POINTERATTRIBUTE</returns>
        private TS_FP_POINTERATTRIBUTE ParseTsFpPointerAttribute(
            byte updateHeader,
            compressedType_Values compressionFlags,
            UInt16 size,
            byte[] updateData)
        {
            TS_FP_POINTERATTRIBUTE attribute = new TS_FP_POINTERATTRIBUTE();

            // TS_FP_POINTERATTRIBUTE: updateHeader
            attribute.updateHeader = updateHeader;

            // TS_FP_POINTERATTRIBUTE: compressionFlags
            attribute.compressionFlags = compressionFlags;

            // TS_FP_POINTERATTRIBUTE: size
            attribute.size = size;

            // TS_FP_POINTERATTRIBUTE: newPointerUpdateData
            int index = 0;
            attribute.newPointerUpdateData = ParseTsPointerAttribute(updateData, ref index);

            // [Commented out for TDI #41402]
            // Check if data length exceeded expectation
            // VerifyDataLength(updateData.Length, index, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
            return attribute;
        }
        public static TS_FP_POINTERATTRIBUTE CreateFPPointerAttribute(ushort xorBpp, ushort cacheIndex, ushort hotSpotX, ushort hotSpotY, ushort width, ushort height,
            byte[] xorMaskData = null, byte[] andMaskData = null)
        {
            TS_FP_POINTERATTRIBUTE fpPtr = new TS_FP_POINTERATTRIBUTE();

            fpPtr.updateHeader = (byte)(((int)updateCode_Values.FASTPATH_UPDATETYPE_POINTER & 0x0f)
                | (((int)fragmentation_Value.FASTPATH_FRAGMENT_SINGLE) << 4)
                | ((int)compressedType_Values.None << 6));

            fpPtr.newPointerUpdateData.xorBpp = xorBpp;
            fpPtr.newPointerUpdateData.colorPtrAttr.cacheIndex = cacheIndex;
            fpPtr.newPointerUpdateData.colorPtrAttr.hotSpot.xPos = hotSpotX;
            fpPtr.newPointerUpdateData.colorPtrAttr.hotSpot.yPos = hotSpotY;
            fpPtr.newPointerUpdateData.colorPtrAttr.width = width;
            fpPtr.newPointerUpdateData.colorPtrAttr.height = height;

            if (xorMaskData != null)
            {
                fpPtr.newPointerUpdateData.colorPtrAttr.lengthXorMask = (ushort)xorMaskData.Length;
                fpPtr.newPointerUpdateData.colorPtrAttr.xorMaskData = xorMaskData;
            }
            else
            {
                fpPtr.newPointerUpdateData.colorPtrAttr.lengthXorMask = (ushort)(((width * xorBpp+7)/8 + 1) / 2 * 2 * height);
                fpPtr.newPointerUpdateData.colorPtrAttr.xorMaskData = new byte[fpPtr.newPointerUpdateData.colorPtrAttr.lengthXorMask];
                for (int i = 0; i < fpPtr.newPointerUpdateData.colorPtrAttr.lengthXorMask; i++)
                {
                    if (xorBpp == 32 && i % 4 == 3)
                    {
                        //If color depth is 32, set R, G, B to 0xff, and set A to 0x00
                        fpPtr.newPointerUpdateData.colorPtrAttr.xorMaskData[i] = 0x00;
                    }
                    else
                    {
                        fpPtr.newPointerUpdateData.colorPtrAttr.xorMaskData[i] = 0xff;
                    }
                }
            }

            if (andMaskData != null)
            {
                fpPtr.newPointerUpdateData.colorPtrAttr.lengthAndMask = (ushort)andMaskData.Length;
                fpPtr.newPointerUpdateData.colorPtrAttr.andMaskData = andMaskData;
            }
            else
            {
                fpPtr.newPointerUpdateData.colorPtrAttr.lengthAndMask = (ushort)(((width + 7) / 8 + 1) / 2 * 2 * height);
                fpPtr.newPointerUpdateData.colorPtrAttr.andMaskData = new byte[fpPtr.newPointerUpdateData.colorPtrAttr.lengthAndMask];
                for (int i = 0; i < fpPtr.newPointerUpdateData.colorPtrAttr.lengthAndMask; i++)
                    fpPtr.newPointerUpdateData.colorPtrAttr.andMaskData[i] = 0xff;
            }

            fpPtr.newPointerUpdateData.colorPtrAttr.pad = 0;
            fpPtr.size = (ushort)(17 + fpPtr.newPointerUpdateData.colorPtrAttr.lengthXorMask + fpPtr.newPointerUpdateData.colorPtrAttr.lengthAndMask);

            return fpPtr;
        }