[cairo-commit] 4 commits - boilerplate/cairo-boilerplate.c boilerplate/cairo-test-directfb.c boilerplate/cairo-test-directfb.h

Michael Emmel memmel at kemper.freedesktop.org
Thu Oct 12 20:49:34 PDT 2006


 boilerplate/cairo-boilerplate.c   |    2 -
 boilerplate/cairo-test-directfb.c |   75 +++++++++++++++++++++++---------------
 boilerplate/cairo-test-directfb.h |   12 +++---
 3 files changed, 54 insertions(+), 35 deletions(-)

New commits:
diff-tree 02e7b892bcb75a69eb28902e7f67e2e7778bfe7b (from parents)
Merge: 151e29d8070986b9e60b4c70ebedb25e9fe71ab8 648f4bc830ab7cc89ffa2ba03d2757d0979a5671
Author: Michael Emmel <memmel at debian.localdomain>
Date:   Thu Oct 12 20:40:11 2006 -0700

    Merge branch 'master' of ssh+git://git.cairographics.org/git/cairo

diff-tree 151e29d8070986b9e60b4c70ebedb25e9fe71ab8 (from 29f483326f127ec60e26801732da2486eb84b7ef)
Author: Michael Emmel <memmel at debian.localdomain>
Date:   Thu Oct 12 20:39:26 2006 -0700

    Fixed test to compile

diff --git a/boilerplate/cairo-test-directfb.h b/boilerplate/cairo-test-directfb.h
index 29f5d20..7b92ad3 100644
--- a/boilerplate/cairo-test-directfb.h
+++ b/boilerplate/cairo-test-directfb.h
@@ -7,16 +7,16 @@
 
 CAIRO_BEGIN_DECLS
 
-extern cairo_surface_t *
-create_directfb_surface (cairo_test_t* test, cairo_format_t format,
-                     void **closure);
-
 extern void
 cleanup_directfb (void* closure);
 
 extern cairo_surface_t *
-create_directfb_bitmap_surface (cairo_test_t* test, cairo_format_t format,
-                            void **closure);
+create_directfb_surface (const char			 *name,
+		     cairo_content_t		  content,
+		     int			  width,
+		     int			  height,
+		     cairo_boilerplate_mode_t	  mode,
+		     void			**closure); 
 
 CAIRO_END_DECLS
 
diff-tree 29f483326f127ec60e26801732da2486eb84b7ef (from e521562ebf9c827508b997acda2d4292014d6938)
Author: Michael Emmel <memmel at debian.localdomain>
Date:   Thu Oct 12 20:39:16 2006 -0700

    Fixed test to compile

diff --git a/boilerplate/cairo-test-directfb.c b/boilerplate/cairo-test-directfb.c
index 2a1f3d1..aecb822 100644
--- a/boilerplate/cairo-test-directfb.c
+++ b/boilerplate/cairo-test-directfb.c
@@ -11,8 +11,7 @@ make check
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "cairo-test.h"
-#include "cairo-test-directfb.h"
+#include "cairo-boilerplate.h"
 #include <directfb.h>
 #include "cairo-directfb.h"
 
@@ -37,7 +36,7 @@ static DFBInfo *init(void) {
 	DFBDisplayLayerConfig        layer_config;
 	DFBGraphicsDeviceDescription desc;
 	int err;
-	DFBInfo *info = malloc(sizeof(DFBInfo));
+	DFBInfo *info = calloc(1,sizeof(DFBInfo));
 	if( !info )
 		return NULL;
 
@@ -58,25 +57,24 @@ static DFBInfo *init(void) {
 	return info;
 }
 
-cairo_surface_t *
-create_directfb_surface (cairo_test_t* test, cairo_format_t format,
-                     void **closure) {
+static cairo_surface_t *
+create_directfb_window_surface (DFBInfo *info,
+		     cairo_content_t		  content,
+		     int			  width,
+		     int			  height) {
 	DFBWindowDescription desc;
 	int err;
-	DFBInfo *info = init();
-	if( !info )
-		return NULL;
-	*closure = info;
-
 	desc.flags  = ( DWDESC_POSX | DWDESC_POSY |
-			DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS|DSDESC_PIXELFORMAT );
+			DWDESC_WIDTH | DWDESC_HEIGHT /*| DWDESC_CAPS|DSDESC_PIXELFORMAT*/ );
 	desc.posx   = 0;
 	desc.posy   = 0;
-	desc.width  = test->width;
-	desc.height = test->height;
+	desc.width  = width;
+	desc.height = height;
+#if 0 /*Test using native format by default*/
 	desc.caps =  DWCAPS_DOUBLEBUFFER;
 	desc.caps |= DWCAPS_ALPHACHANNEL;
 	desc.pixelformat = DSPF_ARGB;
+#endif
 
 	DFBCHECK(info->layer->CreateWindow( info->layer, &desc, &info->window ) );
 	info->window->SetOpacity( info->window, 0xFF );
@@ -84,29 +82,24 @@ create_directfb_surface (cairo_test_t* t
 	info->surface->SetColor( info->surface, 0xFF, 0xFF, 0xFF, 0xFF );
 	info->surface->FillRectangle( info->surface,0, 0, desc.width, desc.height );
 	info->surface->Flip( info->surface, NULL, 0 );
-	cairo_surface_t *csurface=cairo_directfb_surface_create(info->dfb,info->surface);
-	return csurface;
+	return cairo_directfb_surface_create(info->dfb,info->surface);
 }
 
-cairo_surface_t *
-create_directfb_bitmap_surface (cairo_test_t* test, cairo_format_t format,
-                            void **closure) {
+static cairo_surface_t *
+create_directfb_bitmap_surface (DFBInfo *info,
+		     cairo_content_t		  content,
+		     int			  width,
+		     int			  height) {
 	int  err;
-	DFBInfo *info = init();
-	if( !info ) return NULL;
-	*closure = info;
-	info->window= NULL; /* make sure window is null*/
 	DFBSurfaceDescription  desc;
 
 	desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
 	desc.caps = DSCAPS_NONE;
-	desc.width  = test->width;
-	desc.height = test->height;
+	desc.width  = width;
+	desc.height = height;
 	desc.pixelformat = DSPF_ARGB;
 	DFBCHECK(info->dfb->CreateSurface (info->dfb, &desc,&info->surface));
-	cairo_surface_t *csurface=cairo_directfb_surface_create(info->dfb,
-		info->surface);
-	return csurface;
+	return cairo_directfb_surface_create(info->dfb,info->surface);
 }
 
 void
@@ -121,3 +114,29 @@ cleanup_directfb (void* closure) {
 	if( info->dfb )
 		info->dfb->Release( info->dfb );
 }
+
+cairo_surface_t *
+create_directfb_surface (const char			 *name,
+		     cairo_content_t		  content,
+		     int			  width,
+		     int			  height,
+		     cairo_boilerplate_mode_t	  mode,
+		     void			**closure) {
+    
+    DFBInfo* info= init();
+    *closure = info;
+    if( !info ) { 
+	    CAIRO_BOILERPLATE_LOG ("Failed to init directfb:\n");
+        return NULL;
+    }
+
+    if (width == 0)
+	width = 1;
+    if (height == 0)
+	height = 1;
+
+    if (mode == CAIRO_BOILERPLATE_MODE_TEST)
+	return create_directfb_bitmap_surface (info, content, width, height);
+    else /* mode == CAIRO_BOILERPLATE_MODE_PERF */
+	return create_directfb_window_surface (info, content, width, height);
+}
diff-tree e521562ebf9c827508b997acda2d4292014d6938 (from 38dcddd79ef95b04bf8d6ff8336cb997875df41b)
Author: Michael Emmel <memmel at debian.localdomain>
Date:   Thu Oct 12 20:38:47 2006 -0700

    Fixed directfb test code

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 0bb479b..1c6ac4a 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -1595,7 +1595,7 @@ cairo_boilerplate_target_t targets[] =
     { "directfb", CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR, 0,
       create_directfb_surface, cairo_surface_write_to_png, cleanup_directfb},
     { "directfb-bitmap", CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR_ALPHA, 0,
-      create_directfb_bitmap_surface, cairo_surface_write_to_png,cleanup_directfb},
+      create_directfb_surface, cairo_surface_write_to_png,cleanup_directfb},
 #endif
 
     { NULL }


More information about the cairo-commit mailing list