Upload Tizen2.0 source
[framework/graphics/cairo.git] / TC / perf / common.c
1 /*
2  * Cairo Performance Test Framework
3  * (c) 2012 Samsung Electronics, Inc.
4  * All rights reserved.
5  *
6  * Measures rendering performance for image, gl backends
7  *
8  * This software is a confidential and proprietary information of Samsung
9  * Electronics, Inc. ("Confidential Information"). You shall not disclose such
10  * Confidential Information and shall use it only in accordance with the terms
11  * of the license agreement you entered into with Samsung Electronics.
12  *
13  * Author: Dongyeon Kim <dy5.kim@samsung.com>
14  */
15
16 #include "common.h"
17
18 void clearCairo(cairo_t *cr, double width, double height)
19 {
20     cairo_set_source_rgba(cr, 1, 1, 1, 1);
21     cairo_rectangle(cr, 0.0, 0.0, width, height);
22     cairo_fill(cr);
23 }
24
25 void cairoSquare(cairo_t *cr, double x, double y, double length)
26 {
27     cairo_rectangle(cr, x, y, length, length);
28     cairo_fill(cr);
29 }
30
31 void cairoSquareStroke(cairo_t *cr, double x, double y, double length)
32 {
33     cairo_rectangle(cr, x, y, length, length);
34     cairo_stroke(cr);
35 }
36
37 void cairoCircle(cairo_t *cr, double x, double y, double radius)
38 {
39     cairo_arc(cr, x, y, radius, 0.0, 2.0 * M_PI);
40     cairo_fill(cr);
41 }
42
43 void cairoCircleStroke(cairo_t *cr, double x, double y, double radius)
44 {
45     cairo_arc(cr, x, y, radius, 0.0, 2.0 * M_PI);
46     cairo_stroke(cr);
47 }
48
49 void cairoTriangle(cairo_t *cr, double x, double y, double side)
50 {
51     cairo_move_to(cr, x, y);
52     cairo_line_to(cr, x + side, y + side);
53     cairo_line_to(cr, x, y + side);
54     cairo_close_path(cr);
55     cairo_fill(cr);
56 }
57
58 void cairoTriangleStroke(cairo_t *cr, double x, double y, double side)
59 {
60     cairo_move_to(cr, x, y);
61     cairo_line_to(cr, x + side, y);
62     cairo_line_to(cr, x, y + side);
63     cairo_close_path(cr);
64     cairo_stroke(cr);
65 }