当前位置: 首页>>代码示例>>C++>>正文


C++ cairo_perf_timer_elapsed函数代码示例

本文整理汇总了C++中cairo_perf_timer_elapsed函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_perf_timer_elapsed函数的具体用法?C++ cairo_perf_timer_elapsed怎么用?C++ cairo_perf_timer_elapsed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cairo_perf_timer_elapsed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_composite_checker

static cairo_perf_ticks_t
do_composite_checker (cairo_t *cr,
                      int      width,
                      int      height)
{
    /* Compute zoom so that the src_pattern covers the whole output image. */
    double xscale = width / (double) SRC_SIZE;
    double yscale = height / (double) SRC_SIZE;

    cairo_perf_timer_start ();

    cairo_identity_matrix (cr);

    /* Fill the surface with our background. */
    cairo_set_source (cr, checkerboard);
    cairo_paint (cr);

    /* Draw the scaled image on top. */
    cairo_scale (cr, xscale, yscale);
    cairo_set_source (cr, src_pattern);
    cairo_paint (cr);

    cairo_perf_timer_stop ();
    return cairo_perf_timer_elapsed ();
}
开发者ID:AliYousuf,项目名称:cairo,代码行数:25,代码来源:composite-checker.c

示例2: do_curve_fill

static cairo_time_t
do_curve_fill (cairo_t *cr, int width, int height, int loops)
{
    state = 0xc0ffee;
    cairo_perf_timer_start ();

    while (loops--) {
	double x0 = uniform_random (0, width);
	double x1 = uniform_random (0, width);
	double x2 = uniform_random (0, width);
	double x3 = uniform_random (0, width);
	double xm = uniform_random (0, width);
	double xn = uniform_random (0, width);
	double y0 = uniform_random (0, height);
	double y1 = uniform_random (0, height);
	double y2 = uniform_random (0, height);
	double y3 = uniform_random (0, height);
	double ym = uniform_random (0, height);
	double yn = uniform_random (0, height);

	cairo_move_to (cr, xm, ym);
	cairo_curve_to (cr, x1, y1, x2, y2, xn, yn);
	cairo_curve_to (cr, x3, y3, x0, y0, xm, ym);
	cairo_close_path (cr);

	cairo_fill(cr);
    }

    cairo_perf_timer_stop ();

    return cairo_perf_timer_elapsed ();
}
开发者ID:AZed,项目名称:cairo,代码行数:32,代码来源:a1-curve.c

示例3: do_stroke

static cairo_time_t
do_stroke (cairo_t *cr, int width, int height, int loops)
{
    cairo_arc (cr,
	       width/2.0, height/2.0,
	       width/3.0,
	       0, 2 * M_PI);
    cairo_close_path (cr);

    cairo_set_line_width (cr, width/5.0);

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);
	cairo_stroke_preserve (cr);
    }

    cairo_perf_timer_stop ();

    cairo_new_path (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:26,代码来源:stroke.c

示例4: do_long_dashed_lines

static cairo_perf_ticks_t
do_long_dashed_lines (cairo_t *cr, int width, int height, int loops)
{
    double dash[2] = { 2.0, 2.0 };
    int i;

    cairo_save (cr);
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
    cairo_paint (cr);

    cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
    cairo_set_dash (cr, dash, 2, 0.0);

    cairo_new_path (cr);
    cairo_set_line_width (cr, 1.0);

    for (i = 0; i < height-1; i++) {
	double y0 = (double) i + 0.5;
	cairo_move_to (cr, 0.0, y0);
	cairo_line_to (cr, width, y0);
    }

    cairo_perf_timer_start ();

    while (loops--)
	cairo_stroke_preserve (cr);

    cairo_perf_timer_stop ();

    cairo_restore (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:jaglass,项目名称:WinCairoRequirements,代码行数:33,代码来源:long-dashed-lines.c

示例5: do_text

static cairo_time_t
do_text (cairo_t *cr, int width, int height, int loops)
{
    const char text[] = "the jay, pig, fox, zebra and my wolves quack";
    int len = strlen (text);
    double x, y;
    int i = 0, j = 0;

    cairo_set_font_size (cr, 9);

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);
	do {
	    cairo_move_to (cr, 0, j++ * 10);
	    cairo_show_text (cr, text + i);
	    cairo_get_current_point (cr, &x, &y);
	    while (x < width && cairo_status (cr) == CAIRO_STATUS_SUCCESS) {
		cairo_show_text (cr, text);
		cairo_get_current_point (cr, &x, &y);
	    }
	    if (++i >= len)
		i = 0;
	} while (y < height && cairo_status (cr) == CAIRO_STATUS_SUCCESS);
    }

    cairo_perf_timer_stop ();

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:33,代码来源:text.c

示例6: box_outline_aa_stroke

static cairo_time_t
box_outline_aa_stroke (cairo_t *cr, int width, int height, int loops)
{
    cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
    cairo_paint (cr);

    cairo_translate (cr, .5, .5);
    cairo_rectangle (cr,
		     1.5, 1.5,
		     width - 3, height - 3);
    cairo_set_line_width (cr, 1.0);
    cairo_set_source_rgb (cr, 1, 0, 0); /* red */

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
	    cairo_perf_set_thread_aware (cr, TRUE);
	cairo_stroke_preserve (cr);
    }

    cairo_perf_timer_stop ();

    cairo_new_path (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:28,代码来源:box-outline.c

示例7: box_outline_fill

static cairo_perf_ticks_t
box_outline_fill (cairo_t *cr, int width, int height, int loops)
{
    cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
    cairo_paint (cr);

    cairo_rectangle (cr,
		     1.0, 1.0,
		     width - 2, height - 2);
    cairo_rectangle (cr,
		     2.0, 2.0,
		     width - 4, height - 4);
    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
    cairo_set_source_rgb (cr, 0, 1, 0); /* green */

    cairo_perf_timer_start ();

    while (loops--)
	cairo_fill_preserve (cr);

    cairo_perf_timer_stop ();

    cairo_new_path (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:jaglass,项目名称:WinCairoRequirements,代码行数:26,代码来源:box-outline.c

示例8: draw

static cairo_time_t
draw (cairo_t *cr, int width, int height, int loops)
{
    int t_height = height/2;
    int t_width = t_height / m_1_sqrt_3;

    cairo_set_source_rgb (cr, 1, 1, 1);
    cairo_paint (cr);

    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_set_line_width (cr, 1.);

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);
	cairo_save (cr);
	T (cr, t_width);

	cairo_translate (cr, 0, height);
	cairo_scale (cr, 1, -1);

	T (cr, t_width);

	cairo_stroke (cr);
	cairo_restore (cr);
    }

    cairo_perf_timer_stop ();

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:34,代码来源:sierpinski.c

示例9: box_outline_aa_fill

static cairo_time_t
box_outline_aa_fill (cairo_t *cr, int width, int height, int loops)
{
    cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
    cairo_paint (cr);

    cairo_translate (cr, .5, .5);
    cairo_rectangle (cr,
		     1.0, 1.0,
		     width - 2, height - 2);
    cairo_rectangle (cr,
		     2.0, 2.0,
		     width - 4, height - 4);
    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
    cairo_set_source_rgb (cr, 0, 1, 0); /* green */

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
	    cairo_perf_set_thread_aware (cr, TRUE);
	cairo_fill_preserve (cr);
    }

    cairo_perf_timer_stop ();

    cairo_new_path (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:31,代码来源:box-outline.c

示例10: do_curve_stroke

static cairo_time_t
do_curve_stroke (cairo_t *cr, int width, int height, int loops)
{
    state = 0xc0ffee;
    cairo_set_line_width (cr, 2.);
    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);
	double x1 = uniform_random (0, width);
	double x2 = uniform_random (0, width);
	double x3 = uniform_random (0, width);
	double y1 = uniform_random (0, height);
	double y2 = uniform_random (0, height);
	double y3 = uniform_random (0, height);
	cairo_move_to (cr, uniform_random (0, width), uniform_random (0, height));
	cairo_curve_to (cr, x1, y1, x2, y2, x3, y3);
	cairo_stroke(cr);
    }

    cairo_perf_timer_stop ();

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:26,代码来源:curve.c

示例11: do_unaligned_clip

static cairo_time_t
do_unaligned_clip (cairo_t *cr, int width, int height, int loops)
{
    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);
	cairo_save (cr);

	/* First a triangular clip that obviously isn't along device-pixel
	 * boundaries. */
	cairo_move_to (cr, 50, 50);
	cairo_line_to (cr, 50, 90);
	cairo_line_to (cr, 90, 90);
	cairo_close_path (cr);
	cairo_clip (cr);

	/* Then a rectangular clip that would be but for the non-integer
	 * scaling. */
	cairo_scale (cr, 1.1, 1.1);
	cairo_rectangle (cr, 55, 55, 35, 35);
	cairo_clip (cr);

	/* And paint something to force the clip to be evaluated. */
	cairo_paint (cr);

	cairo_restore (cr);
    }

    cairo_perf_timer_stop ();

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:35,代码来源:unaligned-clip.c

示例12: do_pattern_create_radial

static cairo_time_t
do_pattern_create_radial (cairo_t *cr, int width, int height, int loops)
{
    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	cairo_pattern_t *pattern;
	int i;

	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);

	for (i = 0; i < RADIALS_COUNT; i++) {
	    pattern =
		cairo_pattern_create_radial (radials[i].cx0, radials[i].cy0,
					     radials[i].radius0,
					     radials[i].cx1, radials[i].cy1,
					     radials[i].radius1);
	    cairo_pattern_destroy (pattern);
	}
    }

    cairo_perf_timer_stop ();

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:27,代码来源:pattern_create_radial.c

示例13: do_wide_fills

static cairo_time_t
do_wide_fills (cairo_t *cr, int width, int height, int loops)
{
    int count;

    /* lots and lots of overlapping stroke-like fills */
    state = 0xc0ffee;
    for (count = 0; count < 1000; count++) {
	cairo_save (cr);
	cairo_translate (cr,
			 uniform_random (0, width),
			 uniform_random (0, height));
	cairo_rotate (cr, uniform_random (-M_PI,M_PI));
	cairo_rectangle (cr, 0, 0, uniform_random (0, width), 5);
	cairo_restore (cr);
    }

    cairo_perf_timer_start ();

    while (loops--)
	cairo_fill_preserve (cr);

    cairo_perf_timer_stop ();

    cairo_new_path (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:AZed,项目名称:cairo,代码行数:28,代码来源:wide-fills.c

示例14: do_strokes

static cairo_time_t
do_strokes (cairo_t *cr, int width, int height, int loops)
{
    /* a pair of overlapping rectangles */
    rounded_rectangle (cr,
		       2, 2, width/2. + 10, height/2. + 10,
		       10);
    rounded_rectangle (cr,
		       width/2. - 10, height/2. - 10,
		       width/2. - 2, height/2. - 2,
		       10);

    cairo_set_line_width (cr, 2.);

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);

    while (loops--) {
	if (loops == 0)
		cairo_perf_set_thread_aware (cr, TRUE);
	cairo_stroke_preserve (cr);
    }

    cairo_perf_timer_stop ();

    cairo_new_path (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:29,代码来源:stroke.c

示例15: draw_spiral_stroke

static cairo_time_t
draw_spiral_stroke (cairo_t *cr,
		    align_t align,
		    int width, int height, int loops)
{
    const int step = 3;
    int side = width < height ? width : height;

    cairo_save (cr);
    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_paint (cr);

    cairo_translate (cr, 1, 1);
    cairo_set_source_rgb (cr, 1, 0, 0);
    cairo_set_line_width (cr, 4.);
    cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
    cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);

    cairo_new_path (cr);
    switch (align) {
    case PIXALIGN: cairo_move_to (cr, 0,0); break;
    case NONALIGN: cairo_move_to (cr, 0.1415926, 0.7182818); break;
    }
    while (side >= step) {
	cairo_rel_line_to (cr, 0, side);
        side -= step;
	if (side <= 0)
	    break;

	cairo_rel_line_to (cr, side, 0);
        side -= step;
	if (side <= 0)
	    break;

	cairo_rel_line_to (cr, 0, -side);
        side -= step;
	if (side <= 0)
	    break;

	cairo_rel_line_to (cr, -side, 0);
        side -= step;
	if (side <= 0)
	    break;
    }

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);
    while (loops--) {
	if (loops == 0)
	    cairo_perf_set_thread_aware (cr, TRUE);
        cairo_stroke_preserve (cr);
    }

    cairo_perf_timer_stop ();

    cairo_restore (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:59,代码来源:spiral.c


注:本文中的cairo_perf_timer_elapsed函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。