コード例 #1
0
ファイル: l-font.c プロジェクト: IngenicC/xboot
static FT_Stream FT_New_Xfs_Stream(const char * pathname)
{
	FT_Stream stream = NULL;
	struct xfs_file_t * file;

	stream = malloc(sizeof(*stream));
	if(!stream)
		return NULL;

	file = xfs_open_read(pathname);
	if(!file)
	{
		free(stream);
		return NULL;
	}

	stream->size = xfs_filelength(file);
	if(!stream->size)
	{
		xfs_close(file);
		free(stream);
		return NULL;
	}
	xfs_seek(file, 0);

	stream->descriptor.pointer = file;
	stream->pathname.pointer = (char *)pathname;
	stream->read = ft_xfs_stream_io;
	stream->close = ft_xfs_stream_close;

    return stream;
}
コード例 #2
0
ファイル: l-font.c プロジェクト: IngenicC/xboot
static void ft_xfs_stream_close(FT_Stream stream)
{
	struct xfs_file_t * file = ((struct xfs_file_t *)stream->descriptor.pointer);

	xfs_close(file);
	stream->descriptor.pointer = NULL;
	stream->size = 0;
	stream->base = 0;
	free(stream);
}
コード例 #3
0
ファイル: l-texture.c プロジェクト: kamejoko80/xboot
static cairo_surface_t * cairo_image_surface_create_from_png_xfs(const char * filename)
{
	struct xfs_file_t * file;
	cairo_surface_t * surface;

	file = xfs_open_read(filename);
	if(!file)
		return _cairo_surface_create_in_error(_cairo_error(CAIRO_STATUS_FILE_NOT_FOUND));
	surface = cairo_image_surface_create_from_png_stream(xfs_read_func, file);
	xfs_close(file);
    return surface;
}