void renderer_Render(object sender, RenderEventArgs e)
        {
            if (!this.terminated)
            {
                try
                {
                    if (surfaceBuffer != null &&
                        (surfaceBuffer.Width != e.Width || surfaceBuffer.Height != e.Height))
                    {
                        surfaceBuffer.Dispose();
                        surfaceBuffer = null;
                    }

                    if (surfaceBuffer == null)
                    {
                        surfaceBuffer = new DIBitmap(e.Width, e.Height);
                    }

                    // TODO: DirtyRect に対応
                    surfaceBuffer.SetSurfaceData(e.Buffer, (uint)(e.Width * e.Height * 4));

                    UpdateLayeredWindowBitmap();
                }
                catch
                {
                }
            }
        }
Exemple #2
0
        void renderer_Render(object sender, RenderEventArgs e)
        {
            if (!this.terminated)
            {
                try
                {
                    if (surfaceBuffer != null &&
                        (surfaceBuffer.Width != e.Width || surfaceBuffer.Height != e.Height))
                    {
                        surfaceBuffer.Dispose();
                        surfaceBuffer = null;
                    }

                    if (surfaceBuffer == null)
                    {
                        //using (var gScreen = Graphics.FromHwnd(Handle))
                        //{
                        //var hScreenDC = gScreen.GetHdc();
                        surfaceBuffer = new DIBitmap(e.Width, e.Height);
                        //gScreen.ReleaseHdc(hScreenDC);
                        //}
                    }

                    // TODO: DirtyRect に対応
                    surfaceBuffer.SetSurfaceData(e.Buffer, (uint)(e.Width * e.Height * 4));

                    UpdateLayeredWindowBitmap();
                }
                catch
                {
                }
            }
        }