Exemplo n.º 1
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Obtain handles for animated properties
                DUCE.ResourceHandle hRenderAtScaleAnimations = GetAnimationResourceHandle(RenderAtScaleProperty, channel);

                // Pack & send command packet
                DUCE.MILCMD_BITMAPCACHE data;
                unsafe
                {
                    data.Type   = MILCMD.MilCmdBitmapCache;
                    data.Handle = _duceResource.GetHandle(channel);
                    if (hRenderAtScaleAnimations.IsNull)
                    {
                        data.RenderAtScale = RenderAtScale;
                    }
                    data.hRenderAtScaleAnimations = hRenderAtScaleAnimations;
                    data.SnapsToDevicePixels      = CompositionResourceManager.BooleanToUInt32(SnapsToDevicePixels);
                    data.EnableClearType          = CompositionResourceManager.BooleanToUInt32(EnableClearType);

                    // Send packed command structure
                    channel.SendCommand(
                        (byte *)&data,
                        sizeof(DUCE.MILCMD_BITMAPCACHE));
                }
            }
        }
        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Read values of properties into local variables
                DoubleCollection vGuidelinesX = GuidelinesX;
                DoubleCollection vGuidelinesY = GuidelinesY;

                // Store the count of this resource's contained collections in local variables.
                int GuidelinesXCount = (vGuidelinesX == null) ? 0 : vGuidelinesX.Count;
                int GuidelinesYCount = (vGuidelinesY == null) ? 0 : vGuidelinesY.Count;

                // Pack & send command packet
                DUCE.MILCMD_GUIDELINESET data;
                unsafe
                {
                    data.Type            = MILCMD.MilCmdGuidelineSet;
                    data.Handle          = _duceResource.GetHandle(channel);
                    data.GuidelinesXSize = (uint)(sizeof(Double) * GuidelinesXCount);
                    data.GuidelinesYSize = (uint)(sizeof(Double) * GuidelinesYCount);
                    data.IsDynamic       = CompositionResourceManager.BooleanToUInt32(IsDynamic);

                    channel.BeginCommand(
                        (byte *)&data,
                        sizeof(DUCE.MILCMD_GUIDELINESET),
                        (int)(data.GuidelinesXSize +
                              data.GuidelinesYSize)
                        );


                    // Copy this collection's elements (or their handles) to reserved data
                    for (int i = 0; i < GuidelinesXCount; i++)
                    {
                        Double resource = vGuidelinesX.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte *)&resource,
                            sizeof(Double)
                            );
                    }

                    // Copy this collection's elements (or their handles) to reserved data
                    for (int i = 0; i < GuidelinesYCount; i++)
                    {
                        Double resource = vGuidelinesY.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte *)&resource,
                            sizeof(Double)
                            );
                    }

                    channel.EndCommand();
                }
            }
        }
Exemplo n.º 3
0
        private void ManualUpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                checked
                {
                    DUCE.MILCMD_PIXELSHADER data;
                    data.Type   = MILCMD.MilCmdPixelShader;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.PixelShaderBytecodeSize = (_shaderBytecode.Value == null) ? 0 : (uint)(_shaderBytecode.Value).Length;
                    data.ShaderRenderMode        = ShaderRenderMode;
                    data.CompileSoftwareShader   = CompositionResourceManager.BooleanToUInt32(!(ShaderMajorVersion == 3 && ShaderMinorVersion == 0));

                    unsafe
                    {
                        channel.BeginCommand(
                            (byte *)&data,
                            sizeof(DUCE.MILCMD_PIXELSHADER),
                            (int)data.PixelShaderBytecodeSize);   // extra data

                        if (data.PixelShaderBytecodeSize > 0)
                        {
                            fixed(byte *pPixelShaderBytecode = _shaderBytecode.Value)
                            {
                                channel.AppendCommandData(pPixelShaderBytecode, (int)data.PixelShaderBytecodeSize);
                            }
                        }
                    }
                }

                channel.EndCommand();
            }
        }