Exemple #1
0
void PLAYBOOK_FreeHWSurface(SDL_VideoDevice *device, SDL_Surface *surface)
{
    if (surface->hwdata) {
        screen_destroy_pixmap_buffer(surface->hwdata->pixmap);
        screen_destroy_pixmap(surface->hwdata->pixmap);
    }
    return;
}
gceSTATUS
gcoOS_DestroyPixmap(
    IN HALNativeDisplayType Display,
    IN HALNativePixmapType Pixmap
    )
{
    if (Pixmap != gcvNULL)
    {
        screen_destroy_pixmap(Pixmap);
    }
    return gcvSTATUS_OK;
}
Exemple #3
0
int PLAYBOOK_AllocHWSurface(SDL_VideoDevice *device, SDL_Surface *surface)
{
    if (surface->hwdata != NULL) {
        fprintf(stderr, "Surface already has hwdata\n");
        return -1;
    }

    surface->hwdata = SDL_malloc(sizeof(struct private_hwdata));
    if (surface->hwdata == NULL) {
        SDL_OutOfMemory();
        return -1;
    }

    int rc = screen_create_pixmap(&surface->hwdata->pixmap, device->hidden->screenContext);
    if (rc) {
        fprintf(stderr, "Failed to create HW surface: screen_create_pixmap returned %s\n", strerror(errno));
        goto fail1;
    }

    int size[2] = {surface->w, surface->h};
    rc = screen_set_pixmap_property_iv(surface->hwdata->pixmap, SCREEN_PROPERTY_BUFFER_SIZE, size);
    if (rc) {
        fprintf(stderr, "Failed to set SCREEN_PROPERTY_BUFFER_SIZE: screen_set_pixmap_property_iv returned %s\n", strerror(errno));
        goto fail1;
    }

    int format = SCREEN_FORMAT_RGBA8888;
    rc = screen_set_pixmap_property_iv(surface->hwdata->pixmap, SCREEN_PROPERTY_FORMAT, &format);
    if (rc) {
        fprintf(stderr, "Failed to set SCREEN_PROPERTY_FORMAT: screen_set_pixmap_property_iv returned %s\n", strerror(errno));
        goto fail1;
    }

    rc = screen_create_pixmap_buffer(surface->hwdata->pixmap);
    if (rc) {
        fprintf(stderr, "Failed to allocate HW surface: screen_create_pixmap_buffer returned %s\n", strerror(errno));
        goto fail2;
    }

    surface->flags |= SDL_HWSURFACE;
    surface->flags |= SDL_PREALLOC;

    return 0;

fail2:
    screen_destroy_pixmap(surface->hwdata->pixmap);
fail1:
    SDL_free(surface->hwdata);
    surface->hwdata = 0;

    return -1;
}
Control::~Control()
{
	std::vector<Label *>::iterator iter = m_labels.begin();
	while (iter != m_labels.end())
	{
		delete *iter;
		iter++;
	}
	m_labels.clear();
	screen_destroy_pixmap(m_pixmap);
	delete m_dispatcher;
	delete m_tapDispatcher;
}
static void bb10display_destroyPixmap(BB10Display *d) {
    if (!d->pixmap_created) {
        ms_warning("[bb10_display] pixmap wasn't created yet, skipping...");
        return;
    }

    screen_destroy_pixmap_buffer(d->pixmap);
    d->pixmap_buffer = NULL;
    screen_destroy_pixmap(d->pixmap);
    d->pixmap = NULL;

    d->pixmap_created = FALSE;
    ms_debug("[bb10_display] bb10display_destroyPixmap pixmap destroyed");
}
Exemple #6
0
void WindowGrabber::cleanup()
{
    if (m_screenPixmapBufferInitialized) {
        screen_destroy_buffer(m_screenPixmapBuffer);
        m_screenPixmapBufferInitialized = false;
    }

    if (m_screenPixmapInitialized) {
        screen_destroy_pixmap(m_screenPixmap);
        m_screenPixmapInitialized = false;
    }

    if (m_screenContextInitialized) {
        screen_destroy_context(m_screenContext);
        m_screenContextInitialized = false;
    }
}
gceSTATUS
gcoOS_CreatePixmap(
    IN HALNativeDisplayType Display,
    IN gctINT Width,
    IN gctINT Height,
    IN gctINT BitsPerPixel,
    OUT HALNativePixmapType * Pixmap
    )
{
    gctINT size[2];
    gctINT screen_format = SCREEN_FORMAT_RGBA8888;
    gctINT screen_usage = SCREEN_USAGE_OPENGL_ES1 | SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_OPENVG;
    gctINT rc;
    gceSTATUS status = gcvSTATUS_OK;
    gcmHEADER_ARG("Display=0x%x Width=%d Height=%d BitsPerPixel=%d", Display, Width, Height, BitsPerPixel);

    if ((Width <= 0) || (Height <= 0) || (BitsPerPixel <= 0))
    {
        status = gcvSTATUS_INVALID_ARGUMENT;
        gcmFOOTER();
        return status;
    }
    /* Create pixmap structure. */
    rc = screen_create_pixmap((struct _screen_pixmap **)Pixmap, screen_ctx);
    if (rc)
    {
        fprintf(stderr, "screen_create_pixmap failed with error %d (0x%08x)\n", errno, errno);
        status = gcvSTATUS_OUT_OF_RESOURCES;
        gcmFOOTER();
        return status;
    }

    switch (BitsPerPixel)
    {
    case 8:
        screen_format = SCREEN_FORMAT_BYTE;
        break;

    case 16:
        screen_format = SCREEN_FORMAT_RGB565;
        break;

    case 24:
        screen_format = SCREEN_FORMAT_RGB888;
        break;

    case 32:
        screen_format = SCREEN_FORMAT_RGBA8888;
        break;

    default:
        break;
    }

    /* Set pximap format. */
    rc = screen_set_pixmap_property_iv(*Pixmap, SCREEN_PROPERTY_FORMAT, &screen_format);
    if (rc)
    {
        fprintf(stderr, "screen_set_pixmap_property_iv(SCREEN_PROPERTY_FORMAT) failed with error %d (0x%08x)\n", errno, errno);
        screen_destroy_pixmap(*Pixmap);
        status = gcvSTATUS_OUT_OF_RESOURCES;
        gcmFOOTER();
        return status;
    }

    /* Set pixmap usage. */
    rc = screen_set_pixmap_property_iv(*Pixmap, SCREEN_PROPERTY_USAGE, &screen_usage);
    if (rc)
    {
        fprintf(stderr, "screen_set_pixmap_property_iv(SCREEN_PROPERTY_USAGE) failed with error %d (0x%08x)\n", errno, errno);
        screen_destroy_pixmap(*Pixmap);
        status = gcvSTATUS_OUT_OF_RESOURCES;
        gcmFOOTER();
        return status;
    }

    /* Resize the pixmap. */
    size[0] = Width;
    size[1] = Height;

    rc = screen_set_pixmap_property_iv(*Pixmap, SCREEN_PROPERTY_BUFFER_SIZE, size);
    if (rc)
    {
        fprintf(stderr, "screen_set_pixmap_property_iv(SCREEN_PROPERTY_BUFFER_SIZE) failed with error %d (0x%08x)\n", errno, errno);
        screen_destroy_pixmap(*Pixmap);
        status = gcvSTATUS_OUT_OF_RESOURCES;
        gcmFOOTER();
        return status;
    }

    /* Create pixmap buffer. */
    rc = screen_create_pixmap_buffer(*Pixmap);
    if (rc)
    {
        fprintf(stderr, "screen_create_pixmap_buffer failed with error %d (0x%08x)\n", errno, errno);
        screen_destroy_pixmap(*Pixmap);
        status = gcvSTATUS_OUT_OF_RESOURCES;
        gcmFOOTER();
        return status;
    }

    gcmFOOTER_ARG("*Pixmap=0x%x", *Pixmap);
    return status;
}