blob: 5a30c39dd098954c2531263b415988b602d78a37 [file] [log] [blame]
Dan Pasanen24a1cc92016-12-28 22:59:21 -06001#!/bin/bash
2
3WIDTH="$1"
4HEIGHT="$2"
5HALF_RES="$3"
6OUT="$ANDROID_PRODUCT_OUT/obj/BOOTANIMATION"
7
8if [ "$HEIGHT" -lt "$WIDTH" ]; then
Asher Simondse035b9a2017-01-16 21:52:24 -06009 IMAGEWIDTH="$HEIGHT"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060010else
Asher Simondse035b9a2017-01-16 21:52:24 -060011 IMAGEWIDTH="$WIDTH"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060012fi
13
Asher Simondse035b9a2017-01-16 21:52:24 -060014IMAGESCALEWIDTH="$IMAGEWIDTH"
15IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
16
Dan Pasanen24a1cc92016-12-28 22:59:21 -060017if [ "$HALF_RES" = "true" ]; then
Asher Simondse035b9a2017-01-16 21:52:24 -060018 IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
Dan Pasanen24a1cc92016-12-28 22:59:21 -060019fi
20
Asher Simondse035b9a2017-01-16 21:52:24 -060021IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)
22
23RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""
Dan Pasanen24a1cc92016-12-28 22:59:21 -060024
25for part_cnt in 0 1 2
26do
27 mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt
28done
29tar xfp "vendor/cm/bootanimation/bootanimation.tar" --to-command="convert - -resize '$RESOLUTION' \"png8:$OUT/bootanimation/\$TAR_FILENAME\""
30
31# Create desc.txt
Asher Simondse035b9a2017-01-16 21:52:24 -060032echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 30 > "$OUT/bootanimation/desc.txt"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060033cat "vendor/cm/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
34
35# Create bootanimation.zip
36cd "$OUT/bootanimation"
37
38zip -qr0 "$OUT/bootanimation.zip" .