summaryrefslogtreecommitdiffstatsci
path: root/src/caskbench.cpp
diff options
context:
space:
mode:
authorsuyambulingamrm <suyambu.rm@samsung.com>2014-05-28 15:01:47 +0530
committersuyambulingamrm <suyambu.rm@samsung.com>2014-05-28 15:01:47 +0530
commit1efbd5a61f81304559f42bbfdb11fb014f8a5477 (patch)
tree953b84f26480a436dbbd0582f7b7fb7379ba00ea /src/caskbench.cpp
parentfcc5c8a0a55eb29b07451d2d69582a052e4c6b94 (diff)
Issue #49. Add command line option for canvas width and height.
Diffstat (limited to 'src/caskbench.cpp')
-rw-r--r--src/caskbench.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp
index 95079f1..94d1e81 100644
--- a/src/caskbench.cpp
+++ b/src/caskbench.cpp
@@ -72,6 +72,8 @@ typedef struct _caskbench_options {
char* tests;
unsigned int enable_output_images;
double tolerance;
+ int canvas_width;
+ int canvas_height;
} caskbench_options_t;
typedef struct _caskbench_result {
@@ -189,10 +191,10 @@ process_options(caskbench_options_t *opt, int argc, char *argv[])
{"y-position", 'Y', POPT_ARG_INT, &opt->y_position, 0,
"The Y location to draw the object",
NULL},
- {"width", 'W', POPT_ARG_INT, &opt->width, 0,
+ {"object-width", '\0', POPT_ARG_INT, &opt->width, 0,
"Width of the shape bject ",
NULL},
- {"height", 'H', POPT_ARG_INT, &opt->height, 0,
+ {"object-height", '\0', POPT_ARG_INT, &opt->height, 0,
"Height of the shape object ",
NULL},
{"fill-type", 'f', POPT_ARG_STRING, &opt->fill_type, 0,
@@ -218,7 +220,7 @@ process_options(caskbench_options_t *opt, int argc, char *argv[])
{"image-path", 'I', POPT_ARG_STRING, &opt->stock_image_path, 0,
"Path to a stock image for use in clipping, patterns, etc.",
NULL},
- {"stroke-width", 'w', POPT_ARG_INT, &opt->stroke_width, 0,
+ {"stroke-width", '\0', POPT_ARG_INT, &opt->stroke_width, 0,
"represents stroke width of the object",
NULL},
// TODO: Crashes
@@ -259,6 +261,12 @@ process_options(caskbench_options_t *opt, int argc, char *argv[])
{"tolerance", '\0', POPT_ARG_DOUBLE, &opt->tolerance, 0,
"Sets tesselation tolerance value for cairo",
NULL},
+ {"canvas_width", 'w', POPT_ARG_INT, &opt->canvas_width, 0,
+ "Width of canvas used for each test case (defaults to 800)",
+ NULL},
+ {"canvas_height", 'h', POPT_ARG_INT, &opt->canvas_height, 0,
+ "Height of canvas used for each test case (defaults to 400)",
+ NULL},
POPT_AUTOHELP
{NULL}
};
@@ -508,6 +516,11 @@ main (int argc, char *argv[])
}
context_init(&context, opt.size);
+ if(opt.canvas_width)
+ context.canvas_width = opt.canvas_width;
+ if(opt.canvas_height)
+ context.canvas_height = opt.canvas_height;
+
shape_defaults_init(&context.shape_defaults, &opt);
result_init(&result, perf_tests[c].name);
config.width = context.canvas_width;