add support for the possible viewport colour tags (%Vf and %Vb). use -c to disable them

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26408 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-05-30 11:54:52 +00:00
parent e5ab34bb19
commit 68f4d91825

View file

@ -33,6 +33,7 @@ int image_count = 0;
/** Command line setting **/
bool is_mono_display = false;
bool use_new_vp_tags = true;
@ -62,6 +63,41 @@ int dump_arg(FILE* out, const char* start, int count, bool close)
return l;
}
int dump_viewport_tags(FILE* out, const char* start)
{
int len = 0;
if (is_mono_display)
{
return dump_arg(out, start, 5, true);
}
else
{
int arg_count = use_new_vp_tags?5:7;
len += dump_arg(out, start, arg_count, true);
if (!use_new_vp_tags)
return len;
if (start[len] != '-')
{
fprintf(out, "%%Vf(");
len += dump_arg(out, start+len, 1, true);
}
else
{
while (start[len++] != '|');
}
if (start[len] != '-')
{
fprintf(out, "%%Vb(");
len += dump_arg(out, start+len, 1, true);
}
else
{
while (start[len++] != '|');
}
}
return len;
}
#define MATCH(s) (!strcmp(tag->name, s))
int parse_tag(FILE* out, const char* start, bool in_conditional)
{
@ -170,13 +206,16 @@ int parse_tag(FILE* out, const char* start, bool in_conditional)
}
else if (MATCH("Vl") || MATCH("Vi"))
{
int read;
PUTCH(out, '(');
len += 1+dump_arg(out, start+1, is_mono_display?6:8, true);
read = 1+dump_arg(out, start+1, 1, false);
PUTCH(out, ',');
len += read + dump_viewport_tags(out, start+read);
}
else if (MATCH("V"))
{
PUTCH(out, '(');
len += 1+dump_arg(out, start+1, is_mono_display?5:7, true);
len += 1+dump_viewport_tags(out, start+1);
}
else if (MATCH("X"))
{
@ -277,6 +316,7 @@ int main(int argc, char* argv[])
{
printf("Usage: %s [OPTIONS] infile [outfile]\n", argv[0]);
printf("\nOPTIONS:\n");
printf("\t-c\tDon't use new viewport colour tags (non-mono displays only)\n");
printf("\t-m\tSkin is for a mono display (different viewport tags)\n");
return 0;
}
@ -288,6 +328,9 @@ int main(int argc, char* argv[])
{
switch(argv[filearg][i])
{
case 'c': /* disable new colour tags */
use_new_vp_tags = false;
break;
case 'm': /* skin is for a mono display */
is_mono_display = true;
break;