示例#1
0
        void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            if (m_target == null)
            {
                return;
            }

            RenderingEventArgs args = (RenderingEventArgs)e;

            if ((args.RenderingTime - m_lastRender).TotalSeconds * 1000 < FPSTIME)
            {
                return;
            }

            if (this.m_source.IsFrontBufferAvailable && args.RenderingTime != m_lastRender)
            {
                lock (m_locker)
                {
                    this.m_source.Lock();
                    unsafe
                    {
                        //byte[] _data = new byte[4 * m_current.Width * m_current.Height];
                        //m_current.GetData<byte>(_data);
                        //m_target.SetData<byte>(_data);
                        if (!m_target.IsContentLost && !m_target.IsDisposed)
                        {
                            m_source.SetBackBuffer(D3DResourceType.IDirect3DSurface9, m_target.GetPtr());
                        }
                        m_source.AddDirtyRect(m_rect);
                    }
                    this.m_source.Unlock();
                }

                m_lastRender = args.RenderingTime;
            }
        }