예제 #1
0
bool g_get_resource_data (INT_PTR id, pfc::array_t<t_uint8> & p_out)
{
	bool ret = false;
	HRSRC rsrc = FindResource(core_api::get_my_instance(), MAKEINTRESOURCE(IDB_NOCOVER), L"PNG");
	HGLOBAL handle = LoadResource(core_api::get_my_instance(), rsrc);
	DWORD size = SizeofResource(core_api::get_my_instance(), rsrc);
	LPVOID ptr = LockResource(handle);
	if (ptr && size)
	{
		p_out.append_fromptr((t_uint8*)ptr, size);
		ret = true;
	}
	FreeResource(handle);
	return ret;
}
예제 #2
0
void stream_to_mem_block(stream_reader * p_source, pfc::array_t<t_uint8> & p_out,abort_callback & p_abort, unsigned p_sizehint, bool b_reset)
{
	if (b_reset)
		p_out.set_size(0);

	enum {min_buffer = 256};
	const unsigned buffer_size = max (min_buffer, p_sizehint);
	pfc::array_t<t_uint8> buffer;
	buffer.set_size(buffer_size);

	for(;;)
	{
		unsigned delta_done = 0;
		delta_done = p_source->read(buffer.get_ptr(),buffer_size,p_abort);
		p_out.append_fromptr(buffer.get_ptr(),delta_done);
		if (delta_done < buffer_size) break;
	}
}
예제 #3
0
	IStream_memblock_v2(const t_uint8 * p_data, t_size size) : refcount(0), m_position(0) {m_data.append_fromptr(p_data, size);};