Example #1
0
        static SKManagedStream()
        {
            fRead        = new read_delegate(ReadInternal);
            fPeek        = new peek_delegate(PeekInternal);
            fIsAtEnd     = new isAtEnd_delegate(IsAtEndInternal);
            fRewind      = new rewind_delegate(RewindInternal);
            fGetPosition = new getPosition_delegate(GetPositionInternal);
            fSeek        = new seek_delegate(SeekInternal);
            fMove        = new move_delegate(MoveInternal);
            fGetLength   = new getLength_delegate(GetLengthInternal);
            fCreateNew   = new createNew_delegate(CreateNewInternal);
            fDestroy     = new destroy_delegate(DestroyInternal);

            SkiaApi.sk_managedstream_set_delegates(
                Marshal.GetFunctionPointerForDelegate(fRead),
                Marshal.GetFunctionPointerForDelegate(fPeek),
                Marshal.GetFunctionPointerForDelegate(fIsAtEnd),
                Marshal.GetFunctionPointerForDelegate(fRewind),
                Marshal.GetFunctionPointerForDelegate(fGetPosition),
                Marshal.GetFunctionPointerForDelegate(fSeek),
                Marshal.GetFunctionPointerForDelegate(fMove),
                Marshal.GetFunctionPointerForDelegate(fGetLength),
                Marshal.GetFunctionPointerForDelegate(fCreateNew),
                Marshal.GetFunctionPointerForDelegate(fDestroy));
        }
Example #2
0
		static SKManagedStream()
		{
			fRead = new read_delegate(ReadInternal);
			fPeek = new peek_delegate(PeekInternal);
			fIsAtEnd = new isAtEnd_delegate(IsAtEndInternal);
			fRewind = new rewind_delegate(RewindInternal);
			fGetPosition = new getPosition_delegate(GetPositionInternal);
			fSeek = new seek_delegate(SeekInternal);
			fMove = new move_delegate(MoveInternal);
			fGetLength = new getLength_delegate(GetLengthInternal);
			fCreateNew = new createNew_delegate(CreateNewInternal);
			fDestroy = new destroy_delegate(DestroyInternal);

			SkiaApi.sk_managedstream_set_delegates(
				Marshal.GetFunctionPointerForDelegate(fRead), 
				Marshal.GetFunctionPointerForDelegate(fPeek), 
				Marshal.GetFunctionPointerForDelegate(fIsAtEnd), 
				Marshal.GetFunctionPointerForDelegate(fRewind),
				Marshal.GetFunctionPointerForDelegate(fGetPosition),
				Marshal.GetFunctionPointerForDelegate(fSeek),
				Marshal.GetFunctionPointerForDelegate(fMove),
				Marshal.GetFunctionPointerForDelegate(fGetLength),
				Marshal.GetFunctionPointerForDelegate(fCreateNew),
				Marshal.GetFunctionPointerForDelegate(fDestroy));
		}
Example #3
0
        public static UIntPtr read(cef_stream_reader_t *self, void *ptr, UIntPtr size, UIntPtr n)
        {
            read_delegate d;
            var           p = self->_read;

            if (p == _p3)
            {
                d = _d3;
            }
            else
            {
                d = (read_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(read_delegate));
                if (_p3 == IntPtr.Zero)
                {
                    _d3 = d; _p3 = p;
                }
            }
            return(d(self, ptr, size, n));
        }
 public static UIntPtr read(cef_stream_reader_t* self, void* ptr, UIntPtr size, UIntPtr n)
 {
     read_delegate d;
     var p = self->_read;
     if (p == _p3) { d = _d3; }
     else
     {
         d = (read_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(read_delegate));
         if (_p3 == IntPtr.Zero) { _d3 = d; _p3 = p; }
     }
     return d(self, ptr, size, n);
 }