blob: 98be46b60fe27759f0a61e3b74103bfd50051b8c [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
Dan Pasanen46973d72017-01-19 14:01:59 -060025for part_cnt in 0 1 2 3 4
Dan Pasanen24a1cc92016-12-28 22:59:21 -060026do
27 mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt
28done
Scott Warnerdb8d7af2017-01-27 06:54:59 -050029tar xfp "vendor/cm/bootanimation/bootanimation.tar" --to-command="convert - -resize '$RESOLUTION' -colors 250 \"png8:$OUT/bootanimation/\$TAR_FILENAME\""
Dan Pasanen24a1cc92016-12-28 22:59:21 -060030
31# Create desc.txt
Asher Simonds070053c2017-01-16 21:52:24 -060032echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$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" .