Commit e989af81 authored by benwells@chromium.org's avatar benwells@chromium.org

Fix a couple of minor bugs with build/sanitize-png-files.sh

The bugs fixed are:
- programs required for -o2 weren't checked for when using -o2
but were checked for lower -o levels.
- if no savings could be found the results printed at the end
were confusing and the script had a divide by zero error.

BUG=None

Review URL: https://chromiumcodereview.appspot.com/15970004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203051 0039d316-1c4b-4281-b951-d872f2087c98
parent 88a91ee3
......@@ -374,7 +374,7 @@ done
# Make sure we have all necessary commands installed.
install_if_not_installed pngcrush
if [ $OPTIMIZE_LEVEL != 2 ]; then
if [ $OPTIMIZE_LEVEL == 2 ]; then
install_if_not_installed optipng
install_if_not_installed advancecomp
......@@ -401,10 +401,15 @@ for d in $DIRS; do
done
# Print the results.
let diff=$TOTAL_OLD_BYTES-$TOTAL_NEW_BYTES
let percent=$diff*100/$TOTAL_OLD_BYTES
echo "Processed $PROCESSED_FILE files (out of $TOTAL_FILE files)" \
"in $(date -u -d @$SECONDS +%T)s"
echo "Result : $TOTAL_OLD_BYTES => $TOTAL_NEW_BYTES bytes" \
"($diff bytes : $percent %)"
if [ $PROCESSED_FILE == 0 ]; then
echo "Did not find any files (out of $TOTAL_FILE files)" \
"that could be optimized" \
"in $(date -u -d @$SECONDS +%T)s"
else
let diff=$TOTAL_OLD_BYTES-$TOTAL_NEW_BYTES
let percent=$diff*100/$TOTAL_OLD_BYTES
echo "Processed $PROCESSED_FILE files (out of $TOTAL_FILE files)" \
"in $(date -u -d @$SECONDS +%T)s"
echo "Result : $TOTAL_OLD_BYTES => $TOTAL_NEW_BYTES bytes" \
"($diff bytes : $percent %)"
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment