mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
svg2png: fixing the args interpretation (#760)
The background color was misinterpreted and its value was treated as an svg file name (warning was returned). The color format can not be passed in a `#ffffff` format, since the '#' sign is used in bash to comment a line and nothiing after it is loaded.
This commit is contained in:
parent
c6becf4ec6
commit
a1480bedb1
1 changed files with 10 additions and 11 deletions
|
@ -177,7 +177,7 @@ public:
|
|||
const char* p = argv[i];
|
||||
if (*p == '-') {
|
||||
//flags
|
||||
const char* p_arg = (i + 1 < argc) ? argv[i] : nullptr;
|
||||
const char* p_arg = (i + 1 < argc) ? argv[++i] : nullptr;
|
||||
if (p[1] == 'r') {
|
||||
//image resolution
|
||||
if (!p_arg) {
|
||||
|
@ -198,12 +198,11 @@ public:
|
|||
} else if (p[1] == 'b') {
|
||||
//image background color
|
||||
if (!p_arg) {
|
||||
cout << "Error: Missing background color attribute. Expected eg. -b #fa7410." << endl;
|
||||
cout << "Error: Missing background color attribute. Expected eg. -b fa7410." << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*p_arg == '#') ++p_arg;
|
||||
bgColor = (uint32_t) strtol(p, NULL, 16);
|
||||
bgColor = (uint32_t) strtol(p_arg, NULL, 16);
|
||||
|
||||
} else {
|
||||
cout << "Warning: Unknown flag (" << p << ")." << endl;
|
||||
|
|
Loading…
Add table
Reference in a new issue