示例#1
0
        public ILockedFramebuffer Lock()
        {
            UnmanagedMethods.RECT rc;
            UnmanagedMethods.GetClientRect(_hwnd, out rc);
            var width  = rc.right - rc.left;
            var height = rc.bottom - rc.top;

            if ((_fb == null || _fb.Size.Width != width || _fb.Size.Height != height) && width > 0 && height > 0)
            {
                _fb?.Deallocate();
                _fb = null;
                _fb = new WindowFramebuffer(_hwnd, new PixelSize(width, height));
            }
            return(_fb);
        }
示例#2
0
        public ILockedFramebuffer Lock()
        {
            UnmanagedMethods.GetClientRect(_hwnd, out var rc);

            var width  = Math.Max(1, rc.right - rc.left);
            var height = Math.Max(1, rc.bottom - rc.top);

            if ((_fb == null || _fb.Size.Width != width || _fb.Size.Height != height))
            {
                _fb?.Deallocate();
                _fb = null;
                _fb = new WindowFramebuffer(_hwnd, new PixelSize(width, height));
            }

            return(_fb);
        }
示例#3
0
 public void Dispose()
 {
     _fb?.Deallocate();
     _fb = null;
 }