47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 37122c75c56d08b1c07d95f1d1ef040a7d9c6564 Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Hugues Husson <phh@phh.me>
|
|
Date: Mon, 20 Dec 2021 15:01:41 -0500
|
|
Subject: [PATCH 06/11] Dynamically resize boot animation to match screen size
|
|
|
|
Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205
|
|
---
|
|
cmds/bootanimation/BootAnimation.cpp | 22 ++++++++++++++++++++++
|
|
1 file changed, 22 insertions(+)
|
|
|
|
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
|
|
index a8b6c0b70804..9c50e954cee5 100644
|
|
--- a/cmds/bootanimation/BootAnimation.cpp
|
|
+++ b/cmds/bootanimation/BootAnimation.cpp
|
|
@@ -605,6 +605,28 @@ status_t BootAnimation::readyToRun() {
|
|
mFlingerSurface = s;
|
|
mTargetInset = -1;
|
|
|
|
+ if ( mAnimation != nullptr ) {
|
|
+ SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width);
|
|
+ int origWidth = mAnimation->width;
|
|
+ if ( mAnimation->width*2 < mWidth ) {
|
|
+ SLOGE("Making animation bigger");
|
|
+ mAnimation->width *= 2;
|
|
+ mAnimation->height *= 2;
|
|
+ } else if ( mWidth < mAnimation->width ) {
|
|
+ SLOGE("Making animation smaller");
|
|
+ mAnimation->width /= 2;
|
|
+ mAnimation->height /= 2;
|
|
+ }
|
|
+ for (Animation::Part& part : mAnimation->parts) {
|
|
+ for(auto& frame: part.frames) {
|
|
+ if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) {
|
|
+ frame.trimWidth = mAnimation->width;
|
|
+ frame.trimHeight = mAnimation->height;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
// Rotate the boot animation according to the value specified in the sysprop
|
|
// ro.bootanim.set_orientation_<display_id>. Four values are supported: ORIENTATION_0,
|
|
// ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270.
|
|
--
|
|
2.41.0
|
|
|