Exemplo n.º 1
0
texture_info * renderer_sdl2::texture_update(const render_primitive &prim)
{
	quad_setup_data setup;
	texture_info *texture;

	auto win = assert_window();
	setup.compute(prim, win->prescale());

	texture = texture_find(prim, setup);

	// if we didn't find one, create a new texture
	if (texture == nullptr && prim.texture.base != nullptr)
	{
		texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags));
		/* add us to the texture list */
		m_texlist.prepend(*texture);
	}

	if (texture != nullptr)
	{
		if (prim.texture.base != nullptr && texture->texinfo().seqid != prim.texture.seqid)
		{
			texture->texinfo().seqid = prim.texture.seqid;
			// if we found it, but with a different seqid, copy the data
			texture->set_data(prim.texture, prim.flags);
		}

	}
	return texture;
}
Exemplo n.º 2
0
static texture_info * texture_update(sdl_window_info *window, const render_primitive *prim)
{
	sdl_info *sdl = (sdl_info *) window->dxdata;
	quad_setup_data setup;
	texture_info *texture;

	compute_setup(sdl, prim, &setup, prim->flags);

	texture = texture_find(sdl, prim, &setup);

	// if we didn't find one, create a new texture
	if (texture == NULL && prim->texture.base != NULL)
    {
        texture = texture_create(window, &prim->texture, &setup, prim->flags);
    }

    if (texture != NULL)
	{
		if (prim->texture.base != NULL && texture->texinfo.seqid != prim->texture.seqid)
		{
			texture->texinfo.seqid = prim->texture.seqid;
			// if we found it, but with a different seqid, copy the data
			texture_set_data(sdl, texture, &prim->texture, prim->flags);
		}

	}
    return texture;
}