* Changed the generate_boot_screen build tool to take placement parameters
for the logo and the icons separately. * Image data output uses full line width. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24766 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -133,7 +133,7 @@ writeHeader(const char* baseName, int width, int height, png_bytep* rowPtrs)
|
||||
if (x == width * 3 - 1 && y == height - 1) {
|
||||
fprintf(sOutput, "0x%02x\n};\n\n", row[x]);
|
||||
break;
|
||||
} else if ((offset % 8) == 0)
|
||||
} else if ((offset % 12) == 0)
|
||||
fprintf(sOutput, "0x%02x,\n\t", row[x]);
|
||||
else
|
||||
fprintf(sOutput, "0x%02x, ", row[x]);
|
||||
@@ -164,24 +164,54 @@ parseImage(const char* filename, const char* baseName)
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
if (argc < 4) {
|
||||
if (argc < 8) {
|
||||
printf("Usage:\n");
|
||||
printf("\t%s <splash.png> <icons.png> <images.h>\n",
|
||||
printf("\t%s <splash.png> <x placement in %%> <y placement in %%> "
|
||||
"<icons.png> <x placement in %%> <y placement in %%> <images.h>\n",
|
||||
argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* headerFileName = argv[3];
|
||||
int logoPlacementX = atoi(argv[2]);
|
||||
int logoPlacementY = atoi(argv[3]);
|
||||
int iconPlacementX = atoi(argv[5]);
|
||||
int iconPlacementY = atoi(argv[6]);
|
||||
if (logoPlacementX < 0 || logoPlacementX > 100) {
|
||||
printf("Bad X placement for logo: %d%%\n", logoPlacementX);
|
||||
return 1;
|
||||
}
|
||||
if (logoPlacementY < 0 || logoPlacementY > 100) {
|
||||
printf("Bad Y placement for logo: %d%%\n\n", logoPlacementY);
|
||||
return 1;
|
||||
}
|
||||
if (iconPlacementX < 0 || iconPlacementX > 100) {
|
||||
printf("Bad X placement for icons: %d%%\n", iconPlacementX);
|
||||
return 1;
|
||||
}
|
||||
if (iconPlacementY < 0 || iconPlacementY > 100) {
|
||||
printf("Bad Y placement for icons: %d%%\n", iconPlacementY);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* headerFileName = argv[7];
|
||||
sOutput = fopen(headerFileName, "wb");
|
||||
if (!sOutput)
|
||||
error("Could not open file \"%s\" for writing", headerFileName);
|
||||
|
||||
fputs("// This file was generated by the generate_boot_screen build tool."
|
||||
"\n\n", sOutput);
|
||||
fputs("// This file was generated by the generate_boot_screen Haiku build "
|
||||
"tool.\n\n", sOutput);
|
||||
|
||||
fprintf(sOutput, "static const int32 kLogoPlacementX = %d;\n",
|
||||
logoPlacementX);
|
||||
fprintf(sOutput, "static const int32 kLogoPlacementY = %d;\n",
|
||||
logoPlacementY);
|
||||
fprintf(sOutput, "static const int32 kIconPlacementX = %d;\n",
|
||||
iconPlacementX);
|
||||
fprintf(sOutput, "static const int32 kIconPlacementY = %d;\n\n",
|
||||
iconPlacementY);
|
||||
|
||||
parseImage(argv[1], "kSplashLogo");
|
||||
parseImage(argv[2], "kSplashIcons");
|
||||
parseImage(argv[4], "kSplashIcons");
|
||||
|
||||
fclose(sOutput);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user