• MTK 修改开进进入Recovery模式引导界面字体大小


      mtk 平板项目中由于默认使用的是8*16的点阵字体在显示中看起来明显偏小,因此使用24*48的字体显示比较大。

      需要修改的文件:

      1、 video_font.h

      更换对用宏定义

    #define MTK_VFC 256 //characters

    #define MTK_VFW 24 //width

    #define MTK_VFH 48 //height
    #define MTK_VFS (MTK_VFC * MTK_VFH *MTK_VFW/8) //size

    以及字库

    static unsigned char mtk_vdo_fntdata[MTK_VFS] = {};

      由于字库比较大就不直接粘贴出来,找对用的字库 风格即可,与单片机的使用类似。

      2、修改字体显示函数 mtk_cfb.c

      由于字体显示是相当于一个个点将点阵的数据输出到显示区域,原来的8*16的模式的函数不能正常使用,必须对应的修改,否则有可能不能使用。主要修改下列函数即可,我使用的平台使用的显示格式为CFB_565RGB_16BIT,故只需修改对应的case 即可。

    static void cfb_lk_dchars (int xx, int yy, unsigned char *s, int count)
    {
    unsigned char *pos = NULL;
    unsigned char *tdest = NULL;
    unsigned char *pdest = NULL;
    unsigned char *tdest_temp = NULL;
    unsigned char *pdest_temp = NULL;
    int row = 0;
    int col = 0;
    unsigned int data_fmt = 0;
    int offs = 0;

    pdest = cfb_fb_addrs + yy * LINE_LEN + xx * PIXEL_SIZE;
    data_fmt = DATA_FMT;

    switch (data_fmt)
    {

    case CFB_555RGB_15BIT:
    while (count--)
    {
    offs = (*s++) * MTK_VFH;
    pos = mtk_vdo_fntdata + offs;
    row = MTK_VFH;
    for (tdest = pdest;row--;tdest += LINE_LEN)
    {
    unsigned char bits = *pos++;
    ((unsigned int *) tdest)[0] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits >> 6] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[1] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits >> 4 & 3] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[2] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits >> 2 & 3] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[3] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits & 3] & cfb_eorx) ^ cfb_bgx);
    }
    pdest = pdest + MTK_VFW * PIXEL_SIZE;
    }
    break;
    // use case CFB_565RGB_16BIT
    case CFB_565RGB_16BIT:
    while (count--)
    {
    offs = (*s++) * MTK_VFH * MTK_VFW /8;
    pos = mtk_vdo_fntdata + offs;
    row = MTK_VFH;
    col = 3;
    pdest_temp = pos;
    int num= 0;// num++
    for (int i = 0 ,tdest = pdest;row--;tdest += LINE_LEN)
    {

    for(int j = 0,tdest_temp = tdest;j != col;tdest_temp +=16){
    unsigned char bits_tmp = *(pdest_temp + num);
    ((unsigned int *) tdest_temp)[0] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp >> 6] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest_temp)[1] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp >> 4 & 3] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest_temp)[2] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp >> 2 & 3] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest_temp)[3] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp & 3] & cfb_eorx) ^ cfb_bgx);
    num++;
    j++;
    }
    i++;
    }
    pdest = pdest + MTK_VFW * PIXEL_SIZE;
    }
    break;
    case CFB_332RGB_8BIT:
    case CFB_FMT_8BIT:
    while (count--)
    {
    offs = (*s++) * MTK_VFH;
    pos = mtk_vdo_fntdata + offs;
    row = MTK_VFH;
    for (tdest = pdest;row--;tdest += LINE_LEN)
    {
    unsigned char bits = *pos++;
    ((unsigned int *) tdest)[0] = (lk_cfb_font_dtable8[bits >> 4] & cfb_eorx) ^ cfb_bgx;
    ((unsigned int *) tdest)[1] = (lk_cfb_font_dtable8[bits & 15] & cfb_eorx) ^ cfb_bgx;
    }
    pdest = pdest + MTK_VFW * PIXEL_SIZE;
    }
    break;

    case CFB_888RGB_24BIT:
    while (count--)
    {
    offs = (*s++) * MTK_VFH;
    pos = mtk_vdo_fntdata + offs;
    row = MTK_VFH;
    for (tdest = pdest;row--;tdest += LINE_LEN)
    {
    unsigned char bits = *pos++;

    ((unsigned int *) tdest)[0] = (lk_cfb_font_dtb24[bits >> 4][0] & cfb_eorx) ^ cfb_bgx;
    ((unsigned int *) tdest)[1] = (lk_cfb_font_dtb24[bits >> 4][1] & cfb_eorx) ^ cfb_bgx;
    ((unsigned int *) tdest)[2] = (lk_cfb_font_dtb24[bits >> 4][2] & cfb_eorx) ^ cfb_bgx;
    ((unsigned int *) tdest)[3] = (lk_cfb_font_dtb24[bits & 15][0] & cfb_eorx) ^ cfb_bgx;
    ((unsigned int *) tdest)[4] = (lk_cfb_font_dtb24[bits & 15][1] & cfb_eorx) ^ cfb_bgx;
    ((unsigned int *) tdest)[5] = (lk_cfb_font_dtb24[bits & 15][2] & cfb_eorx) ^ cfb_bgx;
    }
    pdest = pdest + MTK_VFW * PIXEL_SIZE;
    }
    break;

    case CFB_X888RGB_32BIT:
    while (count--)
    {
    offs = (*s++) * MTK_VFH;
    pos = mtk_vdo_fntdata + offs;
    row = MTK_VFH;
    for (tdest = pdest;row--;tdest += LINE_LEN)
    {
    unsigned char bits = *pos++;

    ((unsigned int *) tdest)[0] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][0] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[1] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][1] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[2] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][2] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[3] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][3] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[4] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][0] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[5] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][1] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[6] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][2] & cfb_eorx) ^ cfb_bgx);
    ((unsigned int *) tdest)[7] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][3] & cfb_eorx) ^ cfb_bgx);
    }
    pdest = pdest + MTK_VFW * PIXEL_SIZE;
    }
    break;

    default:
    break;
    }

    }

      

  • 相关阅读:
    NOIP2015 D1 解题报告
    2017.10.2 国庆清北 D2T2 树上抢男主
    2017.10.6 国庆清北 D6T3 字符串
    2017.10.1 国庆清北 D1T2 两个逗比捉迷藏
    电压驱动和电流驱动
    电子管
    点亮板载LED
    ESP8266——一般控制方法
    ESP8266——CPU频率更改和深度睡眠模式
    ESP8266——ADC
  • 原文地址:https://www.cnblogs.com/atlas2016/p/7571999.html
Copyright © 2020-2023  润新知