static void
_glitz_fbo_attach_notify (void            *abstract_drawable,
			  glitz_surface_t *surface)
{
    glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
	abstract_drawable;
    glitz_texture_t      *texture;

    GLITZ_GL_DRAWABLE (drawable->other);

    texture = &surface->texture;
    if (!TEXTURE_ALLOCATED (texture))
    {
	drawable->other->backend->push_current (drawable->other, NULL,
						GLITZ_ANY_CONTEXT_CURRENT,
						NULL);
	glitz_texture_allocate (gl, texture);
	drawable->other->backend->pop_current (drawable->other);

	if (!TEXTURE_ALLOCATED (texture))
	    return;
    }

    REGION_EMPTY (&surface->drawable_damage);
}
示例#2
0
glitz_texture_object_t *
glitz_texture_object_create (glitz_surface_t *surface)
{
    glitz_texture_object_t *texture;

    GLITZ_GL_SURFACE (surface);

    /* texture dimensions must match surface dimensions */
    if (surface->texture.width  != surface->box.x2 &&
            surface->texture.height != surface->box.y2)
        return 0;

    texture = malloc (sizeof (glitz_texture_object_t));
    if (!texture)
        return 0;

    texture->ref_count = 1;

    glitz_surface_reference (surface);
    texture->surface = surface;

    if (!(TEXTURE_ALLOCATED (&surface->texture)))
        glitz_texture_allocate (gl, &surface->texture);

    texture->param = surface->texture.param;

    return texture;
}