diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Tests/FindGTK2/cairo | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Tests/FindGTK2/cairo')
-rw-r--r-- | Tests/FindGTK2/cairo/main.c | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/Tests/FindGTK2/cairo/main.c b/Tests/FindGTK2/cairo/main.c index 1b61001..e2be60c 100644 --- a/Tests/FindGTK2/cairo/main.c +++ b/Tests/FindGTK2/cairo/main.c @@ -1,52 +1,50 @@ /* Taken from http://cairographics.org/samples/ */ - #include <cairo.h> #include <math.h> #include <stdio.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - char *filename; - if (argc != 2) - { - fprintf (stderr, "Usage: %s OUTPUT_FILENAME\n", argv[0]); - return 1; - } - filename = argv[1]; - double xc = 128.0; - double yc = 128.0; - double radius = 100.0; - double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */ - double angle2 = 180.0 * (M_PI/180.0); /* in radians */ - - cairo_surface_t *im = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xc * 2, yc * 2); - cairo_t *cr = cairo_create(im); - - - cairo_set_line_width (cr, 10.0); - cairo_arc (cr, xc, yc, radius, angle1, angle2); - cairo_stroke (cr); - - /* draw helping lines */ - cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6); - cairo_set_line_width (cr, 6.0); - - cairo_arc (cr, xc, yc, 10.0, 0, 2*M_PI); - cairo_fill (cr); - - cairo_arc (cr, xc, yc, radius, angle1, angle1); - cairo_line_to (cr, xc, yc); - cairo_arc (cr, xc, yc, radius, angle2, angle2); - cairo_line_to (cr, xc, yc); - cairo_stroke (cr); - - cairo_status_t status = cairo_surface_write_to_png (im, filename); - cairo_surface_destroy (im); - if (status != CAIRO_STATUS_SUCCESS) { - fprintf(stderr, "Could not save png to '%s'\n", filename); - } - - cairo_destroy(cr); - return 0; + char* filename; + if (argc != 2) { + fprintf(stderr, "Usage: %s OUTPUT_FILENAME\n", argv[0]); + return 1; + } + filename = argv[1]; + double xc = 128.0; + double yc = 128.0; + double radius = 100.0; + double angle1 = 45.0 * (M_PI / 180.0); /* angles are specified */ + double angle2 = 180.0 * (M_PI / 180.0); /* in radians */ + + cairo_surface_t* im = + cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xc * 2, yc * 2); + cairo_t* cr = cairo_create(im); + + cairo_set_line_width(cr, 10.0); + cairo_arc(cr, xc, yc, radius, angle1, angle2); + cairo_stroke(cr); + + /* draw helping lines */ + cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.6); + cairo_set_line_width(cr, 6.0); + + cairo_arc(cr, xc, yc, 10.0, 0, 2 * M_PI); + cairo_fill(cr); + + cairo_arc(cr, xc, yc, radius, angle1, angle1); + cairo_line_to(cr, xc, yc); + cairo_arc(cr, xc, yc, radius, angle2, angle2); + cairo_line_to(cr, xc, yc); + cairo_stroke(cr); + + cairo_status_t status = cairo_surface_write_to_png(im, filename); + cairo_surface_destroy(im); + if (status != CAIRO_STATUS_SUCCESS) { + fprintf(stderr, "Could not save png to '%s'\n", filename); + } + + cairo_destroy(cr); + return 0; } |