DirectFB - Home of the pragmatist Roadmap


[directfb-dev] Feature suggestion: GetFramebufferOffsets
Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[directfb-dev] Feature suggestion: GetFramebufferOffsets



Hi,

I'd like to implement this little function:

IDirectFBSurface::GetFramebufferOffsets(...)

(See code below.)

It is for getting the video memory offsets (front, back, idle) of a surface.

What do you think? Too ugly? Any security issues?

Regards,
Andreas

Here's the (untested) code:

IDirectFBSurface_GetFramebufferOffsets( IDirectFBSurface *thiz,
                                        __u32 *front, __u32 *back,
                                        __u32 *idle, int *pitch )
{
    INTERFACE_GET_DATA(IDirectFBSurface)

    if (!data->surface)
        return DFB_DESTROYED;

    /* Redundant test?? */
    if (!data->surface->front_buffer)
        return DFB_DESTROYED;

    if (pitch)
        *pitch = data->surface->front_buffer->video.pitch;

    if (front)
        *front = data->surface->front_buffer->video.offset;

    if (back && data->surface->back_buffer)
        *back = data->surface->back_buffer->video.offset;

    if (idle && data->surface->idle_buffer)
        *idle = data->surface->idle_buffer->video.offset;

    return DFB_OK;
}



-- 
Info:  To unsubscribe send a mail to ecartis@directfb.org with 
"unsubscribe directfb-dev" as subject.



Home | Main Index | Thread Index


directfb.org / Development / Old Archives