Ejemplo n.º 1
0
        public void Dispose()
        {
            if (Address == IntPtr.Zero)
            {
                return;
            }

            if (!_lockWindow(win =>
            {
                var fb = new AvnFramebuffer
                {
                    Data = Address,
                    Dpi = new AvnVector
                    {
                        X = Dpi.X,
                        Y = Dpi.Y
                    },
                    Width = Width,
                    Height = Height,
                    PixelFormat = (AvnPixelFormat)Format,
                    Stride = RowBytes
                };

                using (var d = new Disposer(Address))
                {
                    win.ThreadSafeSetSwRenderedFrame(ref fb, d);
                }
            }))
            {
                Marshal.FreeHGlobal(Address);
            }

            Address = IntPtr.Zero;
        }
Ejemplo n.º 2
0
 public FramebufferWrapper(AvnFramebuffer fb)
 {
     Address  = fb.Data;
     Size     = new PixelSize(fb.Width, fb.Height);
     RowBytes = fb.Stride;
     Dpi      = new Vector(fb.Dpi.X, fb.Dpi.Y);
     Format   = (PixelFormat)fb.PixelFormat;
 }
Ejemplo n.º 3
0
            void IAvnWindowBaseEvents.SoftwareDraw(ref AvnFramebuffer fb)
            {
                Dispatcher.UIThread.RunJobs(DispatcherPriority.Render);

                _parent._framebuffer = new SavedFramebuffer
                {
                    Address  = fb.Data,
                    RowBytes = fb.Stride,
                    Width    = fb.Width,
                    Height   = fb.Height,
                    Dpi      = new Vector(fb.Dpi.X, fb.Dpi.Y)
                };

                _parent.Paint?.Invoke(new Rect(0, 0, fb.Width / (fb.Dpi.X / 96), fb.Height / (fb.Dpi.Y / 96)));
            }