mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-29 23:10:21 +01:00
whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/.
Ran a script to align the formal parameters of functions and collapse spaces to tabs in code.
This commit is contained in:
parent
616e35d1fa
commit
b036a09972
42 changed files with 850 additions and 746 deletions
|
|
@ -90,22 +90,22 @@ public:
|
|||
|
||||
void ReadyToRun()
|
||||
{
|
||||
release_sem(init);
|
||||
release_sem(init);
|
||||
}
|
||||
|
||||
static int32 Main(void *args)
|
||||
{
|
||||
nsBeOSApp *app = new nsBeOSApp( (sem_id)args );
|
||||
if(app == NULL)
|
||||
return B_ERROR;
|
||||
return app->Run();
|
||||
nsBeOSApp *app = new nsBeOSApp( (sem_id)args );
|
||||
if(app == NULL)
|
||||
return B_ERROR;
|
||||
return app->Run();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
const char *GetAppSig()
|
||||
{
|
||||
return "application/x-vnd.cairo-test-app";
|
||||
return "application/x-vnd.cairo-test-app";
|
||||
}
|
||||
|
||||
sem_id init;
|
||||
|
|
@ -126,7 +126,7 @@ AppRunner::AppRunner()
|
|||
sem_id initsem = create_sem(0, "Cairo BApplication init");
|
||||
if (initsem < B_OK) {
|
||||
fprintf (stderr, "Error creating BeOS initialization semaphore\n");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
thread_id tid = spawn_thread(nsBeOSApp::Main, "Cairo/BeOS test", B_NORMAL_PRIORITY, (void *)initsem);
|
||||
|
|
@ -165,12 +165,12 @@ struct beos_boilerplate_closure {
|
|||
|
||||
// Test a real window
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_beos_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
void **closure)
|
||||
_cairo_boilerplate_beos_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
void **closure)
|
||||
{
|
||||
float right = width ? width - 1 : 0;
|
||||
float bottom = height ? height - 1 : 0;
|
||||
|
|
@ -188,7 +188,7 @@ _cairo_boilerplate_beos_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_beos_cleanup (void* closure)
|
||||
_cairo_boilerplate_beos_cleanup (void *closure)
|
||||
{
|
||||
beos_boilerplate_closure* bclosure = reinterpret_cast<beos_boilerplate_closure*>(closure);
|
||||
|
||||
|
|
@ -200,12 +200,12 @@ _cairo_boilerplate_beos_cleanup (void* closure)
|
|||
|
||||
// Test a bitmap
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_beos_create_surface_for_bitmap (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
void **closure)
|
||||
_cairo_boilerplate_beos_create_surface_for_bitmap (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
void **closure)
|
||||
{
|
||||
BRect rect(0.0, 0.0, width - 1, height - 1);
|
||||
color_space beosformat = (content == CAIRO_CONTENT_COLOR_ALPHA) ? B_RGBA32
|
||||
|
|
@ -224,7 +224,7 @@ _cairo_boilerplate_beos_create_surface_for_bitmap (const char *name,
|
|||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_beos_cleanup_bitmap (void* closure)
|
||||
_cairo_boilerplate_beos_cleanup_bitmap (void *closure)
|
||||
{
|
||||
beos_boilerplate_closure* bclosure = reinterpret_cast<beos_boilerplate_closure*>(closure);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,19 +21,19 @@ make check
|
|||
D_DEBUG_DOMAIN (CairoDFB_Boiler, "CairoDFB/Boiler", "Cairo DirectFB Boilerplate");
|
||||
|
||||
/* macro for a safe call to DirectFB functions */
|
||||
#define DFBCHECK(x...) do{ \
|
||||
err = x; \
|
||||
if (err != DFB_OK) { \
|
||||
#define DFBCHECK(x...) do{ \
|
||||
err = x; \
|
||||
if (err != DFB_OK) { \
|
||||
fprintf (stderr, "%s <%d>:\n\t", __FILE__, __LINE__); \
|
||||
goto ERROR; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
typedef struct _DFBInfo {
|
||||
IDirectFB *dfb;
|
||||
IDirectFB *dfb;
|
||||
IDirectFBDisplayLayer *layer;
|
||||
IDirectFBWindow *window;
|
||||
IDirectFBSurface *surface;
|
||||
IDirectFBWindow *window;
|
||||
IDirectFBSurface *surface;
|
||||
} DFBInfo;
|
||||
|
||||
static void
|
||||
|
|
@ -59,7 +59,7 @@ _cairo_boilerplate_directfb_cleanup (void *closure)
|
|||
static DFBInfo *
|
||||
init (void)
|
||||
{
|
||||
DFBDisplayLayerConfig layer_config;
|
||||
DFBDisplayLayerConfig layer_config;
|
||||
DFBGraphicsDeviceDescription desc;
|
||||
int err;
|
||||
DFBInfo *info;
|
||||
|
|
@ -94,26 +94,26 @@ ERROR:
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_directfb_window_create_surface (DFBInfo *info,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
_cairo_boilerplate_directfb_window_create_surface (DFBInfo *info,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
DFBWindowDescription desc;
|
||||
int err;
|
||||
|
||||
D_DEBUG_AT (CairoDFB_Boiler, "%s (%p, %s, %dx%d)\n", __FUNCTION__, info,
|
||||
content == CAIRO_CONTENT_ALPHA ? "ALPHA" :
|
||||
content == CAIRO_CONTENT_COLOR ? "RGB" :
|
||||
content == CAIRO_CONTENT_ALPHA ? "ALPHA" :
|
||||
content == CAIRO_CONTENT_COLOR ? "RGB" :
|
||||
content == CAIRO_CONTENT_COLOR_ALPHA ? "ARGB" : "unknown content!",
|
||||
width, height);
|
||||
|
||||
desc.flags = DWDESC_POSX | DWDESC_POSY |
|
||||
DWDESC_WIDTH | DWDESC_HEIGHT;
|
||||
desc.caps = DSCAPS_NONE;
|
||||
desc.posx = 0;
|
||||
desc.posy = 0;
|
||||
desc.width = width;
|
||||
desc.flags = DWDESC_POSX | DWDESC_POSY |
|
||||
DWDESC_WIDTH | DWDESC_HEIGHT;
|
||||
desc.caps = DSCAPS_NONE;
|
||||
desc.posx = 0;
|
||||
desc.posy = 0;
|
||||
desc.width = width;
|
||||
desc.height = height;
|
||||
if (content == CAIRO_CONTENT_COLOR_ALPHA) {
|
||||
desc.flags |= DWDESC_CAPS | DSDESC_PIXELFORMAT;
|
||||
|
|
@ -136,23 +136,23 @@ ERROR:
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_directfb_bitmap_create_surface (DFBInfo *info,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
_cairo_boilerplate_directfb_bitmap_create_surface (DFBInfo *info,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
int err;
|
||||
DFBSurfaceDescription desc;
|
||||
|
||||
D_DEBUG_AT (CairoDFB_Boiler, "%s (%p, %s, %dx%d)\n", __FUNCTION__, info,
|
||||
content == CAIRO_CONTENT_ALPHA ? "ALPHA" :
|
||||
content == CAIRO_CONTENT_COLOR ? "RGB" :
|
||||
content == CAIRO_CONTENT_ALPHA ? "ALPHA" :
|
||||
content == CAIRO_CONTENT_COLOR ? "RGB" :
|
||||
content == CAIRO_CONTENT_COLOR_ALPHA ? "ARGB" : "unknown content!",
|
||||
width, height);
|
||||
|
||||
desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT;
|
||||
desc.caps = DSCAPS_NONE;
|
||||
desc.width = width;
|
||||
desc.width = width;
|
||||
desc.height = height;
|
||||
if (content == CAIRO_CONTENT_COLOR_ALPHA) {
|
||||
desc.flags |= DSDESC_PIXELFORMAT;
|
||||
|
|
@ -168,33 +168,33 @@ ERROR:
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_directfb_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_directfb_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
|
||||
DFBInfo *info;
|
||||
|
||||
info = init ();
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
*closure = info;
|
||||
|
||||
D_DEBUG_AT (CairoDFB_Boiler, "%s ('%s', %s, %dx%d, %s)\n",
|
||||
__FUNCTION__, name,
|
||||
content == CAIRO_CONTENT_ALPHA ? "ALPHA" :
|
||||
content == CAIRO_CONTENT_COLOR ? "RGB" :
|
||||
content == CAIRO_CONTENT_COLOR_ALPHA ? "ARGB" : "unknown content!",
|
||||
width, height,
|
||||
mode == CAIRO_BOILERPLATE_MODE_TEST ? "TEST" :
|
||||
mode == CAIRO_BOILERPLATE_MODE_PERF ? "PERF" : "unknown mode!");
|
||||
content == CAIRO_CONTENT_ALPHA ? "ALPHA" :
|
||||
content == CAIRO_CONTENT_COLOR ? "RGB" :
|
||||
content == CAIRO_CONTENT_COLOR_ALPHA ? "ARGB" : "unknown content!",
|
||||
width, height,
|
||||
mode == CAIRO_BOILERPLATE_MODE_TEST ? "TEST" :
|
||||
mode == CAIRO_BOILERPLATE_MODE_PERF ? "PERF" : "unknown mode!");
|
||||
|
||||
if (width == 0)
|
||||
width = 1;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ _cairo_boilerplate_drm_create_surface (const char *name,
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ _cairo_boilerplate_egl_cleanup (void *closure)
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_egl_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
egl_target_closure_t *gltc;
|
||||
cairo_surface_t *surface;
|
||||
|
|
@ -107,7 +107,7 @@ _cairo_boilerplate_egl_create_surface (const char *name,
|
|||
|
||||
gltc->surface = surface = cairo_gl_surface_create (gltc->device,
|
||||
content,
|
||||
ceil (width),
|
||||
ceil (width),
|
||||
ceil (height));
|
||||
if (cairo_surface_status (surface))
|
||||
_cairo_boilerplate_egl_cleanup (gltc);
|
||||
|
|
@ -121,7 +121,7 @@ _cairo_boilerplate_egl_synchronize (void *closure)
|
|||
egl_target_closure_t *gltc = closure;
|
||||
|
||||
if (cairo_device_acquire (gltc->device))
|
||||
return;
|
||||
return;
|
||||
|
||||
glFinish ();
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ int optopt = '?';
|
|||
|
||||
|
||||
static char** prev_argv = NULL; /* Keep a copy of argv and argc to */
|
||||
static int prev_argc = 0; /* tell if getopt params change */
|
||||
static int argv_index = 0; /* Option we're checking */
|
||||
static int argv_index2 = 0; /* Option argument we're checking */
|
||||
static int opt_offset = 0; /* Index into compounded "-option" */
|
||||
static int dashdash = 0; /* True if "--" option reached */
|
||||
static int nonopt = 0; /* How many nonopts we've found */
|
||||
static int prev_argc = 0; /* tell if getopt params change */
|
||||
static int argv_index = 0; /* Option we're checking */
|
||||
static int argv_index2 = 0; /* Option argument we're checking */
|
||||
static int opt_offset = 0; /* Index into compounded "-option" */
|
||||
static int dashdash = 0; /* True if "--" option reached */
|
||||
static int nonopt = 0; /* How many nonopts we've found */
|
||||
|
||||
static void increment_index(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,15 +67,15 @@ _cairo_boilerplate_gl_cleanup (void *closure)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_gl_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_gl_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
int rgba_attribs[] = { GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
|
|
@ -135,7 +135,7 @@ _cairo_boilerplate_gl_create_surface (const char *name,
|
|||
|
||||
gltc->surface = surface = cairo_gl_surface_create (gltc->device,
|
||||
content,
|
||||
ceil (width),
|
||||
ceil (width),
|
||||
ceil (height));
|
||||
if (cairo_surface_status (surface))
|
||||
_cairo_boilerplate_gl_cleanup (gltc);
|
||||
|
|
@ -144,15 +144,15 @@ _cairo_boilerplate_gl_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_gl_create_window (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_gl_create_window (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
int rgba_attribs[] = { GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
|
|
@ -225,15 +225,15 @@ _cairo_boilerplate_gl_create_window (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_gl_create_window_db (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_gl_create_window_db (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
int rgba_attribs[] = { GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
|
|
@ -311,7 +311,7 @@ _cairo_boilerplate_gl_create_window_db (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_gl_finish_window (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_gl_finish_window (cairo_surface_t *surface)
|
||||
{
|
||||
gl_target_closure_t *gltc = cairo_surface_get_user_data (surface,
|
||||
&gl_closure_key);
|
||||
|
|
@ -339,7 +339,7 @@ _cairo_boilerplate_gl_synchronize (void *closure)
|
|||
gl_target_closure_t *gltc = closure;
|
||||
|
||||
if (cairo_device_acquire (gltc->device))
|
||||
return;
|
||||
return;
|
||||
|
||||
glFinish ();
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ static const cairo_user_data_key_t pdf_closure_key;
|
|||
typedef struct _pdf_target_closure
|
||||
{
|
||||
char *filename;
|
||||
int width;
|
||||
int height;
|
||||
int width;
|
||||
int height;
|
||||
cairo_surface_t *target;
|
||||
} pdf_target_closure_t;
|
||||
|
||||
|
|
@ -59,8 +59,8 @@ _cairo_boilerplate_pdf_create_surface (const char *name,
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
pdf_target_closure_t *ptc;
|
||||
|
|
@ -112,7 +112,7 @@ _cairo_boilerplate_pdf_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface)
|
||||
{
|
||||
pdf_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&pdf_closure_key);
|
||||
|
|
@ -156,7 +156,8 @@ _cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface)
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_pdf_surface_write_to_png (cairo_surface_t *surface, const char *filename)
|
||||
_cairo_boilerplate_pdf_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
{
|
||||
pdf_target_closure_t *ptc = cairo_surface_get_user_data (surface, &pdf_closure_key);
|
||||
char command[4096];
|
||||
|
|
@ -177,7 +178,8 @@ _cairo_boilerplate_pdf_surface_write_to_png (cairo_surface_t *surface, const cha
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_pdf_convert_to_image (cairo_surface_t *surface, int page)
|
||||
_cairo_boilerplate_pdf_convert_to_image (cairo_surface_t *surface,
|
||||
int page)
|
||||
{
|
||||
pdf_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&pdf_closure_key);
|
||||
|
|
@ -187,9 +189,9 @@ _cairo_boilerplate_pdf_convert_to_image (cairo_surface_t *surface, int page)
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_pdf_get_image_surface (cairo_surface_t *surface,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *image;
|
||||
|
||||
|
|
@ -217,7 +219,7 @@ _cairo_boilerplate_pdf_cleanup (void *closure)
|
|||
|
||||
static void
|
||||
_cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface,
|
||||
unsigned int flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
pdf_target_closure_t *ptc = cairo_surface_get_user_data (abstract_surface,
|
||||
&pdf_closure_key);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ _cairo_boilerplate_register_all (void);
|
|||
|
||||
void
|
||||
_cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
|
||||
unsigned int count);
|
||||
unsigned int count);
|
||||
|
||||
#define CAIRO_BOILERPLATE(name__, targets__) \
|
||||
void _register_##name__ (void); \
|
||||
|
|
|
|||
|
|
@ -43,15 +43,15 @@ static const cairo_user_data_key_t ps_closure_key;
|
|||
|
||||
typedef struct _ps_target_closure {
|
||||
char *filename;
|
||||
int width;
|
||||
int height;
|
||||
int width;
|
||||
int height;
|
||||
cairo_surface_t *target;
|
||||
cairo_ps_level_t level;
|
||||
} ps_target_closure_t;
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_ps_surface_set_creation_date (cairo_surface_t *abstract_surface,
|
||||
time_t date)
|
||||
time_t date)
|
||||
{
|
||||
cairo_paginated_surface_t *paginated = (cairo_paginated_surface_t*) abstract_surface;
|
||||
cairo_ps_surface_t *surface;
|
||||
|
|
@ -68,18 +68,18 @@ _cairo_boilerplate_ps_surface_set_creation_date (cairo_surface_t *abstract_surfa
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_ps_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
cairo_ps_level_t level,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_ps_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
cairo_ps_level_t level,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
ps_target_closure_t *ptc;
|
||||
ps_target_closure_t *ptc;
|
||||
cairo_surface_t *surface;
|
||||
cairo_status_t status;
|
||||
|
||||
|
|
@ -137,8 +137,8 @@ _cairo_boilerplate_ps2_create_surface (const char *name,
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
return _cairo_boilerplate_ps_create_surface (name, content,
|
||||
|
|
@ -156,8 +156,8 @@ _cairo_boilerplate_ps3_create_surface (const char *name,
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
return _cairo_boilerplate_ps_create_surface (name, content,
|
||||
|
|
@ -169,7 +169,7 @@ _cairo_boilerplate_ps3_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface)
|
||||
{
|
||||
ps_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&ps_closure_key);
|
||||
|
|
@ -210,7 +210,8 @@ _cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface)
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_ps_surface_write_to_png (cairo_surface_t *surface, const char *filename)
|
||||
_cairo_boilerplate_ps_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
{
|
||||
ps_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&ps_closure_key);
|
||||
|
|
@ -234,9 +235,9 @@ _cairo_boilerplate_ps_surface_write_to_png (cairo_surface_t *surface, const char
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_ps_get_image_surface (cairo_surface_t *surface,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
ps_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&ps_closure_key);
|
||||
|
|
@ -280,7 +281,7 @@ _cairo_boilerplate_ps_cleanup (void *closure)
|
|||
|
||||
static void
|
||||
_cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface,
|
||||
unsigned int flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
ps_target_closure_t *ptc = cairo_surface_get_user_data (abstract_surface,
|
||||
&ps_closure_key);
|
||||
|
|
|
|||
|
|
@ -53,15 +53,15 @@ _cairo_boilerplate_qt_cleanup (void *closure)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_qt_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_qt_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
qt_closure_t *qtc;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@
|
|||
#include <cairo-quartz.h>
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_quartz_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_quartz_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
cairo_format_t format;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@
|
|||
|
||||
void
|
||||
cairo_boilerplate_scaled_font_set_max_glyphs_cached (cairo_scaled_font_t *scaled_font,
|
||||
int max_glyphs);
|
||||
int max_glyphs);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@ typedef struct _script_target_closure {
|
|||
} script_target_closure_t;
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_script_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_script_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
script_target_closure_t *ptc;
|
||||
cairo_device_t *ctx;
|
||||
|
|
@ -78,7 +78,7 @@ _cairo_boilerplate_script_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_script_finish_surface (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_script_finish_surface (cairo_surface_t *surface)
|
||||
{
|
||||
cairo_surface_finish (surface);
|
||||
return cairo_surface_status (surface);
|
||||
|
|
@ -86,14 +86,14 @@ _cairo_boilerplate_script_finish_surface (cairo_surface_t *surface)
|
|||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_script_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
const char *filename)
|
||||
{
|
||||
return CAIRO_STATUS_WRITE_ERROR;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_script_convert_to_image (cairo_surface_t *surface,
|
||||
int page)
|
||||
int page)
|
||||
{
|
||||
script_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&script_closure_key);
|
||||
|
|
@ -102,9 +102,9 @@ _cairo_boilerplate_script_convert_to_image (cairo_surface_t *surface,
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_script_get_image_surface (cairo_surface_t *surface,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *image;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
#include <cairo-skia.h>
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_skia_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_skia_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
cairo_format_t format;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ static const cairo_user_data_key_t svg_closure_key;
|
|||
|
||||
typedef struct _svg_target_closure {
|
||||
char *filename;
|
||||
int width, height;
|
||||
int width, height;
|
||||
cairo_surface_t *target;
|
||||
} svg_target_closure_t;
|
||||
|
||||
|
|
@ -55,8 +55,8 @@ _cairo_boilerplate_svg_create_surface (const char *name,
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
svg_target_closure_t *ptc;
|
||||
|
|
@ -104,15 +104,15 @@ _cairo_boilerplate_svg_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_svg11_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_svg11_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
/* current default, but be explicit in case the default changes */
|
||||
return _cairo_boilerplate_svg_create_surface (name, content,
|
||||
|
|
@ -124,15 +124,15 @@ _cairo_boilerplate_svg11_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_svg12_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_svg12_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
return _cairo_boilerplate_svg_create_surface (name, content,
|
||||
CAIRO_SVG_VERSION_1_2,
|
||||
|
|
@ -143,10 +143,10 @@ _cairo_boilerplate_svg12_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface)
|
||||
{
|
||||
svg_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&svg_closure_key);
|
||||
&svg_closure_key);
|
||||
cairo_status_t status;
|
||||
|
||||
/* Both surface and ptc->target were originally created at the
|
||||
|
|
@ -187,10 +187,11 @@ _cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface)
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_svg_surface_write_to_png (cairo_surface_t *surface, const char *filename)
|
||||
_cairo_boilerplate_svg_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
{
|
||||
svg_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&svg_closure_key);
|
||||
&svg_closure_key);
|
||||
char command[4096];
|
||||
int exitstatus;
|
||||
|
||||
|
|
@ -219,9 +220,9 @@ _cairo_boilerplate_svg_convert_to_image (cairo_surface_t *surface)
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_svg_get_image_surface (cairo_surface_t *surface,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *image;
|
||||
|
||||
|
|
@ -252,7 +253,7 @@ _cairo_boilerplate_svg_cleanup (void *closure)
|
|||
|
||||
static void
|
||||
_cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *abstract_surface,
|
||||
unsigned int flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
svg_target_closure_t *ptc = cairo_surface_get_user_data (abstract_surface,
|
||||
&svg_closure_key);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ xmalloc (size_t size)
|
|||
}
|
||||
|
||||
void *
|
||||
xcalloc (size_t nmemb, size_t size)
|
||||
xcalloc (size_t nmemb,
|
||||
size_t size)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
|
|
@ -71,7 +72,8 @@ xcalloc (size_t nmemb, size_t size)
|
|||
}
|
||||
|
||||
void *
|
||||
xrealloc (void *buf, size_t size)
|
||||
xrealloc (void *buf,
|
||||
size_t size)
|
||||
{
|
||||
buf = realloc (buf, size);
|
||||
if (buf == NULL && size != 0) {
|
||||
|
|
@ -83,7 +85,9 @@ xrealloc (void *buf, size_t size)
|
|||
}
|
||||
|
||||
void
|
||||
xasprintf (char **strp, const char *fmt, ...)
|
||||
xasprintf (char **strp,
|
||||
const char *fmt,
|
||||
...)
|
||||
{
|
||||
#ifdef HAVE_VASPRINTF
|
||||
va_list va;
|
||||
|
|
|
|||
|
|
@ -34,15 +34,19 @@ xmalloc (size_t size);
|
|||
|
||||
#define xcalloc cairo_boilerplate_xcalloc
|
||||
void *
|
||||
xcalloc (size_t nmemb, size_t size);
|
||||
xcalloc (size_t nmemb,
|
||||
size_t size);
|
||||
|
||||
#define xrealloc cairo_boilerplate_xrealloc
|
||||
void *
|
||||
xrealloc (void *buf, size_t size);
|
||||
xrealloc (void *buf,
|
||||
size_t size);
|
||||
|
||||
#define xasprintf cairo_boilerplate_xasprintf
|
||||
void
|
||||
xasprintf (char **strp, const char *fmt, ...) CAIRO_BOILERPLATE_PRINTF_FORMAT(2, 3);
|
||||
xasprintf (char **strp,
|
||||
const char *fmt,
|
||||
...) CAIRO_BOILERPLATE_PRINTF_FORMAT(2, 3);
|
||||
|
||||
#define xunlink cairo_boilerplate_xunlink
|
||||
void
|
||||
|
|
|
|||
|
|
@ -43,15 +43,15 @@
|
|||
#endif
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_test_fallback_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_test_fallback_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
*closure = NULL;
|
||||
return _cairo_test_fallback_surface_create (content,
|
||||
|
|
@ -59,15 +59,15 @@ _cairo_boilerplate_test_fallback_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_test_fallback16_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_test_fallback16_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
*closure = NULL;
|
||||
return _cairo_test_fallback16_surface_create (content,
|
||||
|
|
@ -76,15 +76,15 @@ _cairo_boilerplate_test_fallback16_create_surface (const char *name,
|
|||
|
||||
#if CAIRO_HAS_TEST_NULL_SURFACE
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_test_null_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_test_null_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
*closure = NULL;
|
||||
return _cairo_test_null_surface_create (content);
|
||||
|
|
@ -99,15 +99,15 @@ typedef struct {
|
|||
} test_paginated_closure_t;
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_test_paginated_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_test_paginated_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
test_paginated_closure_t *tpc;
|
||||
cairo_format_t format;
|
||||
|
|
@ -152,8 +152,8 @@ _cairo_boilerplate_test_paginated_create_surface (const char *name,
|
|||
* tested.
|
||||
*/
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_test_paginated_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
_cairo_boilerplate_test_paginated_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
{
|
||||
test_paginated_closure_t *tpc;
|
||||
cairo_status_t status;
|
||||
|
|
@ -170,9 +170,9 @@ _cairo_boilerplate_test_paginated_surface_write_to_png (cairo_surface_t *surface
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_test_paginated_get_image_surface (cairo_surface_t *surface,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
test_paginated_closure_t *tpc;
|
||||
cairo_status_t status;
|
||||
|
|
@ -203,15 +203,15 @@ _cairo_boilerplate_test_paginated_cleanup (void *closure)
|
|||
|
||||
#if CAIRO_HAS_TEST_WRAPPING_SURFACE
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_test_wrapping_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_test_wrapping_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
cairo_surface_t *target;
|
||||
cairo_surface_t *surface;
|
||||
|
|
|
|||
|
|
@ -71,15 +71,15 @@ _cairo_boilerplate_vg_cleanup_glx (void *closure)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_vg_create_surface_glx (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_vg_create_surface_glx (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
int rgba_attribs[] = {
|
||||
GLX_RGBA,
|
||||
|
|
@ -200,15 +200,15 @@ _cairo_boilerplate_vg_cleanup_egl (void *closure)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_vg_create_surface_egl (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_vg_create_surface_egl (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
int rgba_attribs[] = {
|
||||
EGL_RED_SIZE, 8,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ _cairo_boilerplate_wgl_cleanup (void *closure)
|
|||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_wgl_create_window (int width, int height, wgl_target_closure_t *wgltc)
|
||||
_cairo_boilerplate_wgl_create_window (int width,
|
||||
int height,
|
||||
wgl_target_closure_t *wgltc)
|
||||
{
|
||||
WNDCLASSEXA wincl;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
|
@ -101,14 +103,14 @@ _cairo_boilerplate_wgl_create_window (int width, int height, wgl_target_closure
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_wgl_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
wgl_target_closure_t *wgltc;
|
||||
cairo_surface_t *surface;
|
||||
|
|
@ -120,32 +122,32 @@ _cairo_boilerplate_wgl_create_surface (const char *name,
|
|||
_cairo_boilerplate_wgl_create_window(0, 0, wgltc);
|
||||
|
||||
if (width == 0)
|
||||
width = 1;
|
||||
width = 1;
|
||||
if (height == 0)
|
||||
height = 1;
|
||||
height = 1;
|
||||
|
||||
wgltc->surface = surface = cairo_gl_surface_create (wgltc->device,
|
||||
content,
|
||||
ceil (width),
|
||||
ceil (width),
|
||||
ceil (height));
|
||||
if (cairo_surface_status (surface)) {
|
||||
_cairo_boilerplate_wgl_cleanup (wgltc);
|
||||
return NULL;
|
||||
_cairo_boilerplate_wgl_cleanup (wgltc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_wgl_for_create_window (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_wgl_for_create_window (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
wgl_target_closure_t *wgltc;
|
||||
cairo_surface_t *surface;
|
||||
|
|
@ -158,19 +160,19 @@ _cairo_boilerplate_wgl_for_create_window (const char *name,
|
|||
|
||||
wgltc->surface = surface = cairo_gl_surface_create_for_dc (wgltc->device,
|
||||
wgltc->dc,
|
||||
ceil (width),
|
||||
ceil (width),
|
||||
ceil (height));
|
||||
|
||||
if (cairo_surface_status (surface)) {
|
||||
_cairo_boilerplate_wgl_cleanup (wgltc);
|
||||
return NULL;
|
||||
_cairo_boilerplate_wgl_cleanup (wgltc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_wgl_finish_window (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_wgl_finish_window (cairo_surface_t *surface)
|
||||
{
|
||||
wgl_target_closure_t *wgltc = cairo_surface_get_user_data (surface,
|
||||
&gl_closure_key);
|
||||
|
|
@ -198,7 +200,7 @@ _cairo_boilerplate_wgl_synchronize (void *closure)
|
|||
wgl_target_closure_t *wgltc = closure;
|
||||
|
||||
if (cairo_device_acquire (wgltc->device))
|
||||
return;
|
||||
return;
|
||||
|
||||
glFinish ();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Carl D. Worth <cworth@cworth.org>
|
||||
* Adrian Johnson <ajohnson@redneon.com>
|
||||
* Adrian Johnson <ajohnson@redneon.com>
|
||||
*/
|
||||
|
||||
/* We require Windows 2000 features such as GetDefaultPrinter() */
|
||||
|
|
@ -160,15 +160,15 @@ create_printer_dc (win32_target_closure_t *ptc)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_win32_printing_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_win32_printing_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
win32_target_closure_t *ptc;
|
||||
cairo_surface_t *surface;
|
||||
|
|
@ -232,7 +232,8 @@ _cairo_boilerplate_win32_printing_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface, const char *filename)
|
||||
_cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface,
|
||||
const char *filename)
|
||||
{
|
||||
win32_target_closure_t *ptc = cairo_surface_get_user_data (surface, &win32_closure_key);
|
||||
char command[4096];
|
||||
|
|
@ -300,9 +301,9 @@ _cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface
|
|||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_win32_printing_get_image_surface (cairo_surface_t *surface,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
win32_target_closure_t *ptc = cairo_surface_get_user_data (surface,
|
||||
&win32_closure_key);
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@
|
|||
#include <cairo-win32.h>
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_win32_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_win32_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
cairo_format_t format;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ _cairo_boilerplate_xcb_synchronize (void *closure)
|
|||
}
|
||||
|
||||
static xcb_render_pictforminfo_t *
|
||||
find_depth (xcb_connection_t *connection, int depth, void **formats_out)
|
||||
find_depth (xcb_connection_t *connection,
|
||||
int depth,
|
||||
void **formats_out)
|
||||
{
|
||||
xcb_render_query_pict_formats_reply_t *formats;
|
||||
xcb_render_query_pict_formats_cookie_t cookie;
|
||||
|
|
@ -108,8 +110,8 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xcb_screen_t *root;
|
||||
|
|
@ -194,7 +196,8 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static xcb_visualtype_t *
|
||||
lookup_visual (xcb_screen_t *s, xcb_visualid_t visual)
|
||||
lookup_visual (xcb_screen_t *s,
|
||||
xcb_visualid_t visual)
|
||||
{
|
||||
xcb_depth_iterator_t d;
|
||||
|
||||
|
|
@ -211,15 +214,15 @@ lookup_visual (xcb_screen_t *s, xcb_visualid_t visual)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xcb_create_window (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_xcb_create_window (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xcb_target_closure_t *xtc;
|
||||
xcb_connection_t *c;
|
||||
|
|
@ -282,15 +285,15 @@ _cairo_boilerplate_xcb_create_window (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xcb_create_window_db (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_xcb_create_window_db (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xcb_target_closure_t *xtc;
|
||||
xcb_connection_t *c;
|
||||
|
|
@ -354,15 +357,15 @@ _cairo_boilerplate_xcb_create_window_db (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xcb_create_render_0_0 (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_xcb_create_render_0_0 (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xcb_screen_t *root;
|
||||
xcb_target_closure_t *xtc;
|
||||
|
|
@ -463,15 +466,15 @@ _cairo_boilerplate_xcb_create_render_0_0 (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xcb_create_fallback (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_xcb_create_fallback (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xcb_target_closure_t *xtc;
|
||||
xcb_connection_t *c;
|
||||
|
|
@ -553,7 +556,7 @@ _cairo_boilerplate_xcb_create_fallback (const char *name,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_boilerplate_xcb_finish_surface (cairo_surface_t *surface)
|
||||
_cairo_boilerplate_xcb_finish_surface (cairo_surface_t *surface)
|
||||
{
|
||||
xcb_target_closure_t *xtc = cairo_surface_get_user_data (surface,
|
||||
&xcb_closure_key);
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ _cairo_boilerplate_xlib_synchronize (void *closure)
|
|||
}
|
||||
|
||||
static cairo_bool_t
|
||||
_cairo_boilerplate_xlib_check_screen_size (Display *dpy,
|
||||
int screen,
|
||||
int width,
|
||||
int height)
|
||||
_cairo_boilerplate_xlib_check_screen_size (Display *dpy,
|
||||
int screen,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
Screen *scr = XScreenOfDisplay (dpy, screen);
|
||||
return width <= WidthOfScreen (scr) && height <= HeightOfScreen (scr);
|
||||
|
|
@ -91,11 +91,11 @@ _cairo_boilerplate_xlib_check_screen_size (Display *dpy,
|
|||
* For obvious reasons, we don't use XSynchronize.
|
||||
*/
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xlib_test_create_surface (Display *dpy,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height,
|
||||
xlib_target_closure_t *xtc)
|
||||
_cairo_boilerplate_xlib_test_create_surface (Display *dpy,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height,
|
||||
xlib_target_closure_t *xtc)
|
||||
{
|
||||
XRenderPictFormat *xrender_format;
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ _cairo_boilerplate_xlib_test_create_surface (Display *dpy,
|
|||
* for each test even if the server does have the Render
|
||||
* extension. That would probably be through another
|
||||
* cairo_boilerplate_target which would use an extended version of
|
||||
* cairo_test_xlib_disable_render. */
|
||||
* cairo_test_xlib_disable_render. */
|
||||
switch (content) {
|
||||
case CAIRO_CONTENT_COLOR_ALPHA:
|
||||
xrender_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
|
||||
|
|
@ -140,11 +140,11 @@ _cairo_boilerplate_xlib_test_create_surface (Display *dpy,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xlib_perf_create_surface (Display *dpy,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height,
|
||||
xlib_target_closure_t *xtc)
|
||||
_cairo_boilerplate_xlib_perf_create_surface (Display *dpy,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height,
|
||||
xlib_target_closure_t *xtc)
|
||||
{
|
||||
XSetWindowAttributes attr;
|
||||
XRenderPictFormat *xrender_format;
|
||||
|
|
@ -165,8 +165,8 @@ _cairo_boilerplate_xlib_perf_create_surface (Display *dpy,
|
|||
|
||||
case CAIRO_CONTENT_COLOR:
|
||||
if (! _cairo_boilerplate_xlib_check_screen_size (dpy,
|
||||
DefaultScreen (dpy),
|
||||
width, height)) {
|
||||
DefaultScreen (dpy),
|
||||
width, height)) {
|
||||
CAIRO_BOILERPLATE_DEBUG (("Surface is larger than the Screen.\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -199,15 +199,15 @@ _cairo_boilerplate_xlib_perf_create_surface (Display *dpy,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xlib_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_xlib_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xlib_target_closure_t *xtc;
|
||||
Display *dpy;
|
||||
|
|
@ -242,15 +242,15 @@ _cairo_boilerplate_xlib_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xlib_window_create_surface (const char *name,
|
||||
_cairo_boilerplate_xlib_window_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xlib_target_closure_t *xtc;
|
||||
Display *dpy;
|
||||
|
|
@ -293,7 +293,7 @@ _cairo_boilerplate_xlib_window_create_surface (const char *name,
|
|||
|
||||
screen = DefaultScreen (dpy);
|
||||
if (! _cairo_boilerplate_xlib_check_screen_size (dpy, screen,
|
||||
width, height)) {
|
||||
width, height)) {
|
||||
CAIRO_BOILERPLATE_DEBUG (("Surface is larger than the Screen.\n"));
|
||||
XCloseDisplay (dpy);
|
||||
free (xtc);
|
||||
|
|
@ -384,15 +384,15 @@ cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface
|
|||
* cairo-xlib-surface.c
|
||||
*/
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_xlib_fallback_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_xlib_fallback_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
xlib_target_closure_t *xtc;
|
||||
Display *dpy;
|
||||
|
|
@ -435,7 +435,7 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name,
|
|||
|
||||
screen = DefaultScreen (dpy);
|
||||
if (! _cairo_boilerplate_xlib_check_screen_size (dpy, screen,
|
||||
width, height)) {
|
||||
width, height)) {
|
||||
CAIRO_BOILERPLATE_DEBUG (("Surface is larger than the Screen.\n"));
|
||||
XCloseDisplay (dpy);
|
||||
free (xtc);
|
||||
|
|
|
|||
|
|
@ -123,15 +123,15 @@ cairo_boilerplate_format_from_content (cairo_content_t content)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_image_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_image_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
cairo_format_t format;
|
||||
|
||||
|
|
@ -150,15 +150,15 @@ _cairo_boilerplate_image_create_surface (const char *name,
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_image16_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_image16_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
*closure = NULL;
|
||||
|
||||
|
|
@ -168,15 +168,15 @@ _cairo_boilerplate_image16_create_surface (const char *name,
|
|||
|
||||
#if CAIRO_HAS_RECORDING_SURFACE
|
||||
static cairo_surface_t *
|
||||
_cairo_boilerplate_recording_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
_cairo_boilerplate_recording_create_surface (const char *name,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure)
|
||||
{
|
||||
cairo_rectangle_t extents;
|
||||
|
||||
|
|
@ -199,9 +199,9 @@ const cairo_user_data_key_t cairo_boilerplate_output_basename_key;
|
|||
|
||||
cairo_surface_t *
|
||||
_cairo_boilerplate_get_image_surface (cairo_surface_t *src,
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
int page,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *surface, *image;
|
||||
cairo_t *cr;
|
||||
|
|
@ -228,7 +228,7 @@ _cairo_boilerplate_get_image_surface (cairo_surface_t *src,
|
|||
cairo_device_t *ctx;
|
||||
char *filename;
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
xasprintf (&filename, "%s.out.trace", test_name);
|
||||
ctx = cairo_script_create (filename);
|
||||
|
|
@ -257,10 +257,10 @@ _cairo_boilerplate_get_image_surface (cairo_surface_t *src,
|
|||
}
|
||||
|
||||
cairo_surface_t *
|
||||
cairo_boilerplate_get_image_surface_from_png (const char *filename,
|
||||
int width,
|
||||
int height,
|
||||
cairo_bool_t flatten)
|
||||
cairo_boilerplate_get_image_surface_from_png (const char *filename,
|
||||
int width,
|
||||
int height,
|
||||
cairo_bool_t flatten)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ probe_target (const cairo_boilerplate_target_t *target)
|
|||
|
||||
void
|
||||
_cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
|
||||
unsigned int count)
|
||||
unsigned int count)
|
||||
{
|
||||
targets += count;
|
||||
while (count--) {
|
||||
|
|
@ -417,8 +417,8 @@ _cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
|
|||
|
||||
static cairo_bool_t
|
||||
_cairo_boilerplate_target_matches_name (const cairo_boilerplate_target_t *target,
|
||||
const char *tname,
|
||||
const char *end)
|
||||
const char *tname,
|
||||
const char *end)
|
||||
{
|
||||
char const *content_name;
|
||||
const char *content_start = strpbrk (tname, ".");
|
||||
|
|
@ -455,7 +455,8 @@ _cairo_boilerplate_target_matches_name (const cairo_boilerplate_target_t *target
|
|||
}
|
||||
|
||||
const cairo_boilerplate_target_t **
|
||||
cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets)
|
||||
cairo_boilerplate_get_targets (int *pnum_targets,
|
||||
cairo_bool_t *plimited_targets)
|
||||
{
|
||||
size_t i, num_targets;
|
||||
cairo_bool_t limited_targets = FALSE;
|
||||
|
|
@ -477,7 +478,7 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets
|
|||
int found = 0;
|
||||
const char *end = strpbrk (tname, " \t\r\n;:,");
|
||||
if (!end)
|
||||
end = tname + strlen (tname);
|
||||
end = tname + strlen (tname);
|
||||
|
||||
if (end == tname) {
|
||||
tname = end + 1;
|
||||
|
|
@ -551,7 +552,7 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets
|
|||
int j;
|
||||
const char *end = strpbrk (tname, " \t\r\n;:,");
|
||||
if (!end)
|
||||
end = tname + strlen (tname);
|
||||
end = tname + strlen (tname);
|
||||
|
||||
if (end == tname) {
|
||||
tname = end + 1;
|
||||
|
|
@ -604,8 +605,8 @@ cairo_boilerplate_get_image_target (cairo_content_t content)
|
|||
}
|
||||
|
||||
const cairo_boilerplate_target_t *
|
||||
cairo_boilerplate_get_target_by_name (const char *name,
|
||||
cairo_content_t content)
|
||||
cairo_boilerplate_get_target_by_name (const char *name,
|
||||
cairo_content_t content)
|
||||
{
|
||||
struct cairo_boilerplate_target_list *list;
|
||||
|
||||
|
|
@ -666,7 +667,7 @@ cairo_boilerplate_surface_create_in_error (cairo_status_t status)
|
|||
|
||||
void
|
||||
cairo_boilerplate_scaled_font_set_max_glyphs_cached (cairo_scaled_font_t *scaled_font,
|
||||
int max_glyphs)
|
||||
int max_glyphs)
|
||||
{
|
||||
/* XXX CAIRO_DEBUG */
|
||||
}
|
||||
|
|
@ -701,9 +702,9 @@ any2ppm_daemon_exists (void)
|
|||
#endif
|
||||
|
||||
FILE *
|
||||
cairo_boilerplate_open_any2ppm (const char *filename,
|
||||
int page,
|
||||
unsigned int flags)
|
||||
cairo_boilerplate_open_any2ppm (const char *filename,
|
||||
int page,
|
||||
unsigned int flags)
|
||||
{
|
||||
char command[4096];
|
||||
#if HAS_DAEMON
|
||||
|
|
@ -747,7 +748,9 @@ POPEN:
|
|||
}
|
||||
|
||||
static cairo_bool_t
|
||||
freadn (unsigned char *buf, int len, FILE *file)
|
||||
freadn (unsigned char *buf,
|
||||
int len,
|
||||
FILE *file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -827,7 +830,8 @@ FAIL:
|
|||
}
|
||||
|
||||
cairo_surface_t *
|
||||
cairo_boilerplate_convert_to_image (const char *filename, int page)
|
||||
cairo_boilerplate_convert_to_image (const char *filename,
|
||||
int page)
|
||||
{
|
||||
FILE *file;
|
||||
unsigned int flags = 0;
|
||||
|
|
|
|||
|
|
@ -122,20 +122,20 @@ typedef cairo_surface_t *
|
|||
double height,
|
||||
double max_width,
|
||||
double max_height,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
cairo_boilerplate_mode_t mode,
|
||||
int id,
|
||||
void **closure);
|
||||
|
||||
typedef void
|
||||
(*cairo_boilerplate_force_fallbacks_t) (cairo_surface_t *surface,
|
||||
unsigned int flags);
|
||||
unsigned int flags);
|
||||
|
||||
typedef cairo_status_t
|
||||
(*cairo_boilerplate_finish_surface_t) (cairo_surface_t *surface);
|
||||
|
||||
typedef cairo_surface_t *
|
||||
(*cairo_boilerplate_get_image_surface_t) (cairo_surface_t *surface,
|
||||
int page,
|
||||
int page,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
|
|
@ -153,17 +153,17 @@ typedef struct _cairo_boilerplate_target {
|
|||
const char *name;
|
||||
const char *basename;
|
||||
const char *file_extension;
|
||||
const char *reference_target;
|
||||
const char *reference_target;
|
||||
cairo_surface_type_t expected_type;
|
||||
cairo_content_t content;
|
||||
unsigned int error_tolerance;
|
||||
const char *probe; /* runtime dl check */
|
||||
cairo_boilerplate_create_surface_t create_surface;
|
||||
cairo_boilerplate_force_fallbacks_t force_fallbacks;
|
||||
cairo_boilerplate_force_fallbacks_t force_fallbacks;
|
||||
cairo_boilerplate_finish_surface_t finish_surface;
|
||||
cairo_boilerplate_get_image_surface_t get_image_surface;
|
||||
cairo_boilerplate_write_to_png_t write_to_png;
|
||||
cairo_boilerplate_cleanup_t cleanup;
|
||||
cairo_boilerplate_cleanup_t cleanup;
|
||||
cairo_boilerplate_wait_t synchronize;
|
||||
cairo_bool_t is_measurable;
|
||||
cairo_bool_t is_vector;
|
||||
|
|
@ -174,25 +174,26 @@ const cairo_boilerplate_target_t *
|
|||
cairo_boilerplate_get_image_target (cairo_content_t content);
|
||||
|
||||
const cairo_boilerplate_target_t *
|
||||
cairo_boilerplate_get_target_by_name (const char *name,
|
||||
cairo_content_t content);
|
||||
cairo_boilerplate_get_target_by_name (const char *name,
|
||||
cairo_content_t content);
|
||||
|
||||
const cairo_boilerplate_target_t **
|
||||
cairo_boilerplate_get_targets (int *num_targets, cairo_bool_t *limited_targets);
|
||||
cairo_boilerplate_get_targets (int *num_targets,
|
||||
cairo_bool_t *limited_targets);
|
||||
|
||||
void
|
||||
cairo_boilerplate_free_targets (const cairo_boilerplate_target_t **targets);
|
||||
|
||||
cairo_surface_t *
|
||||
_cairo_boilerplate_get_image_surface (cairo_surface_t *src,
|
||||
int page,
|
||||
int width,
|
||||
int height);
|
||||
int page,
|
||||
int width,
|
||||
int height);
|
||||
cairo_surface_t *
|
||||
cairo_boilerplate_get_image_surface_from_png (const char *filename,
|
||||
int width,
|
||||
int height,
|
||||
cairo_bool_t flatten);
|
||||
cairo_boilerplate_get_image_surface_from_png (const char *filename,
|
||||
int width,
|
||||
int height,
|
||||
cairo_bool_t flatten);
|
||||
|
||||
cairo_surface_t *
|
||||
cairo_boilerplate_surface_create_in_error (cairo_status_t status);
|
||||
|
|
@ -202,14 +203,15 @@ enum {
|
|||
};
|
||||
|
||||
FILE *
|
||||
cairo_boilerplate_open_any2ppm (const char *filename,
|
||||
int page,
|
||||
unsigned int flags);
|
||||
cairo_boilerplate_open_any2ppm (const char *filename,
|
||||
int page,
|
||||
unsigned int flags);
|
||||
cairo_surface_t *
|
||||
cairo_boilerplate_image_surface_create_from_ppm_stream (FILE *file);
|
||||
|
||||
cairo_surface_t *
|
||||
cairo_boilerplate_convert_to_image (const char *filename, int page);
|
||||
cairo_boilerplate_convert_to_image (const char *filename,
|
||||
int page);
|
||||
|
||||
int
|
||||
cairo_boilerplate_version (void);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* SOFTWARE.
|
||||
*
|
||||
* Authors: Carl Worth <cworth@cworth.org>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#include "cairo-perf.h"
|
||||
|
|
@ -72,7 +72,8 @@ to_factor (double x)
|
|||
}
|
||||
|
||||
static int
|
||||
_double_cmp (const void *_a, const void *_b)
|
||||
_double_cmp (const void *_a,
|
||||
const void *_b)
|
||||
{
|
||||
const double *a = _a;
|
||||
const double *b = _b;
|
||||
|
|
@ -85,8 +86,10 @@ _double_cmp (const void *_a, const void *_b)
|
|||
}
|
||||
|
||||
static void
|
||||
trim_outliers (double *values, int num_values,
|
||||
double *min, double *max)
|
||||
trim_outliers (double *values,
|
||||
int num_values,
|
||||
double *min,
|
||||
double *max)
|
||||
{
|
||||
double q1, q3, iqr;
|
||||
double outlier_min, outlier_max;
|
||||
|
|
@ -231,7 +234,10 @@ find_ranges (struct chart *chart)
|
|||
|
||||
#define SET_COLOR(C, R, G, B) (C)->red = (R), (C)->green = (G), (C)->blue = (B)
|
||||
static void
|
||||
hsv_to_rgb (double h, double s, double v, struct color *color)
|
||||
hsv_to_rgb (double h,
|
||||
double s,
|
||||
double v,
|
||||
struct color *color)
|
||||
{
|
||||
double m, n, f;
|
||||
int i;
|
||||
|
|
@ -279,7 +285,8 @@ static void set_report_color (struct chart *chart, int report)
|
|||
}
|
||||
|
||||
static void
|
||||
test_background (struct chart *c, int test)
|
||||
test_background (struct chart *c,
|
||||
int test)
|
||||
{
|
||||
double dx, x;
|
||||
|
||||
|
|
@ -292,12 +299,15 @@ test_background (struct chart *c, int test)
|
|||
cairo_set_source_rgba (c->cr, .8, .8, .8, .2);
|
||||
|
||||
cairo_rectangle (c->cr, floor (x), 0,
|
||||
floor (dx + x) - floor (x), c->height);
|
||||
floor (dx + x) - floor (x), c->height);
|
||||
cairo_fill (c->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
add_chart (struct chart *c, int test, int report, double value)
|
||||
add_chart (struct chart *c,
|
||||
int test,
|
||||
int report,
|
||||
double value)
|
||||
{
|
||||
double dx, dy, x;
|
||||
|
||||
|
|
@ -371,7 +381,9 @@ add_chart (struct chart *c, int test, int report, double value)
|
|||
}
|
||||
|
||||
static void
|
||||
add_label (struct chart *c, int test, const char *label)
|
||||
add_label (struct chart *c,
|
||||
int test,
|
||||
const char *label)
|
||||
{
|
||||
cairo_text_extents_t extents;
|
||||
double dx, x;
|
||||
|
|
@ -585,7 +597,8 @@ add_slower_faster_guide (struct chart *c)
|
|||
}
|
||||
|
||||
static void
|
||||
cairo_perf_reports_compare (struct chart *chart, cairo_bool_t print)
|
||||
cairo_perf_reports_compare (struct chart *chart,
|
||||
cairo_bool_t print)
|
||||
{
|
||||
test_report_t **tests, *min_test;
|
||||
double test_time, best_time;
|
||||
|
|
@ -797,7 +810,8 @@ add_legend (struct chart *chart)
|
|||
}
|
||||
|
||||
int
|
||||
main (int argc, const char *argv[])
|
||||
main (int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
struct chart chart;
|
||||
|
|
@ -826,7 +840,7 @@ main (int argc, const char *argv[])
|
|||
chart.names[chart.num_reports] = argv[i] + 7;
|
||||
} else {
|
||||
cairo_perf_report_load (&chart.reports[chart.num_reports++],
|
||||
argv[i],
|
||||
argv[i],
|
||||
test_report_cmp_name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* SOFTWARE.
|
||||
*
|
||||
* Authors: Carl Worth <cworth@cworth.org>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#include "cairo-perf.h"
|
||||
|
|
@ -50,7 +50,8 @@ typedef struct _cairo_perf_diff_files_args {
|
|||
} cairo_perf_diff_files_args_t;
|
||||
|
||||
static int
|
||||
test_diff_cmp (const void *a, const void *b)
|
||||
test_diff_cmp (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const test_diff_t *a_diff = a;
|
||||
const test_diff_t *b_diff = b;
|
||||
|
|
@ -68,7 +69,9 @@ test_diff_cmp (const void *a, const void *b)
|
|||
|
||||
#define CHANGE_BAR_WIDTH 70
|
||||
static void
|
||||
print_change_bar (double change, double max_change, int use_utf)
|
||||
print_change_bar (double change,
|
||||
double max_change,
|
||||
int use_utf)
|
||||
{
|
||||
int units_per_cell = (int) ceil (max_change / CHANGE_BAR_WIDTH);
|
||||
static char const *ascii_boxes[8] = {
|
||||
|
|
@ -113,9 +116,9 @@ print_change_bar (double change, double max_change, int use_utf)
|
|||
}
|
||||
|
||||
static void
|
||||
test_diff_print (test_diff_t *diff,
|
||||
double max_change,
|
||||
cairo_perf_report_options_t *options)
|
||||
test_diff_print (test_diff_t *diff,
|
||||
double max_change,
|
||||
cairo_perf_report_options_t *options)
|
||||
{
|
||||
int i;
|
||||
double test_time;
|
||||
|
|
@ -149,9 +152,9 @@ test_diff_print (test_diff_t *diff,
|
|||
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
static void
|
||||
cairo_perf_reports_compare (cairo_perf_report_t *reports,
|
||||
int num_reports,
|
||||
cairo_perf_report_options_t *options)
|
||||
cairo_perf_reports_compare (cairo_perf_report_t *reports,
|
||||
int num_reports,
|
||||
cairo_perf_report_options_t *options)
|
||||
{
|
||||
int i;
|
||||
test_report_t **tests, *min_test;
|
||||
|
|
@ -309,9 +312,9 @@ usage (const char *argv0)
|
|||
}
|
||||
|
||||
static void
|
||||
parse_args(int argc,
|
||||
char const **argv,
|
||||
cairo_perf_diff_files_args_t *args)
|
||||
parse_args (int argc,
|
||||
char const **argv,
|
||||
cairo_perf_diff_files_args_t *args)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -346,7 +349,8 @@ parse_args(int argc,
|
|||
}
|
||||
|
||||
int
|
||||
main (int argc, const char *argv[])
|
||||
main (int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
cairo_perf_diff_files_args_t args = {
|
||||
NULL, /* filenames */
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ typedef struct _cairo_perf_diff_files_args {
|
|||
} cairo_perf_diff_files_args_t;
|
||||
|
||||
static int
|
||||
test_diff_cmp_speedup_before_slowdown (const void *a, const void *b)
|
||||
test_diff_cmp_speedup_before_slowdown (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const test_diff_t *a_diff = a;
|
||||
const test_diff_t *b_diff = b;
|
||||
|
|
@ -83,7 +84,8 @@ test_diff_cmp_speedup_before_slowdown (const void *a, const void *b)
|
|||
}
|
||||
|
||||
static int
|
||||
test_diff_cmp (const void *a, const void *b)
|
||||
test_diff_cmp (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const test_diff_t *a_diff = a;
|
||||
const test_diff_t *b_diff = b;
|
||||
|
|
@ -101,7 +103,9 @@ test_diff_cmp (const void *a, const void *b)
|
|||
|
||||
#define CHANGE_BAR_WIDTH 70
|
||||
static void
|
||||
print_change_bar (double change, double max_change, int use_utf)
|
||||
print_change_bar (double change,
|
||||
double max_change,
|
||||
int use_utf)
|
||||
{
|
||||
int units_per_cell = ceil (max_change / CHANGE_BAR_WIDTH);
|
||||
static char const *ascii_boxes[8] = {
|
||||
|
|
@ -146,9 +150,9 @@ print_change_bar (double change, double max_change, int use_utf)
|
|||
}
|
||||
|
||||
static void
|
||||
test_diff_print_binary (test_diff_t *diff,
|
||||
double max_change,
|
||||
cairo_perf_report_options_t *options)
|
||||
test_diff_print_binary (test_diff_t *diff,
|
||||
double max_change,
|
||||
cairo_perf_report_options_t *options)
|
||||
{
|
||||
printf ("%5s-%-4s %26s-%-3d %6.2f (%.2f %4.2f%%) -> %6.2f (%.2f %4.2f%%): %5.2fx ",
|
||||
diff->tests[0]->backend, diff->tests[0]->content,
|
||||
|
|
@ -172,9 +176,9 @@ test_diff_print_binary (test_diff_t *diff,
|
|||
}
|
||||
|
||||
static void
|
||||
test_diff_print_multi (test_diff_t *diff,
|
||||
double max_change,
|
||||
cairo_perf_report_options_t *options)
|
||||
test_diff_print_multi (test_diff_t *diff,
|
||||
double max_change,
|
||||
cairo_perf_report_options_t *options)
|
||||
{
|
||||
int i;
|
||||
double test_time;
|
||||
|
|
@ -205,9 +209,9 @@ test_diff_print_multi (test_diff_t *diff,
|
|||
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
static void
|
||||
cairo_perf_reports_compare (cairo_perf_report_t *reports,
|
||||
int num_reports,
|
||||
cairo_perf_report_options_t *options)
|
||||
cairo_perf_reports_compare (cairo_perf_report_t *reports,
|
||||
int num_reports,
|
||||
cairo_perf_report_options_t *options)
|
||||
{
|
||||
int i;
|
||||
test_report_t **tests, *min_test;
|
||||
|
|
@ -399,9 +403,9 @@ usage (const char *argv0)
|
|||
}
|
||||
|
||||
static void
|
||||
parse_args(int argc,
|
||||
char const **argv,
|
||||
cairo_perf_diff_files_args_t *args)
|
||||
parse_args (int argc,
|
||||
char const **argv,
|
||||
cairo_perf_diff_files_args_t *args)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -442,7 +446,8 @@ parse_args(int argc,
|
|||
}
|
||||
|
||||
int
|
||||
main (int argc, const char *argv[])
|
||||
main (int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
cairo_perf_diff_files_args_t args = {
|
||||
NULL, /* filenames */
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ cases_to_store (test_case_t *cases)
|
|||
const char *content = NULL;
|
||||
|
||||
store = gtk_tree_store_new (CASE_NCOLS,
|
||||
G_TYPE_BOOLEAN, /* shown */
|
||||
G_TYPE_BOOLEAN, /* inconsistent */
|
||||
G_TYPE_BOOLEAN, /* shown */
|
||||
G_TYPE_BOOLEAN, /* inconsistent */
|
||||
G_TYPE_STRING, /* backend */
|
||||
G_TYPE_STRING, /* content */
|
||||
G_TYPE_STRING, /* name */
|
||||
|
|
@ -82,7 +82,7 @@ cases_to_store (test_case_t *cases)
|
|||
if (backend == NULL || strcmp (backend, cases->backend)) {
|
||||
gtk_tree_store_append (store, &backend_iter, NULL);
|
||||
gtk_tree_store_set (store, &backend_iter,
|
||||
CASE_SHOWN, TRUE,
|
||||
CASE_SHOWN, TRUE,
|
||||
CASE_BACKEND, cases->backend,
|
||||
-1);
|
||||
backend = cases->backend;
|
||||
|
|
@ -91,7 +91,7 @@ cases_to_store (test_case_t *cases)
|
|||
if (content == NULL || strcmp (content, cases->content)) {
|
||||
gtk_tree_store_append (store, &content_iter, &backend_iter);
|
||||
gtk_tree_store_set (store, &content_iter,
|
||||
CASE_SHOWN, TRUE,
|
||||
CASE_SHOWN, TRUE,
|
||||
CASE_BACKEND, cases->backend,
|
||||
CASE_CONTENT, cases->content,
|
||||
-1);
|
||||
|
|
@ -130,7 +130,9 @@ struct _app_data {
|
|||
};
|
||||
|
||||
static void
|
||||
recurse_set_shown (GtkTreeModel *model, GtkTreeIter *parent, gboolean shown)
|
||||
recurse_set_shown (GtkTreeModel *model,
|
||||
GtkTreeIter *parent,
|
||||
gboolean shown)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
|
@ -143,7 +145,7 @@ recurse_set_shown (GtkTreeModel *model, GtkTreeIter *parent, gboolean shown)
|
|||
} else if (shown != c->shown) {
|
||||
c->shown = shown;
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
|
||||
CASE_SHOWN, shown,
|
||||
CASE_SHOWN, shown,
|
||||
CASE_INCONSISTENT, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
|
@ -151,7 +153,8 @@ recurse_set_shown (GtkTreeModel *model, GtkTreeIter *parent, gboolean shown)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
children_consistent (GtkTreeModel *model, GtkTreeIter *parent)
|
||||
children_consistent (GtkTreeModel *model,
|
||||
GtkTreeIter *parent)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean first = TRUE;
|
||||
|
|
@ -161,7 +164,7 @@ children_consistent (GtkTreeModel *model, GtkTreeIter *parent)
|
|||
gboolean active, inconsistent;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
CASE_INCONSISTENT, &inconsistent,
|
||||
CASE_INCONSISTENT, &inconsistent,
|
||||
CASE_SHOWN, &active,
|
||||
-1);
|
||||
if (inconsistent)
|
||||
|
|
@ -178,13 +181,14 @@ children_consistent (GtkTreeModel *model, GtkTreeIter *parent)
|
|||
}
|
||||
|
||||
static void
|
||||
check_consistent (GtkTreeModel *model, GtkTreeIter *child)
|
||||
check_consistent (GtkTreeModel *model,
|
||||
GtkTreeIter *child)
|
||||
{
|
||||
GtkTreeIter parent;
|
||||
|
||||
if (gtk_tree_model_iter_parent (model, &parent, child)) {
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &parent,
|
||||
CASE_INCONSISTENT,
|
||||
CASE_INCONSISTENT,
|
||||
! children_consistent (model, &parent),
|
||||
-1);
|
||||
check_consistent (model, &parent);
|
||||
|
|
@ -193,8 +197,8 @@ check_consistent (GtkTreeModel *model, GtkTreeIter *child)
|
|||
|
||||
static void
|
||||
show_case_toggled (GtkCellRendererToggle *cell,
|
||||
gchar *str,
|
||||
struct _app_data *app)
|
||||
gchar *str,
|
||||
struct _app_data *app)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
|
|
@ -229,7 +233,9 @@ show_case_toggled (GtkCellRendererToggle *cell,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
git_read (GIOChannel *io, GIOCondition cond, struct _app_data *app)
|
||||
git_read (GIOChannel *io,
|
||||
GIOCondition cond,
|
||||
struct _app_data *app)
|
||||
{
|
||||
int fd;
|
||||
|
||||
|
|
@ -259,7 +265,8 @@ git_read (GIOChannel *io, GIOCondition cond, struct _app_data *app)
|
|||
}
|
||||
|
||||
static void
|
||||
do_git (struct _app_data *app, char **argv)
|
||||
do_git (struct _app_data *app,
|
||||
char **argv)
|
||||
{
|
||||
gint output;
|
||||
GError *error = NULL;
|
||||
|
|
@ -294,7 +301,9 @@ do_git (struct _app_data *app, char **argv)
|
|||
}
|
||||
|
||||
static void
|
||||
gv_report_selected (GraphView *gv, int i, struct _app_data *app)
|
||||
gv_report_selected (GraphView *gv,
|
||||
int i,
|
||||
struct _app_data *app)
|
||||
{
|
||||
cairo_perf_report_t *report;
|
||||
char *hyphen;
|
||||
|
|
@ -324,9 +333,9 @@ gv_report_selected (GraphView *gv, int i, struct _app_data *app)
|
|||
}
|
||||
|
||||
static GtkWidget *
|
||||
window_create (test_case_t *cases,
|
||||
window_create (test_case_t *cases,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports)
|
||||
int num_reports)
|
||||
{
|
||||
GtkWidget *window, *table, *w;
|
||||
GtkWidget *tv, *sw;
|
||||
|
|
@ -344,7 +353,7 @@ window_create (test_case_t *cases,
|
|||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Cairo Performance Graph");
|
||||
g_object_set_data_full (G_OBJECT (window),
|
||||
"app-data", data, (GDestroyNotify)g_free);
|
||||
"app-data", data, (GDestroyNotify)g_free);
|
||||
|
||||
data->window = window;
|
||||
|
||||
|
|
@ -364,7 +373,7 @@ window_create (test_case_t *cases,
|
|||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), column);
|
||||
g_signal_connect (renderer, "toggled",
|
||||
G_CALLBACK (show_case_toggled), data);
|
||||
G_CALLBACK (show_case_toggled), data);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Backend",
|
||||
|
|
@ -400,12 +409,12 @@ window_create (test_case_t *cases,
|
|||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), tv);
|
||||
gtk_widget_show (tv);
|
||||
gtk_table_attach (GTK_TABLE (table), sw,
|
||||
0, 1, 0, 2,
|
||||
0, 1, 0, 2,
|
||||
GTK_FILL, GTK_FILL,
|
||||
4, 4);
|
||||
gtk_widget_show (sw);
|
||||
|
|
@ -414,10 +423,10 @@ window_create (test_case_t *cases,
|
|||
w = graph_view_new ();
|
||||
data->gv = w;
|
||||
g_signal_connect (w, "report-selected",
|
||||
G_CALLBACK (gv_report_selected), data);
|
||||
G_CALLBACK (gv_report_selected), data);
|
||||
graph_view_set_reports ((GraphView *)w, cases, reports, num_reports);
|
||||
gtk_table_attach (GTK_TABLE (table), w,
|
||||
1, 2, 0, 1,
|
||||
1, 2, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
|
||||
4, 4);
|
||||
gtk_widget_show (w);
|
||||
|
|
@ -427,12 +436,12 @@ window_create (test_case_t *cases,
|
|||
data->git_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), w);
|
||||
gtk_widget_show (w);
|
||||
gtk_table_attach (GTK_TABLE (table), sw,
|
||||
1, 2, 1, 2,
|
||||
1, 2, 1, 2,
|
||||
GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||
4, 4);
|
||||
gtk_widget_show (sw);
|
||||
|
|
@ -444,7 +453,8 @@ window_create (test_case_t *cases,
|
|||
}
|
||||
|
||||
static void
|
||||
name_to_color (const char *name, GdkColor *color)
|
||||
name_to_color (const char *name,
|
||||
GdkColor *color)
|
||||
{
|
||||
gint v = g_str_hash (name);
|
||||
|
||||
|
|
@ -455,7 +465,7 @@ name_to_color (const char *name, GdkColor *color)
|
|||
|
||||
static test_case_t *
|
||||
test_cases_from_reports (cairo_perf_report_t *reports,
|
||||
int num_reports)
|
||||
int num_reports)
|
||||
{
|
||||
test_case_t *cases, *c;
|
||||
test_report_t **tests;
|
||||
|
|
@ -550,7 +560,8 @@ test_cases_from_reports (cairo_perf_report_t *reports,
|
|||
return cases;
|
||||
}
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
cairo_perf_report_t *reports;
|
||||
test_case_t *cases;
|
||||
|
|
@ -571,7 +582,7 @@ main (int argc, char *argv[])
|
|||
|
||||
window = window_create (cases, reports, argc-1);
|
||||
g_signal_connect (window, "delete-event",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ static guint signals[LAST_SIGNAL];
|
|||
G_DEFINE_TYPE (GraphView, graph_view, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
draw_baseline_performance (test_case_t *cases,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports,
|
||||
cairo_t *cr,
|
||||
draw_baseline_performance (test_case_t *cases,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports,
|
||||
cairo_t *cr,
|
||||
const cairo_matrix_t *m)
|
||||
{
|
||||
test_report_t **tests;
|
||||
|
|
@ -203,7 +203,11 @@ draw_baseline_performance (test_case_t *cases,
|
|||
}
|
||||
|
||||
static void
|
||||
draw_hline (cairo_t *cr, const cairo_matrix_t *m, double y0, double xmin, double xmax)
|
||||
draw_hline (cairo_t *cr,
|
||||
const cairo_matrix_t *m,
|
||||
double y0,
|
||||
double xmin,
|
||||
double xmax)
|
||||
{
|
||||
double x, y;
|
||||
double py_offset;
|
||||
|
|
@ -222,8 +226,11 @@ draw_hline (cairo_t *cr, const cairo_matrix_t *m, double y0, double xmin, double
|
|||
}
|
||||
|
||||
static void
|
||||
draw_label (cairo_t *cr, const cairo_matrix_t *m,
|
||||
double y0, double xmin, double xmax)
|
||||
draw_label (cairo_t *cr,
|
||||
const cairo_matrix_t *m,
|
||||
double y0,
|
||||
double xmin,
|
||||
double xmax)
|
||||
{
|
||||
double x, y;
|
||||
char buf[80];
|
||||
|
|
@ -254,9 +261,12 @@ draw_label (cairo_t *cr, const cairo_matrix_t *m,
|
|||
#define ALIGN_X(v) ((v)<<0)
|
||||
#define ALIGN_Y(v) ((v)<<2)
|
||||
static void
|
||||
draw_rotated_label (cairo_t *cr, const char *text,
|
||||
double x, double y, double angle,
|
||||
int align)
|
||||
draw_rotated_label (cairo_t *cr,
|
||||
const char *text,
|
||||
double x,
|
||||
double y,
|
||||
double angle,
|
||||
int align)
|
||||
{
|
||||
cairo_text_extents_t extents;
|
||||
|
||||
|
|
@ -320,7 +330,8 @@ draw_rotated_label (cairo_t *cr, const char *text,
|
|||
|
||||
#define PAD 36
|
||||
static void
|
||||
graph_view_draw (GraphView *self, cairo_t *cr)
|
||||
graph_view_draw (GraphView *self,
|
||||
cairo_t *cr)
|
||||
{
|
||||
cairo_matrix_t m;
|
||||
const double dash[2] = {4, 4};
|
||||
|
|
@ -413,7 +424,7 @@ graph_view_draw (GraphView *self, cairo_t *cr)
|
|||
} cairo_restore (cr);
|
||||
|
||||
draw_baseline_performance (self->cases,
|
||||
self->reports, self->num_reports,
|
||||
self->reports, self->num_reports,
|
||||
cr, &m);
|
||||
|
||||
cairo_save (cr); {
|
||||
|
|
@ -425,7 +436,8 @@ graph_view_draw (GraphView *self, cairo_t *cr)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
graph_view_expose (GtkWidget *w, GdkEventExpose *ev)
|
||||
graph_view_expose (GtkWidget *w,
|
||||
GdkEventExpose *ev)
|
||||
{
|
||||
GraphView *self = (GraphView *) w;
|
||||
cairo_t *cr;
|
||||
|
|
@ -442,7 +454,8 @@ graph_view_expose (GtkWidget *w, GdkEventExpose *ev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
graph_view_button_press (GtkWidget *w, GdkEventButton *ev)
|
||||
graph_view_button_press (GtkWidget *w,
|
||||
GdkEventButton *ev)
|
||||
{
|
||||
GraphView *self = (GraphView *) w;
|
||||
cairo_matrix_t m;
|
||||
|
|
@ -473,7 +486,8 @@ graph_view_button_press (GtkWidget *w, GdkEventButton *ev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
graph_view_button_release (GtkWidget *w, GdkEventButton *ev)
|
||||
graph_view_button_release (GtkWidget *w,
|
||||
GdkEventButton *ev)
|
||||
{
|
||||
GraphView *self = (GraphView *) w;
|
||||
|
||||
|
|
@ -496,9 +510,9 @@ graph_view_realize (GtkWidget *widget)
|
|||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.event_mask = gtk_widget_get_events (widget) |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_EXPOSURE_MASK;
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_EXPOSURE_MASK;
|
||||
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes,
|
||||
|
|
@ -531,7 +545,7 @@ graph_view_class_init (GraphViewClass *klass)
|
|||
|
||||
signals[REPORT_SELECTED] =
|
||||
g_signal_new ("report-selected",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,//G_STRUCT_OFFSET (GraphView, report_selected),
|
||||
NULL, NULL,
|
||||
|
|
@ -576,10 +590,10 @@ graph_view_update_visible (GraphView *gv)
|
|||
}
|
||||
|
||||
void
|
||||
graph_view_set_reports (GraphView *gv,
|
||||
test_case_t *cases,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports)
|
||||
graph_view_set_reports (GraphView *gv,
|
||||
test_case_t *cases,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports)
|
||||
{
|
||||
/* XXX ownership? */
|
||||
gv->cases = cases;
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ GtkWidget *
|
|||
graph_view_new (void);
|
||||
|
||||
void
|
||||
graph_view_set_reports (GraphView *gv,
|
||||
test_case_t *tests,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports);
|
||||
graph_view_set_reports (GraphView *gv,
|
||||
test_case_t *tests,
|
||||
cairo_perf_report_t *reports,
|
||||
int num_reports);
|
||||
|
||||
void
|
||||
graph_view_update_visible (GraphView *gv);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE 1 /* for sched_getaffinity() */
|
||||
|
|
@ -50,8 +50,8 @@
|
|||
|
||||
#define CAIRO_PERF_ITERATIONS_DEFAULT 100
|
||||
#define CAIRO_PERF_LOW_STD_DEV 0.03
|
||||
#define CAIRO_PERF_STABLE_STD_DEV_COUNT 5
|
||||
#define CAIRO_PERF_ITERATION_MS_DEFAULT 2000
|
||||
#define CAIRO_PERF_STABLE_STD_DEV_COUNT 5
|
||||
#define CAIRO_PERF_ITERATION_MS_DEFAULT 2000
|
||||
#define CAIRO_PERF_ITERATION_MS_FAST 5
|
||||
|
||||
typedef struct _cairo_perf_case {
|
||||
|
|
@ -63,7 +63,8 @@ typedef struct _cairo_perf_case {
|
|||
const cairo_perf_case_t perf_cases[];
|
||||
|
||||
static const char *
|
||||
_content_to_string (cairo_content_t content, cairo_bool_t similar)
|
||||
_content_to_string (cairo_content_t content,
|
||||
cairo_bool_t similar)
|
||||
{
|
||||
switch (content|similar) {
|
||||
case CAIRO_CONTENT_COLOR:
|
||||
|
|
@ -100,9 +101,9 @@ cairo_perf_has_similar (cairo_perf_t *perf)
|
|||
}
|
||||
|
||||
cairo_bool_t
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_bool_t *is_explicit)
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_bool_t *is_explicit)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -124,8 +125,8 @@ cairo_perf_can_run (cairo_perf_t *perf,
|
|||
}
|
||||
|
||||
static unsigned
|
||||
cairo_perf_calibrate (cairo_perf_t *perf,
|
||||
cairo_perf_func_t perf_func)
|
||||
cairo_perf_calibrate (cairo_perf_t *perf,
|
||||
cairo_perf_func_t perf_func)
|
||||
{
|
||||
cairo_perf_ticks_t calibration0, calibration;
|
||||
unsigned loops, min_loops;
|
||||
|
|
@ -162,10 +163,10 @@ cairo_perf_calibrate (cairo_perf_t *perf,
|
|||
}
|
||||
|
||||
void
|
||||
cairo_perf_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_perf_func_t perf_func,
|
||||
cairo_count_func_t count_func)
|
||||
cairo_perf_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_perf_func_t perf_func,
|
||||
cairo_count_func_t count_func)
|
||||
{
|
||||
static cairo_bool_t first_run = TRUE;
|
||||
unsigned int i, similar, has_similar;
|
||||
|
|
@ -231,7 +232,7 @@ cairo_perf_run (cairo_perf_t *perf,
|
|||
cairo_perf_yield ();
|
||||
if (similar)
|
||||
cairo_push_group_with_content (perf->cr,
|
||||
cairo_boilerplate_content (perf->target->content));
|
||||
cairo_boilerplate_content (perf->target->content));
|
||||
perf_func (perf->cr, perf->size, perf->size, 1);
|
||||
loops = cairo_perf_calibrate (perf, perf_func);
|
||||
if (similar)
|
||||
|
|
@ -242,7 +243,7 @@ cairo_perf_run (cairo_perf_t *perf,
|
|||
cairo_perf_yield ();
|
||||
if (similar)
|
||||
cairo_push_group_with_content (perf->cr,
|
||||
cairo_boilerplate_content (perf->target->content));
|
||||
cairo_boilerplate_content (perf->target->content));
|
||||
times[i] = perf_func (perf->cr, perf->size, perf->size, loops) / loops;
|
||||
if (similar)
|
||||
cairo_pattern_destroy (cairo_pop_group (perf->cr));
|
||||
|
|
@ -320,7 +321,9 @@ usage (const char *argv0)
|
|||
}
|
||||
|
||||
static void
|
||||
parse_options (cairo_perf_t *perf, int argc, char *argv[])
|
||||
parse_options (cairo_perf_t *perf,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int c;
|
||||
const char *iters;
|
||||
|
|
@ -395,7 +398,7 @@ parse_options (cairo_perf_t *perf, int argc, char *argv[])
|
|||
}
|
||||
|
||||
static int
|
||||
check_cpu_affinity(void)
|
||||
check_cpu_affinity (void)
|
||||
{
|
||||
#ifdef HAVE_SCHED_GETAFFINITY
|
||||
|
||||
|
|
@ -403,27 +406,27 @@ check_cpu_affinity(void)
|
|||
int i, cpu_count;
|
||||
|
||||
if (sched_getaffinity(0, sizeof(affinity), &affinity)) {
|
||||
perror("sched_getaffinity");
|
||||
return -1;
|
||||
perror("sched_getaffinity");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(i = 0, cpu_count = 0; i < CPU_SETSIZE; ++i) {
|
||||
if (CPU_ISSET(i, &affinity))
|
||||
++cpu_count;
|
||||
if (CPU_ISSET(i, &affinity))
|
||||
++cpu_count;
|
||||
}
|
||||
|
||||
if (cpu_count > 1) {
|
||||
fputs(
|
||||
"WARNING: cairo-perf has not been bound to a single CPU.\n",
|
||||
stderr);
|
||||
return -1;
|
||||
fputs(
|
||||
"WARNING: cairo-perf has not been bound to a single CPU.\n",
|
||||
stderr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
fputs(
|
||||
"WARNING: Cannot check CPU affinity for this platform.\n",
|
||||
stderr);
|
||||
"WARNING: Cannot check CPU affinity for this platform.\n",
|
||||
stderr);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -443,7 +446,8 @@ cairo_perf_fini (cairo_perf_t *perf)
|
|||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int i, j;
|
||||
cairo_perf_t perf;
|
||||
|
|
@ -452,23 +456,23 @@ main (int argc, char *argv[])
|
|||
parse_options (&perf, argc, argv);
|
||||
|
||||
if (check_cpu_affinity()) {
|
||||
fputs(
|
||||
"NOTICE: cairo-perf and the X server should be bound to CPUs (either the same\n"
|
||||
"or separate) on SMP systems. Not doing so causes random results when the X\n"
|
||||
"server is moved to or from cairo-perf's CPU during the benchmarks:\n"
|
||||
"\n"
|
||||
" $ sudo taskset -cp 0 $(pidof X)\n"
|
||||
" $ taskset -cp 1 $$\n"
|
||||
"\n"
|
||||
"See taskset(1) for information about changing CPU affinity.\n",
|
||||
stderr);
|
||||
fputs(
|
||||
"NOTICE: cairo-perf and the X server should be bound to CPUs (either the same\n"
|
||||
"or separate) on SMP systems. Not doing so causes random results when the X\n"
|
||||
"server is moved to or from cairo-perf's CPU during the benchmarks:\n"
|
||||
"\n"
|
||||
" $ sudo taskset -cp 0 $(pidof X)\n"
|
||||
" $ taskset -cp 1 $$\n"
|
||||
"\n"
|
||||
"See taskset(1) for information about changing CPU affinity.\n",
|
||||
stderr);
|
||||
}
|
||||
|
||||
perf.targets = cairo_boilerplate_get_targets (&perf.num_targets, NULL);
|
||||
perf.times = xmalloc (perf.iterations * sizeof (cairo_perf_ticks_t));
|
||||
|
||||
for (i = 0; i < perf.num_targets; i++) {
|
||||
const cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
const cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
|
||||
if (! target->is_measurable)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Peter Weilbacher <mozilla@weilbacher.org>
|
||||
* Vladimir Vukicevic <vladimir@pobox.com> (win32/linux code)
|
||||
* Carl Worth <cworth@cworth.org> (win32/linux code)
|
||||
* Vladimir Vukicevic <vladimir@pobox.com> (win32/linux code)
|
||||
* Carl Worth <cworth@cworth.org> (win32/linux code)
|
||||
*/
|
||||
|
||||
#define INCL_BASE
|
||||
|
|
@ -46,7 +46,7 @@ static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
|
|||
static void *cairo_perf_timer_synchronize_closure = NULL;
|
||||
void
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure)
|
||||
void *closure)
|
||||
{
|
||||
cairo_perf_timer_synchronize = synchronize;
|
||||
cairo_perf_timer_synchronize_closure = closure;
|
||||
|
|
@ -57,7 +57,7 @@ cairo_perf_timer_start (void) {
|
|||
QWORD time;
|
||||
|
||||
if (cairo_perf_timer_synchronize)
|
||||
cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
|
||||
cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
|
||||
DosTmrQueryTime(&time);
|
||||
timer.start = (time.ulHi*4294967296.0 + time.ulLo);
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ cairo_perf_timer_stop (void) {
|
|||
QWORD time;
|
||||
|
||||
if (cairo_perf_timer_synchronize)
|
||||
cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
|
||||
cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
|
||||
DosTmrQueryTime(&time);
|
||||
timer.stop = (time.ulHi*4294967296.0 + time.ulLo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
/* Portions of this file come from liboil:
|
||||
|
|
@ -91,18 +91,18 @@ oil_profile_stamp_rdtsc (void)
|
|||
|
||||
#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
|
||||
static inline cairo_perf_ticks_t
|
||||
oil_profile_stamp_tb(void)
|
||||
oil_profile_stamp_tb (void)
|
||||
{
|
||||
uint32_t junk;
|
||||
uint64_t ts;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"1: mftbu %1;"
|
||||
" mftb %0+1;"
|
||||
" mftbu %0;"
|
||||
" cmpw %0,%1;"
|
||||
" bne 1b" :
|
||||
"=r" (ts), "=r" (junk));
|
||||
"1: mftbu %1;"
|
||||
" mftb %0+1;"
|
||||
" mftbu %0;"
|
||||
" cmpw %0,%1;"
|
||||
" bne 1b" :
|
||||
"=r" (ts), "=r" (junk));
|
||||
|
||||
return ts;
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ oil_profile_stamp_tb(void)
|
|||
|
||||
#if defined(__alpha__)
|
||||
static inline cairo_perf_ticks_t
|
||||
oil_profile_stamp_alpha(void)
|
||||
oil_profile_stamp_alpha (void)
|
||||
{
|
||||
unsigned int ts;
|
||||
__asm__ __volatile__ ("rpcc %0\n" : "=r"(ts));
|
||||
|
|
@ -122,7 +122,7 @@ oil_profile_stamp_alpha(void)
|
|||
|
||||
#if defined(__s390__)
|
||||
static cairo_perf_ticks_t
|
||||
oil_profile_stamp_s390(void)
|
||||
oil_profile_stamp_s390 (void)
|
||||
{
|
||||
uint64_t ts;
|
||||
__asm__ __volatile__ ("STCK %0\n" : : "m" (ts));
|
||||
|
|
@ -157,8 +157,8 @@ static cairo_perf_timer_t timer;
|
|||
static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
|
||||
static void *cairo_perf_timer_synchronize_closure = NULL;
|
||||
void
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure)
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure)
|
||||
{
|
||||
cairo_perf_timer_synchronize = synchronize;
|
||||
cairo_perf_timer_synchronize_closure = closure;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* SOFTWARE.
|
||||
*
|
||||
* Authors: Carl Worth <cworth@cworth.org>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#include "cairo-perf.h"
|
||||
|
|
@ -57,7 +57,8 @@ report_print (const cairo_perf_report_t *report)
|
|||
}
|
||||
|
||||
int
|
||||
main (int argc, const char *argv[])
|
||||
main (int argc,
|
||||
const char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,18 +51,23 @@ typedef ptrdiff_t ssize_t;
|
|||
|
||||
#if !defined (__USE_GNU) && !defined(__USE_XOPEN2K8)
|
||||
static ssize_t
|
||||
getline (char **lineptr, size_t *n, FILE *stream);
|
||||
getline (char **lineptr,
|
||||
size_t *n,
|
||||
FILE *stream);
|
||||
|
||||
static char *
|
||||
strndup (const char *s, size_t n);
|
||||
strndup (const char *s,
|
||||
size_t n);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
static long long
|
||||
strtoll(const char *nptr, char **endptr, int base);
|
||||
strtoll (const char *nptr,
|
||||
char **endptr,
|
||||
int base);
|
||||
|
||||
static char *
|
||||
basename(char *path);
|
||||
basename (char *path);
|
||||
#endif
|
||||
|
||||
/* Ad-hoc parsing, macros with a strong dependence on the calling
|
||||
|
|
@ -87,7 +92,7 @@ do { \
|
|||
parse_error("expected integer but found %s", s); \
|
||||
} \
|
||||
} while (0)
|
||||
#define parse_long_long(result) \
|
||||
#define parse_long_long(result) \
|
||||
do { \
|
||||
(result) = strtoll (s, &end, 10); \
|
||||
if (*s && end != s) { \
|
||||
|
|
@ -120,7 +125,9 @@ do { \
|
|||
} while (0)
|
||||
|
||||
static test_report_status_t
|
||||
test_report_parse (test_report_t *report, char *line, char *configuration)
|
||||
test_report_parse (test_report_t *report,
|
||||
char *line,
|
||||
char *configuration)
|
||||
{
|
||||
char *end;
|
||||
char *s = line;
|
||||
|
|
@ -230,23 +237,25 @@ test_report_parse (test_report_t *report, char *line, char *configuration)
|
|||
#if !defined (__USE_GNU) && !defined(__USE_XOPEN2K8)
|
||||
#define POORMANS_GETLINE_BUFFER_SIZE (65536)
|
||||
static ssize_t
|
||||
getline (char **lineptr, size_t *n, FILE *stream)
|
||||
getline (char **lineptr,
|
||||
size_t *n,
|
||||
FILE *stream)
|
||||
{
|
||||
if (!*lineptr)
|
||||
{
|
||||
*n = POORMANS_GETLINE_BUFFER_SIZE;
|
||||
*lineptr = (char *) malloc (*n);
|
||||
*n = POORMANS_GETLINE_BUFFER_SIZE;
|
||||
*lineptr = (char *) malloc (*n);
|
||||
}
|
||||
|
||||
if (!fgets (*lineptr, *n, stream))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
if (!feof (stream) && !strchr (*lineptr, '\n'))
|
||||
{
|
||||
fprintf (stderr, "The poor man's implementation of getline in "
|
||||
__FILE__ " needs a bigger buffer. Perhaps it's "
|
||||
"time for a complete implementation of getline.\n");
|
||||
exit (0);
|
||||
fprintf (stderr, "The poor man's implementation of getline in "
|
||||
__FILE__ " needs a bigger buffer. Perhaps it's "
|
||||
"time for a complete implementation of getline.\n");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
return strlen (*lineptr);
|
||||
|
|
@ -254,21 +263,22 @@ getline (char **lineptr, size_t *n, FILE *stream)
|
|||
#undef POORMANS_GETLINE_BUFFER_SIZE
|
||||
|
||||
static char *
|
||||
strndup (const char *s, size_t n)
|
||||
strndup (const char *s,
|
||||
size_t n)
|
||||
{
|
||||
size_t len;
|
||||
char *sdup;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
len = strlen (s);
|
||||
len = (n < len ? n : len);
|
||||
sdup = (char *) malloc (len + 1);
|
||||
if (sdup)
|
||||
{
|
||||
memcpy (sdup, s, len);
|
||||
sdup[len] = '\0';
|
||||
memcpy (sdup, s, len);
|
||||
sdup[len] = '\0';
|
||||
}
|
||||
|
||||
return sdup;
|
||||
|
|
@ -281,13 +291,15 @@ strndup (const char *s, size_t n)
|
|||
*/
|
||||
#ifdef _MSC_VER
|
||||
long long
|
||||
strtoll(const char *nptr, char **endptr, int base)
|
||||
strtoll (const char *nptr,
|
||||
char **endptr,
|
||||
int base)
|
||||
{
|
||||
return _atoi64(nptr);
|
||||
}
|
||||
|
||||
static char *
|
||||
basename(char *path)
|
||||
basename (char *path)
|
||||
{
|
||||
char *end, *s;
|
||||
|
||||
|
|
@ -311,7 +323,8 @@ basename(char *path)
|
|||
#endif /* ifndef _MSC_VER */
|
||||
|
||||
int
|
||||
test_report_cmp_backend_then_name (const void *a, const void *b)
|
||||
test_report_cmp_backend_then_name (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const test_report_t *a_test = a;
|
||||
const test_report_t *b_test = b;
|
||||
|
|
@ -348,7 +361,8 @@ test_report_cmp_backend_then_name (const void *a, const void *b)
|
|||
}
|
||||
|
||||
int
|
||||
test_report_cmp_name (const void *a, const void *b)
|
||||
test_report_cmp_name (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const test_report_t *a_test = a;
|
||||
const test_report_t *b_test = b;
|
||||
|
|
@ -378,7 +392,7 @@ test_report_cmp_name (const void *a, const void *b)
|
|||
|
||||
void
|
||||
cairo_perf_report_sort_and_compute_stats (cairo_perf_report_t *report,
|
||||
int (*cmp) (const void*, const void*))
|
||||
int (*cmp) (const void*, const void*))
|
||||
{
|
||||
test_report_t *base, *next, *last, *t;
|
||||
|
||||
|
|
@ -426,7 +440,7 @@ cairo_perf_report_sort_and_compute_stats (cairo_perf_report_t *report,
|
|||
|
||||
void
|
||||
cairo_perf_report_load (cairo_perf_report_t *report,
|
||||
const char *filename,
|
||||
const char *filename,
|
||||
int (*cmp) (const void *, const void *))
|
||||
{
|
||||
FILE *file;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE 1 /* for sched_getaffinity() and getline() */
|
||||
|
|
@ -66,12 +66,12 @@
|
|||
#define CAIRO_PERF_ITERATIONS_DEFAULT 15
|
||||
#define CAIRO_PERF_LOW_STD_DEV 0.05
|
||||
#define CAIRO_PERF_MIN_STD_DEV_COUNT 3
|
||||
#define CAIRO_PERF_STABLE_STD_DEV_COUNT 3
|
||||
#define CAIRO_PERF_STABLE_STD_DEV_COUNT 3
|
||||
|
||||
cairo_bool_t
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_bool_t *is_explicit)
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_bool_t *is_explicit)
|
||||
{
|
||||
unsigned int i;
|
||||
char *copy, *dot;
|
||||
|
|
@ -147,7 +147,8 @@ static cairo_hash_table_t *surface_cache;
|
|||
static cairo_surface_t *surface_holdovers[16];
|
||||
|
||||
static cairo_bool_t
|
||||
scache_equal (const void *A, const void *B)
|
||||
scache_equal (const void *A,
|
||||
const void *B)
|
||||
{
|
||||
const struct scache *a = A, *b = B;
|
||||
return a->entry.hash == b->entry.hash;
|
||||
|
|
@ -200,10 +201,11 @@ scache_remove (void *closure)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_similar_surface_create (void *closure,
|
||||
cairo_content_t content,
|
||||
double width, double height,
|
||||
long uid)
|
||||
_similar_surface_create (void *closure,
|
||||
cairo_content_t content,
|
||||
double width,
|
||||
double height,
|
||||
long uid)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
struct scache skey, *s;
|
||||
|
|
@ -250,7 +252,7 @@ _similar_surface_create (void *closure,
|
|||
}
|
||||
|
||||
static cairo_t *
|
||||
_context_create (void *closure,
|
||||
_context_create (void *closure,
|
||||
cairo_surface_t *surface)
|
||||
{
|
||||
scache_mark_active (surface);
|
||||
|
|
@ -271,9 +273,9 @@ interrupt (int sig)
|
|||
}
|
||||
|
||||
static void
|
||||
execute (cairo_perf_t *perf,
|
||||
cairo_surface_t *target,
|
||||
const char *trace)
|
||||
execute (cairo_perf_t *perf,
|
||||
cairo_surface_t *target,
|
||||
const char *trace)
|
||||
{
|
||||
static cairo_bool_t first_run = TRUE;
|
||||
unsigned int i;
|
||||
|
|
@ -452,23 +454,25 @@ usage (const char *argv0)
|
|||
#ifndef __USE_GNU
|
||||
#define POORMANS_GETLINE_BUFFER_SIZE (65536)
|
||||
static ssize_t
|
||||
getline (char **lineptr, size_t *n, FILE *stream)
|
||||
getline (char **lineptr,
|
||||
size_t *n,
|
||||
FILE *stream)
|
||||
{
|
||||
if (!*lineptr)
|
||||
{
|
||||
*n = POORMANS_GETLINE_BUFFER_SIZE;
|
||||
*lineptr = (char *) malloc (*n);
|
||||
*n = POORMANS_GETLINE_BUFFER_SIZE;
|
||||
*lineptr = (char *) malloc (*n);
|
||||
}
|
||||
|
||||
if (!fgets (*lineptr, *n, stream))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
if (!feof (stream) && !strchr (*lineptr, '\n'))
|
||||
{
|
||||
fprintf (stderr, "The poor man's implementation of getline in "
|
||||
__FILE__ " needs a bigger buffer. Perhaps it's "
|
||||
"time for a complete implementation of getline.\n");
|
||||
exit (0);
|
||||
fprintf (stderr, "The poor man's implementation of getline in "
|
||||
__FILE__ " needs a bigger buffer. Perhaps it's "
|
||||
"time for a complete implementation of getline.\n");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
return strlen (*lineptr);
|
||||
|
|
@ -476,21 +480,22 @@ getline (char **lineptr, size_t *n, FILE *stream)
|
|||
#undef POORMANS_GETLINE_BUFFER_SIZE
|
||||
|
||||
static char *
|
||||
strndup (const char *s, size_t n)
|
||||
strndup (const char *s,
|
||||
size_t n)
|
||||
{
|
||||
size_t len;
|
||||
char *sdup;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
len = strlen (s);
|
||||
len = (n < len ? n : len);
|
||||
sdup = (char *) malloc (len + 1);
|
||||
if (sdup)
|
||||
{
|
||||
memcpy (sdup, s, len);
|
||||
sdup[len] = '\0';
|
||||
memcpy (sdup, s, len);
|
||||
sdup[len] = '\0';
|
||||
}
|
||||
|
||||
return sdup;
|
||||
|
|
@ -498,7 +503,8 @@ strndup (const char *s, size_t n)
|
|||
#endif /* ifndef __USE_GNU */
|
||||
|
||||
static cairo_bool_t
|
||||
read_excludes (cairo_perf_t *perf, const char *filename)
|
||||
read_excludes (cairo_perf_t *perf,
|
||||
const char *filename)
|
||||
{
|
||||
FILE *file;
|
||||
char *line = NULL;
|
||||
|
|
@ -541,7 +547,9 @@ read_excludes (cairo_perf_t *perf, const char *filename)
|
|||
}
|
||||
|
||||
static void
|
||||
parse_options (cairo_perf_t *perf, int argc, char *argv[])
|
||||
parse_options (cairo_perf_t *perf,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int c;
|
||||
const char *iters;
|
||||
|
|
@ -655,9 +663,9 @@ have_trace_filenames (cairo_perf_t *perf)
|
|||
}
|
||||
|
||||
static void
|
||||
cairo_perf_trace (cairo_perf_t *perf,
|
||||
cairo_perf_trace (cairo_perf_t *perf,
|
||||
const cairo_boilerplate_target_t *target,
|
||||
const char *trace)
|
||||
const char *trace)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
void *closure;
|
||||
|
|
@ -692,7 +700,8 @@ cairo_perf_trace (cairo_perf_t *perf,
|
|||
}
|
||||
|
||||
static void
|
||||
warn_no_traces (const char *message, const char *trace_dir)
|
||||
warn_no_traces (const char *message,
|
||||
const char *trace_dir)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Error: %s '%s'.\n"
|
||||
|
|
@ -704,9 +713,9 @@ warn_no_traces (const char *message, const char *trace_dir)
|
|||
}
|
||||
|
||||
static int
|
||||
cairo_perf_trace_dir (cairo_perf_t *perf,
|
||||
cairo_perf_trace_dir (cairo_perf_t *perf,
|
||||
const cairo_boilerplate_target_t *target,
|
||||
const char *dirname)
|
||||
const char *dirname)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
|
|
@ -760,7 +769,8 @@ next:
|
|||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
cairo_perf_t perf;
|
||||
const char *trace_dir = "cairo-traces:/usr/src/cairo-traces:/usr/share/cairo-traces";
|
||||
|
|
@ -781,7 +791,7 @@ main (int argc, char *argv[])
|
|||
perf.exact_names = have_trace_filenames (&perf);
|
||||
|
||||
for (i = 0; i < perf.num_targets; i++) {
|
||||
const cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
const cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
|
||||
if (! perf.list_only && ! target->is_measurable)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#define USE_WINAPI
|
||||
|
|
@ -45,8 +45,8 @@ static cairo_perf_timer_t timer;
|
|||
static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
|
||||
static void *cairo_perf_timer_synchronize_closure = NULL;
|
||||
void
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure)
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure)
|
||||
{
|
||||
cairo_perf_timer_synchronize = synchronize;
|
||||
cairo_perf_timer_synchronize_closure = closure;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors: Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#ifndef _CAIRO_PERF_H_
|
||||
|
|
@ -53,8 +53,8 @@ typedef void
|
|||
(*cairo_perf_timer_synchronize_t) (void *closure);
|
||||
|
||||
void
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure);
|
||||
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
||||
void *closure);
|
||||
|
||||
cairo_perf_ticks_t
|
||||
cairo_perf_timer_elapsed (void);
|
||||
|
|
@ -103,21 +103,21 @@ typedef double
|
|||
(*cairo_count_func_t) (cairo_t *cr, int width, int height);
|
||||
|
||||
cairo_bool_t
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_bool_t *is_explicit);
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_bool_t *is_explicit);
|
||||
|
||||
void
|
||||
cairo_perf_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_perf_func_t perf_func,
|
||||
cairo_count_func_t count_func);
|
||||
cairo_perf_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_perf_func_t perf_func,
|
||||
cairo_count_func_t count_func);
|
||||
|
||||
void
|
||||
cairo_perf_cover_sources_and_operators (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_perf_func_t perf_func,
|
||||
cairo_count_func_t count_func);
|
||||
cairo_perf_cover_sources_and_operators (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
cairo_perf_func_t perf_func,
|
||||
cairo_count_func_t count_func);
|
||||
|
||||
/* reporter convenience routines */
|
||||
|
||||
|
|
@ -164,18 +164,20 @@ typedef enum {
|
|||
|
||||
void
|
||||
cairo_perf_report_load (cairo_perf_report_t *report,
|
||||
const char *filename,
|
||||
const char *filename,
|
||||
int (*cmp) (const void *, const void *));
|
||||
|
||||
void
|
||||
cairo_perf_report_sort_and_compute_stats (cairo_perf_report_t *report,
|
||||
int (*cmp) (const void *, const void *));
|
||||
int (*cmp) (const void *, const void *));
|
||||
|
||||
int
|
||||
test_report_cmp_backend_then_name (const void *a, const void *b);
|
||||
test_report_cmp_backend_then_name (const void *a,
|
||||
const void *b);
|
||||
|
||||
int
|
||||
test_report_cmp_name (const void *a, const void *b);
|
||||
test_report_cmp_name (const void *a,
|
||||
const void *b);
|
||||
|
||||
#define CAIRO_PERF_DECL(func) void (func) (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
#include "cairo-stats.h"
|
||||
|
||||
static int
|
||||
_cairo_perf_ticks_cmp (const void *_a, const void *_b)
|
||||
_cairo_perf_ticks_cmp (const void *_a,
|
||||
const void *_b)
|
||||
{
|
||||
const cairo_perf_ticks_t *a = _a;
|
||||
const cairo_perf_ticks_t *b = _b;
|
||||
|
|
@ -39,9 +40,9 @@ _cairo_perf_ticks_cmp (const void *_a, const void *_b)
|
|||
}
|
||||
|
||||
void
|
||||
_cairo_stats_compute (cairo_stats_t *stats,
|
||||
cairo_perf_ticks_t *values,
|
||||
int num_values)
|
||||
_cairo_stats_compute (cairo_stats_t *stats,
|
||||
cairo_perf_ticks_t *values,
|
||||
int num_values)
|
||||
{
|
||||
int i;
|
||||
double sum, mean, delta, q1, q3, iqr;
|
||||
|
|
@ -61,7 +62,7 @@ _cairo_stats_compute (cairo_stats_t *stats,
|
|||
qsort (values, num_values,
|
||||
sizeof (cairo_perf_ticks_t), _cairo_perf_ticks_cmp);
|
||||
|
||||
q1 = values[(1*num_values)/4];
|
||||
q1 = values[(1*num_values)/4];
|
||||
q3 = values[(3*num_values)/4];
|
||||
|
||||
iqr = q3 - q1;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
#include "cairo-perf.h"
|
||||
|
||||
void
|
||||
_cairo_stats_compute (cairo_stats_t *stats,
|
||||
cairo_perf_ticks_t *values,
|
||||
int num_values);
|
||||
_cairo_stats_compute (cairo_stats_t *stats,
|
||||
cairo_perf_ticks_t *values,
|
||||
int num_values);
|
||||
|
||||
#endif /* _CAIRO_STATS_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue