summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-tests/text.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-04-18 13:42:17 -0700
committerBryce Harrington <b.harrington@samsung.com>2014-04-18 13:42:17 -0700
commit2e9ea4a08a75dcc352621250dd1938e062362a7f (patch)
treeea703a4edf7b2f53f3d27cc5e4102cf278d6f6c8 /src/cairo-tests/text.cpp
parent078954202f4a79a2853e740ae37fe68e88727a45 (diff)
Cleanup whitespace in tests
Diffstat (limited to 'src/cairo-tests/text.cpp')
-rw-r--r--src/cairo-tests/text.cpp130
1 files changed, 63 insertions, 67 deletions
diff --git a/src/cairo-tests/text.cpp b/src/cairo-tests/text.cpp
index 92f02c0..c35909f 100644
--- a/src/cairo-tests/text.cpp
+++ b/src/cairo-tests/text.cpp
@@ -4,11 +4,12 @@
#include <stdlib.h>
#include <cairo.h>
#include <unistd.h>
+
#include "caskbench.h"
static int max_dim;
-
static char rand_text_array[19][100];
+
void gen_random(char *s, const int len) {
static const char alphanum[] =
"ABCD EFG HIJKL MNOPQ RSTUVW XYZ";
@@ -19,14 +20,15 @@ void gen_random(char *s, const int len) {
s[len] = 0;
}
+
int
ca_setup_text(caskbench_context_t *ctx)
{
max_dim = MIN (ctx->canvas_width, ctx->canvas_height)/2;
- for(int i = 0;i<19;i++)
- {
- gen_random (rand_text_array[i],i+18);
- }
+ for(int i = 0;i<19;i++)
+ {
+ gen_random (rand_text_array[i],i+18);
+ }
return 1;
}
@@ -35,11 +37,9 @@ ca_teardown_text(void)
{
}
-
int
ca_test_text(caskbench_context_t *ctx)
{
-
cairo_t *cr = ctx->cairo_cr;
for (int i = 0; i < ctx->size; i++)
@@ -51,75 +51,71 @@ ca_test_text(caskbench_context_t *ctx)
cairo_rectangle (cr, 0, 0, ctx->canvas_width ,ctx->canvas_height);
cairo_fill (cr);
+ for(font_size = 18; font_size <= 36; font_size++)
+ {
+ cairo_set_font_size (cr, font_size);
+ randomize_color (cr);
- for(font_size = 18; font_size <= 36; font_size++)
- {
- cairo_set_font_size (cr, font_size);
- randomize_color (cr);
-
- cairo_status_t status;
- cairo_scaled_font_t *font;
- font = cairo_get_scaled_font (cr);
- cairo_glyph_t *glyphs = NULL;
- int num_glyphs;
- cairo_text_cluster_t *clusters = NULL;
- int num_clusters;
- cairo_text_cluster_flags_t cluster_flags;
-
- char text[(int)font_size];
- gen_random (text,font_size);
-
- status = cairo_scaled_font_text_to_glyphs (font,
- xpos, ypos,
- text, font_size,
- &glyphs, &num_glyphs,
- &clusters, &num_clusters, &cluster_flags);
+ cairo_status_t status;
+ cairo_scaled_font_t *font;
+ font = cairo_get_scaled_font (cr);
+ cairo_glyph_t *glyphs = NULL;
+ int num_glyphs;
+ cairo_text_cluster_t *clusters = NULL;
+ int num_clusters;
+ cairo_text_cluster_flags_t cluster_flags;
- if (status == CAIRO_STATUS_SUCCESS) {
- cairo_show_text_glyphs (cr,
- rand_text_array[(int)font_size-18],font_size,
- glyphs, num_glyphs,
- clusters, num_clusters, cluster_flags);
- }
- ypos += (font_size/2);
- }
+ char text[(int)font_size];
+ gen_random (text,font_size);
- for(font_size = 36; font_size >= 18; font_size--)
- {
+ status = cairo_scaled_font_text_to_glyphs (font,
+ xpos, ypos,
+ text, font_size,
+ &glyphs, &num_glyphs,
+ &clusters, &num_clusters, &cluster_flags);
- cairo_set_font_size (cr, font_size);
+ if (status == CAIRO_STATUS_SUCCESS) {
+ cairo_show_text_glyphs (cr,
+ rand_text_array[(int)font_size-18],font_size,
+ glyphs, num_glyphs,
+ clusters, num_clusters, cluster_flags);
+ }
+ ypos += (font_size/2);
+ }
- randomize_color (cr);
+ for(font_size = 36; font_size >= 18; font_size--)
+ {
+ cairo_set_font_size (cr, font_size);
- cairo_status_t status;
- cairo_scaled_font_t *font;
- font = cairo_get_scaled_font (cr);
- cairo_glyph_t *glyphs = NULL;
- int num_glyphs;
- cairo_text_cluster_t *clusters = NULL;
- int num_clusters;
- cairo_text_cluster_flags_t cluster_flags;
+ randomize_color (cr);
+ cairo_status_t status;
+ cairo_scaled_font_t *font;
+ font = cairo_get_scaled_font (cr);
+ cairo_glyph_t *glyphs = NULL;
+ int num_glyphs;
+ cairo_text_cluster_t *clusters = NULL;
+ int num_clusters;
+ cairo_text_cluster_flags_t cluster_flags;
- char text[(int)font_size];
- gen_random (text,font_size);
+ char text[(int)font_size];
+ gen_random (text,font_size);
- status = cairo_scaled_font_text_to_glyphs (font,
- xpos, ypos,
- text, font_size,
- &glyphs, &num_glyphs,
- &clusters, &num_clusters, &cluster_flags);
+ status = cairo_scaled_font_text_to_glyphs (font,
+ xpos, ypos,
+ text, font_size,
+ &glyphs, &num_glyphs,
+ &clusters, &num_clusters, &cluster_flags);
- if (status == CAIRO_STATUS_SUCCESS) {
- cairo_show_text_glyphs (cr,
- rand_text_array[(int)font_size-18],font_size,
- glyphs, num_glyphs,
- clusters, num_clusters, cluster_flags);
- }
- ypos += (font_size/2);
- }
-
- }
+ if (status == CAIRO_STATUS_SUCCESS) {
+ cairo_show_text_glyphs (cr,
+ rand_text_array[(int)font_size-18],font_size,
+ glyphs, num_glyphs,
+ clusters, num_clusters, cluster_flags);
+ }
+ ypos += (font_size/2);
+ }
+ }
- return 1;
+ return 1;
}