1305 lines
57 KiB
C
Executable File
1305 lines
57 KiB
C
Executable File
/* Copyright Statement:
|
|
*
|
|
* This software/firmware and related documentation ("MediaTek Software") are
|
|
* protected under relevant copyright laws. The information contained herein is
|
|
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
|
|
* the prior written permission of MediaTek inc. and/or its licensors, any
|
|
* reproduction, modification, use or disclosure of MediaTek Software, and
|
|
* information contained herein, in whole or in part, shall be strictly
|
|
* prohibited.
|
|
*
|
|
* MediaTek Inc. (C) 2010. All rights reserved.
|
|
*
|
|
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
|
|
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
|
|
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
|
|
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
|
|
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
|
|
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
|
|
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
|
|
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
|
|
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
|
|
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
|
|
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
|
|
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
|
|
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
|
|
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
|
|
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
|
|
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
|
|
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
|
|
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
|
|
*
|
|
* The following software/firmware and/or related documentation ("MediaTek
|
|
* Software") have been modified by MediaTek Inc. All revisions are subject to
|
|
* any receiver's applicable license agreements with MediaTek Inc.
|
|
*/
|
|
|
|
#define MTK_LOG_ENABLE 1
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <cutils/klog.h>
|
|
#include <cutils/properties.h>
|
|
#include <sys/ioctl.h>
|
|
#include <linux/fb.h>
|
|
#include <fcntl.h>
|
|
#include <sys/time.h>
|
|
|
|
#include "fast_charging_common.h"
|
|
#include "show_animation_common.h"
|
|
#include "utils.h"
|
|
|
|
#ifdef SLOGD
|
|
#undef SLOGD
|
|
//#define SLOGD(x,...) do { KLOG_ERROR("libshowlogo", x); } while (0)
|
|
#define SLOGD(...) \
|
|
do \
|
|
{ \
|
|
KLOG_ERROR("libshowlogo", __VA_ARGS__); \
|
|
} while (0)
|
|
#endif
|
|
|
|
#ifdef SLOGE
|
|
#undef SLOGE
|
|
//#define SLOGE(x,...) do { KLOG_ERROR("libshowlogo", x); } while (0)
|
|
#define SLOGE(...) \
|
|
do \
|
|
{ \
|
|
KLOG_ERROR("libshowlogo", __VA_ARGS__); \
|
|
} while (0)
|
|
#endif
|
|
|
|
static int charging_low_index = 0;
|
|
static int charging_animation_index = 0;
|
|
static int charging_low_index_ext = 0;
|
|
static int charging_animation_index_ext = 0;
|
|
static int version0_charging_index = 0;
|
|
static int bits = 0;
|
|
static void *g_dec_logo_addr = NULL;
|
|
static int logo_offset = -1;
|
|
static int logo_offset_ext = -1;
|
|
|
|
#define CHECK_LOGO_BIN_OK 0
|
|
#define CHECK_LOGO_BIN_ERROR -1
|
|
|
|
extern libDrmApi libdrmApi;
|
|
extern chargingAnimationDimensionAPI chargingAnimationDimension;
|
|
struct charging_anim_ui_dimension charg_anim_ui_dimen;
|
|
//dualdisplay - start
|
|
extern libDrmApi libdrmApi_ext;
|
|
extern chargingAnimationDimensionAPI chargingAnimationDimension_ext;
|
|
struct charging_anim_ui_dimension charg_anim_ui_dimen_ext;
|
|
//dualdisplay - end
|
|
static int display_fd;
|
|
void init_charging_animation_ui_dimension();
|
|
int getValue(char *key, char *defValue);
|
|
|
|
static unsigned short *number_pic_addr;
|
|
static unsigned short *line_pic_addr;
|
|
static unsigned short *percent_pic_addr;
|
|
static unsigned short *top_animation_addr;
|
|
static int number_pic_size; //size
|
|
static int line_pic_size; // line parameter
|
|
|
|
static unsigned short *number_pic_addr_ext;
|
|
static unsigned short *line_pic_addr_ext;
|
|
static unsigned short *percent_pic_addr_ext;
|
|
static unsigned short *top_animation_addr_ext;
|
|
static int number_pic_size_ext; //size
|
|
static int line_pic_size_ext; // line parameter
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
// 2D array to store LCD info - width, height, name
|
|
int lcd_info_array[][TOTAL_LOGO_DIMENSIONS] =
|
|
{
|
|
//lower resolution
|
|
{240, 240, RES_240_240},
|
|
{320, 480, RES_320_480},
|
|
// QHD resolution
|
|
{382, 720, QHD_382_720},
|
|
// WVGA resolution
|
|
{480, 800, WVGA_480_800},
|
|
{480, 854, WVGA_480_854},
|
|
{480, 960, WVGA_480_960},
|
|
{540, 960, WVGA_540_960},
|
|
// HD resolution
|
|
{600, 1024, HD_600_1024},
|
|
{720, 1280, HD_720_1280},
|
|
{720, 1440, HD_720_1440},
|
|
{720, 1500, HD_720_1500},
|
|
{720, 1520, HD_720_1520},
|
|
{720, 1560, HD_720_1560},
|
|
{720, 1600, HD_720_1600},
|
|
{768, 1024, HD_768_1024},
|
|
{800, 1280, HD_800_1280},
|
|
{1024, 600, HD_1024_600},
|
|
{1056, 1068, HD_1056_1068},
|
|
{1280, 800, HD_1280_800},
|
|
// FHD resolution
|
|
{1080, 1920, FHD_1080_1920},
|
|
{1080, 2160, FHD_1080_2160},
|
|
{1080, 2280, FHD_1080_2280},
|
|
{1080, 2300, FHD_1080_2300},
|
|
{1080, 2340, FHD_1080_2340},
|
|
{1080, 2400, FHD_1080_2400},
|
|
{1080, 2408, FHD_1080_2408},
|
|
{1080, 2412, FHD_1080_2412},
|
|
{1080, 2460, FHD_1080_2460},
|
|
{1080, 2520, FHD_1080_2520},
|
|
{1080, 2550, FHD_1080_2550},
|
|
{1080, 2640, FHD_1080_2640},
|
|
{1200, 1920, FHD_1200_1920},
|
|
{1200, 2000, FHD_1200_2000},
|
|
{1220, 2712, FHD_1220_2712},
|
|
{1260, 2800, FHD_1260_2800},
|
|
{1440, 2560, FHD_1440_2560},
|
|
{1440, 3200, FHD_1440_3200},
|
|
{1440, 3216, FHD_1440_3216},
|
|
{1920, 1200, FHD_1920_1200},
|
|
// WQHD resolution
|
|
{2000, 2296, WQHD_2000_2296},
|
|
{2296, 2000, WQHD_2296_2000},
|
|
{2560, 1536, WQHD_2560_1536},
|
|
{2944, 1840, WQHD_2944_1840},
|
|
{3000, 1876, WQHD_3000_1876},
|
|
// End of Enum
|
|
{0, 0, TOTAL_LCD_RES}
|
|
};
|
|
// 2D array to store logo parameters as per LCD resolution
|
|
int logo_param_by_res[][TOTAL_LOGO_PARAM] =
|
|
{
|
|
//{cap_left, cap_right, num_left, num_right,
|
|
// percent_left, percent_right, top_anim_left, top_anim_right,
|
|
// bar_left, bar_top, bar_right, bar_bottom,
|
|
// num_width_fast, num_height_fast, top_margin_fast,
|
|
// cap_top, cap_bottom, num_top, num_bottom, percent_top, percent_bottom, top_anim_top, top_anim_bottom}
|
|
//lower resolution
|
|
{82, 158, 92, 108, 124, 144, 82, 158, 97, 96, 140, 184, 0, 0, 0, 62, 179, 8, 31, 8, 31, 100, 113}, //RES_240_240,
|
|
{109, 211, 126, 153, 180, 212, 109, 211, 129, 128, 190, 245, 0, 0, 0, 189, 350, 95, 131, 95, 131, 100, 118}, //RES_320_480,
|
|
// QHD resolution
|
|
{143, 239, 158, 188, 216, 250, 143, 239, 170, 292, 212, 302, 72, 128, 180, 311, 480, 212, 250, 212, 250, 100, 118}, //QHD_382_720,
|
|
// WVGA resolution
|
|
{172, 307, 178, 216, 254, 302, 172, 307, 209, 149, 271, 282, 0, 0, 0, 330, 546, 190, 244, 190, 244, 100, 124}, //WVGA_480_800,
|
|
{172, 307, 172, 210, 248, 296, 172, 307, 184, 227, 294, 437, 0, 0, 0, 357, 573, 213, 267, 213, 267, 100, 124}, //WVGA_480_854,
|
|
{172, 307, 172, 210, 248, 296, 172, 307, 184, 227, 294, 437, 0, 0, 0, 410, 626, 266, 320, 266, 320, 100, 124}, //WVGA_480_960,
|
|
{202, 337, 202, 240, 278, 326, 202, 337, 235, 179, 305, 340, 0, 0, 0, 410, 626, 266, 320, 266, 320, 100, 124}, //WVGA_540_960,
|
|
// HD resolution
|
|
{232, 367, 250, 288, 326, 374, 232, 367, 260, 190, 338, 360, 0, 0, 0, 442, 658, 300, 354, 300, 354, 100, 124}, //HD_600_1024,
|
|
{278, 441, 290, 335, 380, 437, 278, 441, 313, 238, 406, 453, 72, 128, 180, 556, 817, 386, 450, 386, 450, 100, 129}, //HD_720_1280,
|
|
{278, 441, 290, 335, 380, 437, 278, 441, 313, 238, 406, 453, 72, 128, 180, 636, 898, 465, 529, 465, 529, 100, 129}, //HD_720_1440,
|
|
{278, 441, 290, 335, 380, 437, 278, 441, 313, 238, 406, 453, 72, 128, 180, 640, 955, 450, 515, 450, 515, 100, 129}, //HD_720_1500,
|
|
{278, 441, 290, 335, 380, 437, 278, 441, 313, 238, 406, 453, 72, 128, 180, 653, 970, 460, 535, 460, 535, 100, 129}, //HD_720_1520,
|
|
{278, 441, 290, 335, 380, 437, 278, 441, 313, 238, 406, 453, 72, 128, 180, 678, 1000, 480, 575, 480, 575, 100, 129}, //HD_720_1560,
|
|
{270, 450, 290, 335, 380, 437, 270, 450, 313, 238, 406, 453, 72, 128, 180, 707, 995, 500, 615, 500, 615, 100,132}, //HD_720_1600,
|
|
{316, 451, 338, 376, 414, 462, 316, 451, 334, 243, 434, 463, 0, 0, 0, 442, 658, 300, 354, 300, 354, 100, 124}, //HD_768_1024,
|
|
{318, 481, 345, 390, 435, 492, 318, 481, 348, 238, 453, 452, 0, 0, 0, 556, 815, 385, 449, 385, 449, 100, 129}, //HD_800_1280,
|
|
{444, 579, 466, 504, 542, 590, 444, 579, 414, 186, 608, 477, 0, 0, 0, 230, 446, 90, 144, 90, 144, 100, 124}, //HD_1024_600,
|
|
{445, 601, 480, 480+45, 480+45+45, 480+45+45+57, 445, 601, 496, 430, 561, 442, 72, 128, 180, 458, 716, 304, 304+64, 304, 304+64, 690, 716}, //HD_1056_1068,
|
|
{558, 721, 585, 630, 675, 732, 558, 721, 525, 250, 755, 640, 0, 0, 0, 265, 525, 95, 159, 95, 159, 100, 129}, //HD_1280_800,
|
|
// FHD resolution
|
|
{387, 691, 395, 395+84, 395+84+84, 395+84+84+108, 387, 691, 470, 356, 610, 678, 108, 192, 240, 802, 1292, 479, 600, 479, 600, 100, 152}, //FHD_1080_1920,
|
|
{387, 691, 395, 395+84, 395+84+84, 395+84+84+108, 387, 691, 470, 356, 610, 678, 108, 192, 240, 922, 1413, 599, 720, 599, 720, 100, 152}, //FHD_1080_2160,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 992, 1473, 659, 780, 659, 780, 100, 147}, //FHD_1080_2280,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1014, 1434, 737, 737+64, 737, 737+64, 100, 147}, //FHD_1080_2300,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1012, 1503, 689, 810, 689, 810, 100, 147}, //FHD_1080_2340,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1062, 1483, 729, 840, 729, 840, 100, 147}, //FHD_1080_2400,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1069, 1487, 749, 749+64, 749, 749+64, 100, 147}, //FHD_1080_2408,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1070, 1489, 795, 795+64, 795, 795+64, 100, 147}, //FHD_1080_2412,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1094, 1560, 818, 818+64, 818, 818+64, 100, 147}, //FHD_1080_2460,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1112, 1593, 819, 819+64, 819, 819+64, 100, 147}, //FHD_1080_2520,
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1274, 1693, 820, 820+64, 820, 820+64, 100, 147}, //FHD_1080_2550
|
|
{408, 671, 470, 470+45, 470+45+45, 470+45+45+57, 408, 671, 470, 356, 610, 678, 72, 128, 300, 1184, 1603, 908, 908+64, 908, 908+64, 100, 147}, //FHD_1080_2640
|
|
{447, 751, 494, 578, 662, 770, 447, 751, 529, 357, 672, 680, 72, 128, 300, 803, 1289, 481, 602, 481, 602, 100, 152}, //FHD_1200_1920,
|
|
{447, 751, 494, 578, 662, 770, 447, 751, 529, 357, 672, 680, 72, 128, 300, 835, 1342, 469, 590, 469, 590, 100, 152}, //FHD_1200_2000,
|
|
{428, 789, 490, 599, 707, 835, 428, 789, 530, 1100, 690, 1130, 72, 128, 300, 1169, 1809, 790, 932, 790, 932, 100, 152}, //FHD_1220_2712,
|
|
{448, 810, 510, 510+45, 510+45+45, 510+45+45+57, 448, 810, 550, 1143, 710, 1173, 72, 128, 300, 1213, 1853, 834, 834+64, 834, 834+64, 100, 152}, //FHD_1260_2800,
|
|
{556, 882, 570, 660, 570, 864, 556, 882, 443, 337, 574, 641, 72, 128, 300, 1112, 1630, 770, 898, 770, 898, 100, 158}, //FHD_1440_2560,
|
|
{538, 901, 600, 600+45, 600+90, 600+90+57, 538, 901, 640, 1344, 801, 1375, 72, 128, 300, 1413, 1988, 1034, 1034+64, 1034, 1034+64, 100, 165}, //FHD_1440_3200,
|
|
{538, 900, 600, 600+45, 600+90, 600+90+57, 538, 900, 640, 1353, 801, 1383, 72, 128, 300, 1420, 1998, 1042, 1042+64, 1042, 1042+64, 100, 165}, //FHD_1440_3216,
|
|
{806, 1110, 855, 939, 1023, 1131, 806, 1110, 890, 357, 1030, 678, 72, 128, 300, 443, 929, 124, 245, 124, 245, 100, 152}, //FHD_1920_1200,
|
|
// WQHD resolution
|
|
{966, 1329, 1029, 1029+45, 1029+90, 1029+90+57, 966, 1329, 1068, 744, 1229, 775, 72, 128, 300, 813, 1387, 434, 434+64, 434, 434+64, 100, 165}, //WQHD_2000_2296
|
|
{818, 1181, 880, 880+45, 880+90, 880+90+57, 818, 1181, 921, 892, 1080, 923, 72, 128, 300, 961, 1537, 582, 582+64 , 582, 582+64, 100, 165}, //WQHD_2296_2000
|
|
{1115, 1441, 1123, 1213, 1303, 1417, 1115, 1441, 334, 243, 434, 463, 72, 128, 300, 568, 1089, 252, 380, 252, 380, 100, 158}, //WQHD_2560_1536,
|
|
{1284, 1658, 1321, 1411, 1501, 1615, 1284, 1658, 334, 243, 434, 463, 144, 256, 45, 728, 1325, 300, 428, 300, 428, 100, 166}, //WQHD_2944_1840,
|
|
{1308, 1690, 1345, 1435, 1525, 1639, 1308, 1690, 334, 243, 434, 463, 72, 128, 300, 743, 1351, 300, 428, 300, 428, 100, 167}, //WQHD_3000_1876,
|
|
// End of Enum
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} //TOTAL_LCD_RES
|
|
};
|
|
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
int get_actual_logo_index(int index)
|
|
{
|
|
int i = 0;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]initial index =%d\n", __FUNCTION__, __LINE__, index);
|
|
|
|
if (!get_logo_multibin_status()) {
|
|
// singlebin
|
|
i = index + 1;
|
|
} else {
|
|
// multibin
|
|
i = index;
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]final index =%d\n", __FUNCTION__, __LINE__, i);
|
|
|
|
return i;
|
|
}
|
|
|
|
/*
|
|
* Check logo.bin address if valid, and get logo related info
|
|
* pinfo[0] : the number of all pictures in logo.bin
|
|
* pinf0[1] : the whole length of logo.bin
|
|
* pinf0[2] : the index = 0 picture's length
|
|
* pinfo[3+index] - pinfo[2+index] : means index length
|
|
*/
|
|
int check_logo_index_valid(int index, void *logo_addr, LOGO_PARA_T *logo_info)
|
|
{
|
|
uint32_t *pinfo = (uint32_t *)logo_addr;
|
|
logo_info->logonum = pinfo[0];
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]logonum =%d, index =%d\n", __FUNCTION__, __LINE__, logo_info->logonum, index);
|
|
}
|
|
if (index >= logo_info->logonum)
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGE("[show_animation_common: %s %d]unsupported logo, index =%d\n", __FUNCTION__, __LINE__, index);
|
|
}
|
|
return CHECK_LOGO_BIN_ERROR;
|
|
}
|
|
|
|
if (index < logo_info->logonum - 1)
|
|
{
|
|
logo_info->logolen = pinfo[3 + index] - pinfo[2 + index];
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("show_animation_common, pinfo[1]=%d, pinfo[3+index] - pinfo[2+index]= %d\n",
|
|
pinfo[1], pinfo[3 + index] - pinfo[2 + index]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
logo_info->logolen = pinfo[1] - pinfo[2 + index];
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("show_animation_common, pinfo[1]=%d, pinfo[1] - pinfo[2+index] =%d \n",
|
|
pinfo[1], pinfo[1] - pinfo[2 + index]);
|
|
}
|
|
}
|
|
|
|
logo_info->inaddr = (uint64_t)logo_addr + pinfo[2 + index];
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("show_animation_common, logo_addr=0x%08x , in_addr=0x%08x, logolen=%d\n",
|
|
(uint64_t)logo_addr, logo_info->inaddr, logo_info->logolen);
|
|
}
|
|
return CHECK_LOGO_BIN_OK;
|
|
}
|
|
|
|
int getValue(char *key, char *defValue)
|
|
{
|
|
char buf[PROPERTY_VALUE_MAX];
|
|
int len = property_get(key, buf, defValue);
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[libshowlogo: %s %d] buf = %s, key = %s\n", __FUNCTION__, __LINE__, buf, key);
|
|
}
|
|
return (atoi(buf));
|
|
}
|
|
|
|
int get_total_logo_images_entries(void)
|
|
{
|
|
int total_logo_entries = 0;
|
|
int to_include_fast_charging = getValue("ro.vendor.mtk_fast_charging_support", "0");
|
|
|
|
if (get_logo_multibin_status())
|
|
total_logo_entries = LOGOS_COUNT_NORMAL;
|
|
else
|
|
total_logo_entries = LOGOS_COUNT_BOOTLOGO + LOGOS_COUNT_NORMAL;
|
|
if (to_include_fast_charging == 1)
|
|
total_logo_entries += LOGOS_COUNT_FAST_CHARGING;
|
|
#if defined(MTK_WIRELESS_CHARGER_SUPPORT)
|
|
total_logo_entries += LOGOS_COUNT_WIRELESS;
|
|
#endif
|
|
|
|
SLOGD("[get_total_logo_images_entries: %s %d] total_logo_entries = %d to_include_fast_charging = %d\n", __FUNCTION__, __LINE__, total_logo_entries, to_include_fast_charging);
|
|
return total_logo_entries;
|
|
}
|
|
|
|
int calculate_logo_offset(unsigned int index, void *dec_logo_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
LOGO_PARA_T logo_info;
|
|
int logo_width = phical_screen.width;
|
|
int logo_height = phical_screen.height;
|
|
int raw_data_size;
|
|
uint64_t *pinfo;
|
|
int logo_index = index;
|
|
int total_logo_entries = 0;
|
|
int *logo_offset_by_lcm = NULL;
|
|
|
|
if ((logo_width == get_ext_lcd_width()) && (logo_height == get_ext_lcd_height()))
|
|
logo_offset_by_lcm = &logo_offset_ext;
|
|
else
|
|
logo_offset_by_lcm = &logo_offset;
|
|
|
|
if (*logo_offset_by_lcm != -1)
|
|
return *logo_offset_by_lcm;
|
|
|
|
pinfo = (uint64_t *)logo_addr;
|
|
*logo_offset_by_lcm = 0;
|
|
total_logo_entries = get_total_logo_images_entries();
|
|
SLOGD("[calculate_logo_offset: %s %d]pinfo[0] = %d pinfo[1] = %d\n", __FUNCTION__, __LINE__, pinfo[0], pinfo[1]);
|
|
SLOGD("[calculate_logo_offset: %s %d]TOTAL_LOG0_COUNT = %d , initial index = %d\n", __FUNCTION__, __LINE__, total_logo_entries, logo_index);
|
|
|
|
while (logo_index < pinfo[0])
|
|
{
|
|
if (check_logo_index_valid(logo_index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
|
|
{
|
|
SLOGD("[calculate_logo_offset: %s %d][Error]Resolution not supported\n",
|
|
__FUNCTION__, __LINE__);
|
|
*logo_offset_by_lcm = -1;
|
|
return *logo_offset_by_lcm;
|
|
}
|
|
raw_data_size = decompress_logo((void *)logo_info.inaddr, dec_logo_addr, logo_info.logolen,
|
|
phical_screen.fb_size);
|
|
SLOGD("[calculate_logo_offset: %s %d]Width = %d\n Height = %d\n raw_data_size = %d\n logo_index = %d\n",
|
|
__FUNCTION__, __LINE__, logo_width, logo_height, raw_data_size, logo_index);
|
|
if (raw_data_size == logo_width * logo_height * 4)
|
|
{
|
|
bits = 32;
|
|
break;
|
|
}
|
|
else if (raw_data_size == logo_width * logo_height * 2)
|
|
{
|
|
bits = 16;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
*logo_offset_by_lcm += total_logo_entries; // Add number of logos entries
|
|
logo_index += total_logo_entries;
|
|
}
|
|
SLOGD("[calculate_logo_offset: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
SLOGD("[calculate_logo_offset: %s %d]logo_offset = %d logo_index = %d\n", __FUNCTION__, __LINE__, logo_offset, logo_index);
|
|
}
|
|
SLOGD("[calculate_logo_offset: %s %d] final logo_offset = %d logo_index = %d\n", __FUNCTION__, __LINE__, logo_offset, logo_index);
|
|
return *logo_offset_by_lcm;
|
|
}
|
|
|
|
/*
|
|
* Fill resolution structure based on lcd size
|
|
*
|
|
*/
|
|
void init_charging_animation_ui_dimension()
|
|
{
|
|
int match_lcd = 0;
|
|
int lcd_res_count = 0;
|
|
int lcm_width, lcm_height;
|
|
int lcm_width_ext, lcm_height_ext;
|
|
lcm_height = chargingAnimationDimension.VDISPLAY;
|
|
lcm_width = chargingAnimationDimension.HDISPLAY;
|
|
lcm_height_ext = chargingAnimationDimension_ext.VDISPLAY;
|
|
lcm_width_ext = chargingAnimationDimension_ext.HDISPLAY;
|
|
int rotation = getRotation();
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[libshowlogo: %s %d]rotation = %d\n", __FUNCTION__, __LINE__, rotation);
|
|
}
|
|
if ((ORIENTATION_270 == rotation) || (ORIENTATION_90 == rotation))
|
|
{
|
|
// tbd 20220913 - Vikram - Driver LCM rotation & rotation by user
|
|
// need to differentiate
|
|
|
|
// lcm_width = chargingAnimationDimension.VDISPLAY;
|
|
// lcm_height = chargingAnimationDimension.HDISPLAY;
|
|
|
|
// not support charging animation rotation for 2nd LCD
|
|
}
|
|
SLOGD("[show_animation_common: %s %d] lcm_width and lcm_height= %d , %d \n", __FUNCTION__, __LINE__, lcm_width, lcm_height);
|
|
SLOGD("[show_animation_common: %s %d] lcm_width_ext and lcm_height_ext = %d , %d \n", __FUNCTION__, __LINE__, lcm_width_ext, lcm_height_ext);
|
|
while(lcd_res_count < TOTAL_LCD_RES)
|
|
{
|
|
if (lcm_width == lcd_info_array[lcd_res_count][LCD_WIDTH] && lcm_height == lcd_info_array[lcd_res_count][LCD_HEIGHT])
|
|
{
|
|
//capacity - fill area inside logo
|
|
charg_anim_ui_dimen.cap_left = logo_param_by_res[lcd_res_count][CAP_LEFT];
|
|
charg_anim_ui_dimen.cap_right = logo_param_by_res[lcd_res_count][CAP_RIGHT];
|
|
//number - depicting charge percentage
|
|
charg_anim_ui_dimen.num_left = logo_param_by_res[lcd_res_count][NUM_LEFT];
|
|
charg_anim_ui_dimen.num_right = logo_param_by_res[lcd_res_count][NUM_RIGHT];
|
|
//percentage - percent symbol drawn after number
|
|
charg_anim_ui_dimen.percent_left = logo_param_by_res[lcd_res_count][PERCENT_LEFT];
|
|
charg_anim_ui_dimen.percent_right = logo_param_by_res[lcd_res_count][PERCENT_RIGHT];
|
|
//top - top of charging animation
|
|
charg_anim_ui_dimen.top_anim_left = logo_param_by_res[lcd_res_count][TOP_ANIM_LEFT];
|
|
charg_anim_ui_dimen.top_anim_right = logo_param_by_res[lcd_res_count][TOP_ANIM_RIGHT];
|
|
//bar - small rectangle just below number & percentage
|
|
charg_anim_ui_dimen.bar_left = logo_param_by_res[lcd_res_count][BAR_LEFT];
|
|
charg_anim_ui_dimen.bar_top = logo_param_by_res[lcd_res_count][BAR_TOP];
|
|
charg_anim_ui_dimen.bar_right = logo_param_by_res[lcd_res_count][BAR_RIGHT];
|
|
charg_anim_ui_dimen.bar_bottom = logo_param_by_res[lcd_res_count][BAR_BOTTOM];
|
|
//fast charge animation parameters
|
|
charg_anim_ui_dimen.num_width_fast = logo_param_by_res[lcd_res_count][NUM_WIDTH_FAST];
|
|
charg_anim_ui_dimen.num_height_fast = logo_param_by_res[lcd_res_count][NUM_HEIGHT_FAST];
|
|
charg_anim_ui_dimen.top_margin_fast = logo_param_by_res[lcd_res_count][TOP_MARGIN_FAST];
|
|
|
|
charg_anim_ui_dimen.cap_top = logo_param_by_res[lcd_res_count][CAP_TOP];
|
|
charg_anim_ui_dimen.cap_bottom = logo_param_by_res[lcd_res_count][CAP_BOTTOM];
|
|
charg_anim_ui_dimen.num_top = logo_param_by_res[lcd_res_count][NUM_TOP];
|
|
charg_anim_ui_dimen.num_bottom = logo_param_by_res[lcd_res_count][NUM_BOTTOM];
|
|
charg_anim_ui_dimen.percent_top = logo_param_by_res[lcd_res_count][PERCENT_TOP];
|
|
charg_anim_ui_dimen.percent_bottom = logo_param_by_res[lcd_res_count][PERCENT_BOTTOM];
|
|
charg_anim_ui_dimen.top_anim_top = logo_param_by_res[lcd_res_count][TOP_ANIM_TOP];
|
|
charg_anim_ui_dimen.top_anim_bottom = logo_param_by_res[lcd_res_count][TOP_ANIM_BOTTOM];
|
|
|
|
SLOGD("[show_animation_common: %s %d] Main LCD parameters, num_left=%d, num_right=%d, num_top=%d, num_bot=%d, percent_left=%d, percent_right=%d, percent_top=%d, percent_bot=%d \n", __FUNCTION__, __LINE__, charg_anim_ui_dimen.num_left, charg_anim_ui_dimen.num_right, charg_anim_ui_dimen.num_top, charg_anim_ui_dimen.num_bottom, charg_anim_ui_dimen.percent_left, charg_anim_ui_dimen.percent_right, charg_anim_ui_dimen.percent_top, charg_anim_ui_dimen.percent_bottom);
|
|
|
|
match_lcd++;
|
|
}
|
|
else if ((lcm_width_ext == lcd_info_array[lcd_res_count][LCD_WIDTH] && lcm_height_ext == lcd_info_array[lcd_res_count][LCD_HEIGHT]) &&
|
|
is_ext_lcd_present())
|
|
{
|
|
//capacity - fill area inside logo
|
|
charg_anim_ui_dimen_ext.cap_left = logo_param_by_res[lcd_res_count][CAP_LEFT];
|
|
charg_anim_ui_dimen_ext.cap_right = logo_param_by_res[lcd_res_count][CAP_RIGHT];
|
|
//number - depicting charge percentage
|
|
charg_anim_ui_dimen_ext.num_left = logo_param_by_res[lcd_res_count][NUM_LEFT];
|
|
charg_anim_ui_dimen_ext.num_right = logo_param_by_res[lcd_res_count][NUM_RIGHT];
|
|
//percentage - symbol drawn after number
|
|
charg_anim_ui_dimen_ext.percent_left = logo_param_by_res[lcd_res_count][PERCENT_LEFT];
|
|
charg_anim_ui_dimen_ext.percent_right = logo_param_by_res[lcd_res_count][PERCENT_RIGHT];
|
|
//top - top of battery picture
|
|
charg_anim_ui_dimen_ext.top_anim_left = logo_param_by_res[lcd_res_count][TOP_ANIM_LEFT];
|
|
charg_anim_ui_dimen_ext.top_anim_right = logo_param_by_res[lcd_res_count][TOP_ANIM_RIGHT];
|
|
//bar - small rectangle just below number & percentage
|
|
charg_anim_ui_dimen_ext.bar_left = logo_param_by_res[lcd_res_count][BAR_LEFT];
|
|
charg_anim_ui_dimen_ext.bar_top = logo_param_by_res[lcd_res_count][BAR_TOP];
|
|
charg_anim_ui_dimen_ext.bar_right = logo_param_by_res[lcd_res_count][BAR_RIGHT];
|
|
charg_anim_ui_dimen_ext.bar_bottom = logo_param_by_res[lcd_res_count][BAR_BOTTOM];
|
|
//fast charge animation parameters
|
|
charg_anim_ui_dimen_ext.num_width_fast = logo_param_by_res[lcd_res_count][NUM_WIDTH_FAST];
|
|
charg_anim_ui_dimen_ext.num_height_fast = logo_param_by_res[lcd_res_count][NUM_HEIGHT_FAST];
|
|
charg_anim_ui_dimen_ext.top_margin_fast = logo_param_by_res[lcd_res_count][TOP_MARGIN_FAST];
|
|
|
|
charg_anim_ui_dimen_ext.cap_top = logo_param_by_res[lcd_res_count][CAP_TOP];
|
|
charg_anim_ui_dimen_ext.cap_bottom = logo_param_by_res[lcd_res_count][CAP_BOTTOM];
|
|
charg_anim_ui_dimen_ext.num_top = logo_param_by_res[lcd_res_count][NUM_TOP];
|
|
charg_anim_ui_dimen_ext.num_bottom = logo_param_by_res[lcd_res_count][NUM_BOTTOM];
|
|
charg_anim_ui_dimen_ext.percent_top = logo_param_by_res[lcd_res_count][PERCENT_TOP];
|
|
charg_anim_ui_dimen_ext.percent_bottom = logo_param_by_res[lcd_res_count][PERCENT_BOTTOM];
|
|
charg_anim_ui_dimen_ext.top_anim_top = logo_param_by_res[lcd_res_count][TOP_ANIM_TOP];
|
|
charg_anim_ui_dimen_ext.top_anim_bottom = logo_param_by_res[lcd_res_count][TOP_ANIM_BOTTOM];
|
|
|
|
match_lcd++;
|
|
}
|
|
if (match_lcd == MAX_LCD_DISPLAY)
|
|
{
|
|
break;
|
|
}
|
|
else
|
|
lcd_res_count++;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Fill a screen size buffer with logo content
|
|
*
|
|
*/
|
|
void fill_animation_logo(int index, void *fill_addr, void *dec_logo_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
LOGO_PARA_T logo_info;
|
|
int logo_width = phical_screen.width;
|
|
int logo_height = phical_screen.height;
|
|
int raw_data_size;
|
|
int logo_index = index;
|
|
int logo_offset = -1;
|
|
|
|
g_dec_logo_addr = dec_logo_addr;
|
|
logo_offset = calculate_logo_offset(index, dec_logo_addr, logo_addr, phical_screen);
|
|
if (logo_offset == -1)
|
|
{
|
|
SLOGD("[calculate_logo_offset: %s %d]Resolution not supported\n", __FUNCTION__, __LINE__);
|
|
return;
|
|
}
|
|
logo_index = logo_index + logo_offset;
|
|
if (check_logo_index_valid(logo_index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
|
|
return;
|
|
|
|
raw_data_size = decompress_logo((void *)logo_info.inaddr, dec_logo_addr, logo_info.logolen, phical_screen.fb_size);
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]raw_data_size = %d\n", __FUNCTION__, __LINE__, raw_data_size);
|
|
}
|
|
|
|
if ((phical_screen.rotation == 270 || phical_screen.rotation == 90) && (logo_width != get_ext_lcd_width() && logo_height != get_ext_lcd_height()))
|
|
{
|
|
logo_width = phical_screen.height;
|
|
logo_height = phical_screen.width;
|
|
}
|
|
if (0 == bits)
|
|
{
|
|
if (raw_data_size == logo_width * logo_height * 4)
|
|
{
|
|
bits = 32;
|
|
}
|
|
else if (raw_data_size == logo_width * logo_height * 2)
|
|
{
|
|
bits = 16;
|
|
}
|
|
else
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGE("[show_animation_common: %s %d]Logo data error\n", __FUNCTION__, __LINE__);
|
|
}
|
|
return;
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
}
|
|
}
|
|
|
|
RECT_REGION_T rect = {0, 0, logo_width, logo_height};
|
|
|
|
fill_rect_with_content(fill_addr, rect, dec_logo_addr, phical_screen, bits);
|
|
}
|
|
|
|
/*
|
|
* Fill a rectangle size address with special color
|
|
*
|
|
*/
|
|
void fill_animation_prog_bar(RECT_REGION_T rect_bar,
|
|
unsigned int fgColor,
|
|
unsigned int start_div, unsigned int occupied_div,
|
|
void *fill_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
unsigned int div_size = (rect_bar.bottom - rect_bar.top) / (ANIM_V0_REGIONS);
|
|
unsigned int draw_size = div_size - (ANIM_V0_SPACE_AFTER_REGION);
|
|
|
|
unsigned int i;
|
|
|
|
for (i = start_div; i < start_div + occupied_div; ++i)
|
|
{
|
|
unsigned int draw_bottom = rect_bar.bottom - div_size * i - (ANIM_V0_SPACE_AFTER_REGION);
|
|
unsigned int draw_top = draw_bottom - draw_size;
|
|
|
|
RECT_REGION_T rect = {rect_bar.left, draw_top, rect_bar.right, draw_bottom};
|
|
|
|
fill_rect_with_color(fill_addr, rect, fgColor, phical_screen);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Fill a rectangle with logo content
|
|
*
|
|
*/
|
|
void fill_animation_dynamic(int index, RECT_REGION_T rect, void *fill_addr, void *dec_logo_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
LOGO_PARA_T logo_info;
|
|
int raw_data_size;
|
|
int logo_index = index;
|
|
int logo_offset = -1;
|
|
g_dec_logo_addr = dec_logo_addr;
|
|
|
|
logo_offset = calculate_logo_offset(index, dec_logo_addr, logo_addr, phical_screen);
|
|
if (logo_offset == -1)
|
|
{
|
|
SLOGD("[calculate_logo_offset: %s %d]Resolution not supported\n", __FUNCTION__, __LINE__);
|
|
return;
|
|
}
|
|
|
|
logo_index = logo_index + logo_offset;
|
|
if (check_logo_index_valid(logo_index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
|
|
return;
|
|
|
|
raw_data_size = decompress_logo((void *)logo_info.inaddr, (void *)dec_logo_addr, logo_info.logolen, (rect.right - rect.left) * (rect.bottom - rect.top) * 4);
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]raw_data_size = %d\n", __FUNCTION__, __LINE__, raw_data_size);
|
|
}
|
|
if (0 == bits)
|
|
{
|
|
if (raw_data_size == (rect.right - rect.left) * (rect.bottom - rect.top) * 4)
|
|
{
|
|
bits = 32;
|
|
}
|
|
else if (raw_data_size == (rect.right - rect.left) * (rect.bottom - rect.top) * 2)
|
|
{
|
|
bits = 16;
|
|
}
|
|
else
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGE("[show_animation_common: %s %d]Logo data error\n", __FUNCTION__, __LINE__);
|
|
}
|
|
return;
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
}
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
}
|
|
fill_rect_with_content(fill_addr, rect, dec_logo_addr, phical_screen, bits);
|
|
}
|
|
|
|
/*
|
|
* Fill a rectangle with number logo content
|
|
*
|
|
* number_position: 0~1st number, 1~2nd number
|
|
*/
|
|
void fill_animation_number(int index, unsigned int number_position, void *fill_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
int display_width = phical_screen.width;
|
|
int display_height = phical_screen.height;
|
|
int logo_index = index;
|
|
int logo_offset = -1;
|
|
int num_left, num_right, num_top, num_bottom = 0;
|
|
int *ptr_number_pic_size = NULL;
|
|
unsigned short *ptr_number_pic_addr = NULL;
|
|
|
|
logo_offset = calculate_logo_offset(index, g_dec_logo_addr, logo_addr, phical_screen);
|
|
if (logo_offset == -1)
|
|
{
|
|
SLOGD("[calculate_logo_offset: %s %d]Resolution not supported\n", __FUNCTION__, __LINE__);
|
|
return;
|
|
}
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
num_left = charg_anim_ui_dimen_ext.num_left;
|
|
num_right = charg_anim_ui_dimen_ext.num_right;
|
|
num_top = charg_anim_ui_dimen_ext.num_top;
|
|
num_bottom = charg_anim_ui_dimen_ext.num_bottom;
|
|
|
|
ptr_number_pic_size = &number_pic_size_ext;
|
|
|
|
if (number_pic_addr_ext == NULL)
|
|
{
|
|
number_pic_addr_ext = (unsigned short *)malloc(((num_right - num_left) * (num_bottom - num_top) * 4) * sizeof(unsigned short));
|
|
memset(number_pic_addr_ext, 0, (((num_right - num_left) * (num_bottom - num_top) * 4) * sizeof(unsigned short)));
|
|
}
|
|
ptr_number_pic_addr = number_pic_addr_ext;
|
|
}
|
|
else
|
|
{
|
|
num_left = charg_anim_ui_dimen.num_left;
|
|
num_right = charg_anim_ui_dimen.num_right;
|
|
num_top = charg_anim_ui_dimen.num_top;
|
|
num_bottom = charg_anim_ui_dimen.num_bottom;
|
|
|
|
ptr_number_pic_size = &number_pic_size;
|
|
|
|
if (number_pic_addr == NULL)
|
|
{
|
|
number_pic_addr = (unsigned short *)malloc(((num_right - num_left) * (num_bottom - num_top) * 4) * sizeof(unsigned short));
|
|
memset(number_pic_addr, 0, (((num_right - num_left) * (num_bottom - num_top) * 4) * sizeof(unsigned short)));
|
|
}
|
|
ptr_number_pic_addr = number_pic_addr;
|
|
}
|
|
|
|
logo_index = logo_index + logo_offset;
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]index= %d, number_position = %d\n", __FUNCTION__, __LINE__, index, number_position);
|
|
|
|
LOGO_PARA_T logo_info;
|
|
int raw_data_size;
|
|
if (check_logo_index_valid(logo_index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
|
|
return;
|
|
|
|
*ptr_number_pic_size = (num_right - num_left) * (num_bottom - num_top) * 4;
|
|
raw_data_size = decompress_logo((void *)logo_info.inaddr, (void *)ptr_number_pic_addr, logo_info.logolen, *ptr_number_pic_size);
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]raw_data_size = %d\n", __FUNCTION__, __LINE__, raw_data_size);
|
|
|
|
RECT_REGION_T battery_number_rect = {num_left + (num_right - num_left) * number_position,
|
|
num_top,
|
|
num_right + (num_right - num_left) * number_position,
|
|
num_bottom};
|
|
if (0 == bits)
|
|
{
|
|
if (raw_data_size == (num_right - num_left) * (num_bottom - num_top) * 4)
|
|
{
|
|
bits = 32;
|
|
}
|
|
else if (raw_data_size == (num_right - num_left) * (num_bottom - num_top) * 2)
|
|
{
|
|
bits = 16;
|
|
}
|
|
else
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGE("[show_animation_common: %s %d]Logo data error\n", __FUNCTION__, __LINE__);
|
|
}
|
|
return;
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
}
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
}
|
|
|
|
fill_rect_with_content(fill_addr, battery_number_rect, ptr_number_pic_addr, phical_screen, bits);
|
|
|
|
}
|
|
|
|
/*
|
|
* Fill a line with special color
|
|
*
|
|
*/
|
|
void fill_animation_line(int index, unsigned int capacity_grids, void *fill_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
|
|
int display_width = phical_screen.width;
|
|
int display_height = phical_screen.height;
|
|
int logo_index = index;
|
|
int logo_offset = -1;
|
|
int top_anim_left, top_anim_right = 0;
|
|
int cap_left, cap_right, cap_top, cap_bottom = 0;
|
|
LOGO_PARA_T logo_info;
|
|
int raw_data_size;
|
|
unsigned short *ptr_line_pic_size = NULL;
|
|
unsigned short *ptr_line_pic_addr = NULL;
|
|
|
|
logo_offset = calculate_logo_offset(index, g_dec_logo_addr, logo_addr, phical_screen);
|
|
if (logo_offset == -1)
|
|
{
|
|
SLOGD("[calculate_logo_offset: %s %d]Resolution not supported\n", __FUNCTION__, __LINE__);
|
|
return;
|
|
}
|
|
logo_index = logo_index + logo_offset;
|
|
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
top_anim_left = charg_anim_ui_dimen_ext.top_anim_left;
|
|
top_anim_right = charg_anim_ui_dimen_ext.top_anim_right;
|
|
cap_left = charg_anim_ui_dimen_ext.cap_left;
|
|
cap_right = charg_anim_ui_dimen_ext.cap_right;
|
|
cap_top = charg_anim_ui_dimen_ext.cap_top;
|
|
cap_bottom = charg_anim_ui_dimen_ext.cap_bottom;
|
|
|
|
ptr_line_pic_size = &line_pic_size_ext;
|
|
|
|
if (line_pic_addr_ext == NULL)
|
|
{
|
|
line_pic_addr_ext = (unsigned short **)malloc(((top_anim_right - top_anim_left) * 4) * sizeof(unsigned short));
|
|
memset(line_pic_addr_ext, 0, (((top_anim_right - top_anim_left) * 4) * sizeof(unsigned short)));
|
|
}
|
|
ptr_line_pic_addr = line_pic_addr_ext;
|
|
}
|
|
else
|
|
{
|
|
top_anim_left = charg_anim_ui_dimen.top_anim_left;
|
|
top_anim_right = charg_anim_ui_dimen.top_anim_right;
|
|
cap_left = charg_anim_ui_dimen.cap_left;
|
|
cap_right = charg_anim_ui_dimen.cap_right;
|
|
cap_top = charg_anim_ui_dimen.cap_top;
|
|
cap_bottom = charg_anim_ui_dimen.cap_bottom;
|
|
|
|
ptr_line_pic_size = &line_pic_size;
|
|
|
|
if (line_pic_addr == NULL)
|
|
{
|
|
line_pic_addr = (unsigned short **)malloc(((top_anim_right - top_anim_left) * 4) * sizeof(unsigned short));
|
|
memset(line_pic_addr, 0, (((top_anim_right - top_anim_left) * 4) * sizeof(unsigned short)));
|
|
}
|
|
ptr_line_pic_addr = line_pic_addr;
|
|
}
|
|
|
|
if (check_logo_index_valid(logo_index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
|
|
return;
|
|
|
|
*ptr_line_pic_size = (top_anim_right - top_anim_left) * 4;
|
|
|
|
raw_data_size = decompress_logo((void *)logo_info.inaddr, (void *)ptr_line_pic_addr, logo_info.logolen, *ptr_line_pic_size);
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]raw_data_size = %d\n", __FUNCTION__, __LINE__, raw_data_size);
|
|
|
|
if (0 == bits)
|
|
{
|
|
if (raw_data_size == (top_anim_right - top_anim_left) * 4)
|
|
{
|
|
bits = 32;
|
|
}
|
|
else if (raw_data_size == (top_anim_right - top_anim_left) * 2)
|
|
{
|
|
bits = 16;
|
|
}
|
|
else
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGE("[show_animation_common: %s %d]Logo data error\n", __FUNCTION__, __LINE__);
|
|
|
|
return;
|
|
}
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]bits = %d\n", __FUNCTION__, __LINE__, bits);
|
|
}
|
|
RECT_REGION_T rect = {cap_left, cap_top, cap_right, cap_bottom};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]cap_left = %d, cap_top = %d, cap_right = %d, cap_bottom = %d, \n", __FUNCTION__, __LINE__, cap_left, cap_top, cap_right, cap_bottom);
|
|
|
|
int i = capacity_grids;
|
|
for (; i < cap_bottom; i++)
|
|
{
|
|
rect.top = i;
|
|
rect.bottom = i + 1;
|
|
|
|
//if (MTK_LOG_ENABLE == 1)
|
|
// SLOGD("[show_animation_common: %s %d]rectangle_left = %d, rectangle_top = %d, rectangle_right = %d, rectangle_bottom = %d, \n", __FUNCTION__, __LINE__, rect.left, rect.top, rect.right, rect.bottom);
|
|
|
|
fill_rect_with_content(fill_addr, rect, ptr_line_pic_addr, phical_screen, bits);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Show old charging animation
|
|
*
|
|
*/
|
|
void fill_animation_battery_old(int capacity, void *fill_addr, void *dec_logo_addr, void *logo_addr,
|
|
LCM_SCREEN_T phical_screen)
|
|
{
|
|
int display_width = phical_screen.width;
|
|
int display_height = phical_screen.height;
|
|
int capacity_grids = 0;
|
|
int bar_left, bar_right, bar_top, bar_bottom = 0;
|
|
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
bar_left = charg_anim_ui_dimen_ext.bar_left;
|
|
bar_right = charg_anim_ui_dimen_ext.bar_right;
|
|
bar_top = charg_anim_ui_dimen_ext.bar_top;
|
|
bar_bottom = charg_anim_ui_dimen_ext.bar_bottom;
|
|
}
|
|
else
|
|
{
|
|
bar_left = charg_anim_ui_dimen.bar_left;
|
|
bar_right = charg_anim_ui_dimen.bar_right;
|
|
bar_top = charg_anim_ui_dimen.bar_top;
|
|
bar_bottom = charg_anim_ui_dimen.bar_bottom;
|
|
}
|
|
|
|
if (capacity > 100)
|
|
capacity = 100;
|
|
|
|
capacity_grids = (capacity * (ANIM_V0_REGIONS)) / 100;
|
|
RECT_REGION_T bar_rect = {bar_left, bar_top, bar_right, bar_bottom};
|
|
|
|
if (version0_charging_index < capacity_grids * 2)
|
|
version0_charging_index = capacity_grids * 2;
|
|
|
|
if (capacity < 100)
|
|
{
|
|
version0_charging_index > 7 ? version0_charging_index = capacity_grids * 2 : version0_charging_index++;
|
|
}
|
|
else
|
|
{
|
|
version0_charging_index = ANIM_V0_REGIONS * 2;
|
|
}
|
|
|
|
fill_animation_logo(ANIM_V0_BACKGROUND_INDEX, fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
RECT_REGION_T rect_bar = {bar_rect.left + 1, bar_rect.top + 1, bar_rect.right, bar_rect.bottom};
|
|
|
|
fill_animation_prog_bar(rect_bar,
|
|
(unsigned int)(BAR_OCCUPIED_COLOR),
|
|
0, version0_charging_index / 2,
|
|
fill_addr, phical_screen);
|
|
|
|
fill_animation_prog_bar(rect_bar,
|
|
(unsigned int)(BAR_EMPTY_COLOR),
|
|
version0_charging_index / 2, ANIM_V0_REGIONS - version0_charging_index / 2,
|
|
fill_addr, phical_screen);
|
|
}
|
|
|
|
/*
|
|
* Show new charging animation
|
|
*
|
|
*/
|
|
void fill_animation_battery_new(int capacity, void *fill_addr, void *dec_logo_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
int display_width = phical_screen.width;
|
|
int display_height = phical_screen.height;
|
|
int percent_left, percent_right, percent_top, percent_bottom = 0;
|
|
int top_anim_left, top_anim_right, top_anim_top, top_anim_bottom = 0;
|
|
int cap_top, cap_bottom = 0;
|
|
int *charg_anim_idx_by_lcm = NULL;
|
|
int *charg_anim_low_idx_by_lcm = NULL;
|
|
unsigned short *ptr_percent_pic_addr = NULL;
|
|
unsigned short *ptr_top_animation_addr = NULL;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]capacity : %d\n", __FUNCTION__, __LINE__, capacity);
|
|
}
|
|
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
percent_left = charg_anim_ui_dimen_ext.percent_left;
|
|
percent_right = charg_anim_ui_dimen_ext.percent_right;
|
|
percent_top = charg_anim_ui_dimen_ext.percent_top;
|
|
percent_bottom = charg_anim_ui_dimen_ext.percent_bottom;
|
|
top_anim_left = charg_anim_ui_dimen_ext.top_anim_left;
|
|
top_anim_right = charg_anim_ui_dimen_ext.top_anim_right;
|
|
top_anim_top = charg_anim_ui_dimen_ext.top_anim_top;
|
|
top_anim_bottom = charg_anim_ui_dimen_ext.top_anim_bottom;
|
|
cap_top = charg_anim_ui_dimen_ext.cap_top;
|
|
cap_bottom = charg_anim_ui_dimen_ext.cap_bottom;
|
|
|
|
charg_anim_idx_by_lcm = &charging_animation_index_ext;
|
|
charg_anim_low_idx_by_lcm = &charging_low_index_ext;
|
|
|
|
if (percent_pic_addr_ext == NULL)
|
|
{
|
|
percent_pic_addr_ext = (unsigned short *)malloc(((percent_right - percent_left) * (percent_bottom - percent_top) * 4) * sizeof(unsigned short));
|
|
memset(percent_pic_addr_ext, 0, (((percent_right - percent_left) * (percent_bottom - percent_top) * 4) * sizeof(unsigned short)));
|
|
}
|
|
|
|
if (top_animation_addr_ext == NULL)
|
|
{
|
|
top_animation_addr_ext = (unsigned short *)malloc(((top_anim_right - top_anim_left) * (top_anim_bottom - top_anim_top) * 4) * sizeof(unsigned short));
|
|
memset(top_animation_addr_ext, 0, (((top_anim_right - top_anim_left) * (top_anim_bottom - top_anim_top) * 4) * sizeof(unsigned short)));
|
|
}
|
|
|
|
ptr_percent_pic_addr = percent_pic_addr_ext;
|
|
ptr_top_animation_addr = top_animation_addr_ext;
|
|
}
|
|
else
|
|
{
|
|
percent_left = charg_anim_ui_dimen.percent_left;
|
|
percent_right = charg_anim_ui_dimen.percent_right;
|
|
percent_top = charg_anim_ui_dimen.percent_top;
|
|
percent_bottom = charg_anim_ui_dimen.percent_bottom;
|
|
top_anim_left = charg_anim_ui_dimen.top_anim_left;
|
|
top_anim_right = charg_anim_ui_dimen.top_anim_right;
|
|
top_anim_top = charg_anim_ui_dimen.top_anim_top;
|
|
top_anim_bottom = charg_anim_ui_dimen.top_anim_bottom;
|
|
cap_top = charg_anim_ui_dimen.cap_top;
|
|
cap_bottom = charg_anim_ui_dimen.cap_bottom;
|
|
|
|
charg_anim_idx_by_lcm = &charging_animation_index;
|
|
charg_anim_low_idx_by_lcm = &charging_low_index;
|
|
|
|
if (percent_pic_addr == NULL)
|
|
{
|
|
percent_pic_addr = (unsigned short *)malloc(((percent_right - percent_left) * (percent_bottom - percent_top) * 4) * sizeof(unsigned short));
|
|
memset(percent_pic_addr, 0, (((percent_right - percent_left) * (percent_bottom - percent_top) * 4) * sizeof(unsigned short)));
|
|
}
|
|
|
|
if (top_animation_addr == NULL)
|
|
{
|
|
top_animation_addr = (unsigned short *)malloc(((top_anim_right - top_anim_left) * (top_anim_bottom - top_anim_top) * 4) * sizeof(unsigned short));
|
|
memset(top_animation_addr, 0, (((top_anim_right - top_anim_left) * (top_anim_bottom - top_anim_top) * 4) * sizeof(unsigned short)));
|
|
}
|
|
|
|
ptr_percent_pic_addr = percent_pic_addr;
|
|
ptr_top_animation_addr = top_animation_addr;
|
|
}
|
|
|
|
RECT_REGION_T percent_location_rect = {percent_left, percent_top, percent_right, percent_bottom};
|
|
|
|
if (capacity >= 100)
|
|
{
|
|
fill_animation_logo(get_actual_logo_index(FULL_BATTERY_INDEX), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
}
|
|
else if (capacity < 10)
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]charging_low_index = %d\n", __FUNCTION__, __LINE__, *charg_anim_low_idx_by_lcm);
|
|
}
|
|
(*charg_anim_low_idx_by_lcm)++;
|
|
|
|
fill_animation_logo(get_actual_logo_index(LOW_BAT_ANIM_START_0 + (*charg_anim_low_idx_by_lcm)), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
fill_animation_number(get_actual_logo_index(NUMBER_PIC_START_0 + capacity), 1, fill_addr, logo_addr, phical_screen);
|
|
fill_animation_dynamic(get_actual_logo_index(NUMBER_PIC_PERCENT), percent_location_rect, fill_addr, ptr_percent_pic_addr, logo_addr, phical_screen);
|
|
|
|
if (*charg_anim_low_idx_by_lcm >= 9)
|
|
*charg_anim_low_idx_by_lcm = 0;
|
|
}
|
|
else
|
|
{
|
|
unsigned int capacity_grids = 0;
|
|
capacity_grids = cap_bottom - (cap_bottom - cap_top) * (capacity - 10) / 90;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]capacity_grids : %d,charging_animation_index = %d\n", __FUNCTION__, __LINE__, capacity_grids, *charg_anim_idx_by_lcm);
|
|
|
|
//background
|
|
fill_animation_logo(get_actual_logo_index(ANIM_V1_BACKGROUND_INDEX), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
fill_animation_line(get_actual_logo_index(ANIM_LINE_INDEX), capacity_grids, fill_addr, logo_addr, phical_screen);
|
|
fill_animation_number(get_actual_logo_index(NUMBER_PIC_START_0 + (capacity / 10)), 0, fill_addr, logo_addr, phical_screen);
|
|
fill_animation_number(get_actual_logo_index(NUMBER_PIC_START_0 + (capacity % 10)), 1, fill_addr, logo_addr, phical_screen);
|
|
fill_animation_dynamic(get_actual_logo_index(NUMBER_PIC_PERCENT), percent_location_rect, fill_addr, ptr_percent_pic_addr, logo_addr, phical_screen);
|
|
|
|
if (capacity <= 90)
|
|
{
|
|
RECT_REGION_T top_animation_rect = {top_anim_left, capacity_grids - (top_anim_bottom - top_anim_top), top_anim_right, capacity_grids};
|
|
(*charg_anim_idx_by_lcm)++;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d] If capacity less than 90 then capacity_grids : %d,charging_animation_index = %d\n", __FUNCTION__, __LINE__, capacity_grids, *charg_anim_idx_by_lcm);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(BAT_ANIM_START_0 + (*charg_anim_idx_by_lcm)), top_animation_rect, fill_addr, ptr_top_animation_addr, logo_addr, phical_screen);
|
|
|
|
if ((*charg_anim_idx_by_lcm) >= 9)
|
|
*charg_anim_idx_by_lcm = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Show wireless charging animation
|
|
* total 29 logo:from 39 ~ 68
|
|
* less(0<10): 50-53 , low(<30):54-57 ,middle(<60):58-61 , high():62-75 , o:66, full:67,num (0-9):39-48, %:49
|
|
*
|
|
*/
|
|
void fill_animation_battery_wireless_charging(int capacity, void *fill_addr, void *dec_logo_addr, void *logo_addr, LCM_SCREEN_T phical_screen)
|
|
{
|
|
int display_width = phical_screen.width;
|
|
int display_height = phical_screen.height;
|
|
int curr_left = 0;
|
|
int num_width = 0;
|
|
int num_height = 0;
|
|
int top_margin_height = 0;
|
|
int rotation = getRotation();
|
|
int *charg_anim_low_idx_by_lcm = NULL;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]capacity : %d\n", __FUNCTION__, __LINE__, capacity);
|
|
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
charg_anim_low_idx_by_lcm = &charging_low_index_ext;
|
|
}
|
|
else
|
|
{
|
|
charg_anim_low_idx_by_lcm = &charging_low_index;
|
|
}
|
|
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
num_width = charg_anim_ui_dimen_ext.num_width_fast;
|
|
num_height = charg_anim_ui_dimen_ext.num_height_fast;
|
|
top_margin_height = charg_anim_ui_dimen_ext.top_margin_fast;
|
|
}
|
|
else
|
|
{
|
|
num_width = charg_anim_ui_dimen.num_width_fast;
|
|
num_height = charg_anim_ui_dimen.num_height_fast;
|
|
top_margin_height = charg_anim_ui_dimen.top_margin_fast;
|
|
}
|
|
(*charg_anim_low_idx_by_lcm) >= 3 ? (*charg_anim_low_idx_by_lcm) = 0 : (*charg_anim_low_idx_by_lcm)++;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]charging_low_index = %d\n", __FUNCTION__, __LINE__, *charg_anim_low_idx_by_lcm);
|
|
|
|
if (capacity >= 100)
|
|
{
|
|
// battery 100
|
|
fill_animation_logo(get_actual_logo_index(V2_BAT_100_INDEX), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
}
|
|
else if (capacity <= 0)
|
|
{
|
|
fill_animation_logo(get_actual_logo_index(V2_BAT_0_INDEX), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
}
|
|
else
|
|
{
|
|
int bg_index = get_actual_logo_index(V2_BAT_0_10_START_INDEX); //capacity > 0 && capacity < 10
|
|
if (capacity >= 10 && capacity < 40)
|
|
bg_index = get_actual_logo_index(V2_BAT_10_40_START_INDEX);
|
|
else if (capacity >= 40 && capacity < 80)
|
|
bg_index = get_actual_logo_index(V2_BAT_40_80_START_INDEX);
|
|
else if (capacity >= 80 && capacity < 100)
|
|
bg_index = get_actual_logo_index(V2_BAT_80_100_START_NDEX);
|
|
|
|
fill_animation_logo(bg_index + (*charg_anim_low_idx_by_lcm), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
curr_left = (display_width - num_width * 2) >> 1;
|
|
unsigned short tmp_num_addr[(int)display_width * display_height / 20];
|
|
|
|
if (capacity >= 10)
|
|
{
|
|
curr_left = (display_width - num_width * 3) >> 1;
|
|
RECT_REGION_T tmp_rect_1 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]tmp_rect_1 left = %d, right = %d,top = %d,bottom = %d,\n", __FUNCTION__, __LINE__,
|
|
tmp_rect_1.left, tmp_rect_1.right, tmp_rect_1.top, tmp_rect_1.bottom);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(V2_NUM_START_0_INDEX + (capacity / 10)), tmp_rect_1, fill_addr, tmp_num_addr, logo_addr, phical_screen);
|
|
tmp_rect_1.left += (int)display_width / 10;
|
|
tmp_rect_1.right += (int)display_width / 10;
|
|
curr_left += num_width;
|
|
}
|
|
|
|
RECT_REGION_T tmp_rect_2 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]tmp_rect_2 left = %d, right = %d,top = %d,bottom = %d,\n", __FUNCTION__, __LINE__,
|
|
tmp_rect_2.left, tmp_rect_2.right, tmp_rect_2.top, tmp_rect_2.bottom);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(V2_NUM_START_0_INDEX + (capacity % 10)), tmp_rect_2, fill_addr, tmp_num_addr, logo_addr, phical_screen);
|
|
|
|
curr_left += num_width;
|
|
|
|
RECT_REGION_T tmp_rect_3 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]tmp_rect_3 left = %d, right = %d,top = %d,bottom = %d,\n", __FUNCTION__, __LINE__,
|
|
tmp_rect_3.left, tmp_rect_3.right, tmp_rect_3.top, tmp_rect_3.bottom);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(V2_NUM_PERCENT_INDEX), tmp_rect_3, fill_addr, tmp_num_addr, logo_addr, phical_screen);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Pump charging aniamtion
|
|
* index 39: 100%, 40~45 : animation logo, 46~55: number logo, 56: % logo
|
|
*
|
|
*/
|
|
void fill_animation_battery_fast_charging(int capacity, void *fill_addr, void *dec_logo_addr, void *logo_addr, LCM_SCREEN_T phical_screen, int draw_anim_mode)
|
|
{
|
|
int display_width = phical_screen.width;
|
|
int display_height = phical_screen.height;
|
|
int curr_left = 0;
|
|
int num_width = 0;
|
|
int num_height = 0;
|
|
int top_margin_height = 0;
|
|
int rotation = getRotation();
|
|
int *charg_anim_low_idx_by_lcm = NULL;
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[libshowlogo: %s %d]rotation = %d\n", __FUNCTION__, __LINE__, rotation);
|
|
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
charg_anim_low_idx_by_lcm = &charging_low_index_ext;
|
|
}
|
|
else
|
|
{
|
|
charg_anim_low_idx_by_lcm = &charging_low_index;
|
|
}
|
|
|
|
if (draw_anim_mode == DRAW_ANIM_MODE_FB)
|
|
{
|
|
if ((ORIENTATION_90 == rotation) || (ORIENTATION_270 == rotation))
|
|
{
|
|
display_width = phical_screen.height;
|
|
display_height = phical_screen.width;
|
|
}
|
|
}
|
|
if (display_width == get_ext_lcd_width() && display_height == get_ext_lcd_height())
|
|
{
|
|
num_width = charg_anim_ui_dimen_ext.num_width_fast;
|
|
num_height = charg_anim_ui_dimen_ext.num_height_fast;
|
|
top_margin_height = charg_anim_ui_dimen_ext.top_margin_fast;
|
|
}
|
|
else
|
|
{
|
|
num_width = charg_anim_ui_dimen.num_width_fast;
|
|
num_height = charg_anim_ui_dimen.num_height_fast;
|
|
top_margin_height = charg_anim_ui_dimen.top_margin_fast;
|
|
}
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]capacity : %d, num_width:%d, num_height:%d, top_margin_height:%d\n", __FUNCTION__, __LINE__, capacity, num_width, num_height, top_margin_height);
|
|
|
|
(*charg_anim_low_idx_by_lcm) >= 5 ? (*charg_anim_low_idx_by_lcm) = 0 : (*charg_anim_low_idx_by_lcm)++;
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]charging_low_index = %d\n", __FUNCTION__, __LINE__, *charg_anim_low_idx_by_lcm);
|
|
SLOGD("[show_animation_common: %s %d]capacity : %d\n", __FUNCTION__, __LINE__, capacity);
|
|
}
|
|
|
|
if (capacity >= 100)
|
|
{
|
|
fill_animation_logo(get_actual_logo_index(FAST_CHARGING_BAT_100_INDEX), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
}
|
|
else
|
|
{
|
|
fill_animation_logo(get_actual_logo_index(FAST_CHARGING_BAT_START_0_INDEX + (*charg_anim_low_idx_by_lcm)), fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
curr_left = (display_width - num_width * 2) >> 1;
|
|
unsigned short tmp_num_addr[(int)display_width * display_height / 20];
|
|
|
|
if (capacity >= 10)
|
|
{
|
|
curr_left = (display_width - num_width * 3) >> 1;
|
|
RECT_REGION_T tmp_rect_1 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]capacity = %d, show 1st num : %d\n", __FUNCTION__, __LINE__, capacity, capacity / 10);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(FAST_CHARGING_NUM_START_0_INDEX + (capacity / 10)), tmp_rect_1, fill_addr, tmp_num_addr, logo_addr, phical_screen);
|
|
curr_left += num_width;
|
|
}
|
|
|
|
RECT_REGION_T tmp_rect_2 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]capacity = %d, show 2nd num : %d\n", __FUNCTION__, __LINE__, capacity, capacity % 10);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(FAST_CHARGING_NUM_START_0_INDEX + (capacity % 10)), tmp_rect_2, fill_addr, tmp_num_addr, logo_addr, phical_screen);
|
|
|
|
curr_left += num_width;
|
|
|
|
RECT_REGION_T tmp_rect_3 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
|
|
|
|
if (MTK_LOG_ENABLE == 1)
|
|
SLOGD("[show_animation_common: %s %d]show percent\n", __FUNCTION__, __LINE__);
|
|
|
|
fill_animation_dynamic(get_actual_logo_index(FAST_CHARGING_NUM_PERCENT_INDEX), tmp_rect_3, fill_addr, tmp_num_addr, logo_addr, phical_screen);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Show charging animation by version
|
|
*
|
|
*/
|
|
void fill_animation_battery_by_ver(int capacity, void *fill_addr, void *dec_logo_addr, void *logo_addr,
|
|
LCM_SCREEN_T phical_screen, int version)
|
|
{
|
|
if (MTK_LOG_ENABLE == 1)
|
|
{
|
|
SLOGD("[show_animation_common: %s %d]version : %d\n", __FUNCTION__, __LINE__, version);
|
|
}
|
|
switch (version)
|
|
{
|
|
case VERION_OLD_ANIMATION:
|
|
fill_animation_battery_old(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
break;
|
|
case VERION_NEW_ANIMATION:
|
|
fill_animation_battery_new(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
break;
|
|
case VERION_WIRELESS_CHARGING_ANIMATION:
|
|
fill_animation_battery_wireless_charging(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
break;
|
|
default:
|
|
fill_animation_battery_old(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
|
|
|
|
break;
|
|
}
|
|
}
|