diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2016-03-30 16:17:07 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2016-03-30 16:17:07 +0200 |
commit | 6b54359f371edab9f6165757aabcfe823b77ccd4 (patch) | |
tree | 8902d2d3adc9b8bcc1cd52b4c82d36b9ab0667a2 /fbpdf.c | |
parent | 23c102eb5272d3c2199cb5d952c3ad4b15a03cf6 (diff) | |
download | fbida-6b54359f371edab9f6165757aabcfe823b77ccd4.tar.gz |
fbpdf: pageflip
Diffstat (limited to 'fbpdf.c')
-rw-r--r-- | fbpdf.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -42,7 +42,8 @@ gfxstate *gfx; int debug; PopplerDocument *doc; -cairo_surface_t *surface; +cairo_surface_t *surface1; +cairo_surface_t *surface2; PopplerPage *page; double pw, ph; /* pdf page size */ @@ -119,9 +120,12 @@ static void page_fit_width(void) static void page_render(void) { + static bool second; cairo_t *context; - context = cairo_create(surface); + if (surface2) + second = !second; + context = cairo_create(second ? surface2 : surface1); cairo_set_source_rgb(context, 1, 1, 1); cairo_paint(context); @@ -133,7 +137,7 @@ static void page_render(void) cairo_destroy(context); if (gfx->flush_display) - gfx->flush_display(); + gfx->flush_display(second); } /* ---------------------------------------------------------------------- */ @@ -210,7 +214,7 @@ int main(int argc, char *argv[]) } /* gfx init */ - gfx = drm_init(NULL, NULL); + gfx = drm_init(NULL, NULL, true); if (!gfx) { framebuffer = true; gfx = fb_init(NULL, NULL, 0); @@ -231,11 +235,18 @@ int main(int argc, char *argv[]) } } - surface = cairo_image_surface_create_for_data(gfx->mem, + surface1 = cairo_image_surface_create_for_data(gfx->mem, CAIRO_FORMAT_ARGB32, gfx->hdisplay, gfx->vdisplay, gfx->stride); + if (gfx->mem2) { + surface2 = cairo_image_surface_create_for_data(gfx->mem2, + CAIRO_FORMAT_ARGB32, + gfx->hdisplay, + gfx->vdisplay, + gfx->stride); + } tty_raw(); |