[cairo] Infinite Loop Cairo+DirectFB

Jefferson Ferreira jeffersonfr at gmail.com
Mon Oct 1 11:15:01 PDT 2012


Hello,

Anybody can help me with directfb backend ? The git version of
cairographics I get an infinite loop. I would like to know what I have to
do. See the code below ... this example with directfb+cairo doesn't work..

// g++ simple.cpp `pkg-config --cflags --libs directfb cairo`
// -------------------------- simple.cpp
------------------------------------
#include <stdio.h>
#include <unistd.h>

#include <directfb.h>
#include <cairo-directfb.h>

static int screen_width  = 0;
static int screen_height = 0;

int main (int argc, char **argv)
{
    // init dfb
    IDirectFB *dfb = NULL;
    IDirectFBDisplayLayer  *layer = NULL;
    DFBSurfaceDescription dsc;
    DFBDisplayLayerConfig  layer_dsc;

    DirectFBInit (&argc, &argv);
  DirectFBCreate (&dfb);

    dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
    layer->SetCooperativeLevel (layer, DLSCL_ADMINISTRATIVE);

    layer_dsc.flags = DLCONF_BUFFERMODE;
    layer_dsc.buffermode = DLBM_BACKSYSTEM;
    layer->SetConfiguration (layer, &layer_dsc);

    // create window
    IDirectFBWindow *window = NULL;
    IDirectFBSurface *surface = NULL;
    DFBWindowDescription desc;

    desc.flags  = (DFBWindowDescriptionFlags)(DWDESC_POSX | DWDESC_POSY |
DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS | DWDESC_PIXELFORMAT);
    desc.caps = (DFBWindowCapabilities)(DSCAPS_NONE | DWCAPS_ALPHACHANNEL);
    desc.pixelformat = DSPF_ARGB;
    desc.posx = 0;
    desc.posy = 0;
    desc.width  = 720;
    desc.height = 480;

    layer->CreateWindow (layer, &desc, &window);
    window->SetOpacity (window, 0xFF);
    window->GetSurface (window, &surface);

    // drawing
  surface->SetColor (surface, 0x40, 0x60, 0x80, 0xff);
  surface->FillRectangle (surface, 0, 0, screen_width, screen_height);
  surface->SetColor (surface, 0x80, 0x80, 0xff, 0xff);
  surface->DrawLine (surface, 0, screen_height / 2, screen_width - 1,
screen_height / 2);
  surface->SetColor (surface, 0x00, 0x00, 0xff, 0xa0);
  surface->FillRectangle (surface, 100, 100, 300, 300);
  surface->SetColor (surface, 0x80, 0x00, 0x00, 0xa0);
  surface->FillRectangle (surface, 200, 200, 300, 300);

    surface->Flip (surface, NULL, (DFBSurfaceFlipFlags)0);

    cairo_surface_t *cairo_surface;
    cairo_t *cairo_context;

    cairo_surface = cairo_directfb_surface_create(dfb, surface);
    cairo_context = cairo_create(cairo_surface);

    cairo_set_source_rgba(cairo_context, 0x80/255.0, 0x80/255.0,
0x80/255.0, 0xff/255.0);
    cairo_rectangle(cairo_context, 150, 150, 300, 300);
  cairo_fill(cairo_context);

    cairo_destroy(cairo_context);
    cairo_surface_destroy(cairo_surface);

  sleep (5);

    // release
  surface->Release( surface );
  dfb->Release( dfb );

  return 23;
}
// ---------------------------------------- end



:: GDB ::

#0  0xb7e3a5ef in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:630
#1  0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#2  0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#3  0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#4  0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#5  0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#6  0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#7  0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#8  0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#9  0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#10 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#11 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#12 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#13 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#14 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#15 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#16 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#17 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#18 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#19 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#20 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#21 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#22 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#23 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#24 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#25 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#26 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#27 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#28 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#29 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#30 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
#31 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#32 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
...
#2048 0xb7e77298 in _cairo_dfb_surface_map_to_image
(abstract_surface=0x808de90, extents=0xbfffecf8) at
cairo-directfb-surface.c:200
#2049 0xb7e3a618 in _cairo_surface_map_to_image (surface=0x808de90,
extents=0xbfffecf8) at cairo-surface.c:637
...

Best regards.

-- 
Jefferson Ferreira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20121001/7f9a2706/attachment.html>


More information about the cairo mailing list