⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcdp0.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
字号:
C51 COMPILER V8.05a   LCDP0                                                                04/11/2008 14:18:23 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE LCDP0
OBJECT MODULE PLACED IN LCDP0.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\ConvertMono\LCDP0.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXT
                    -END PRINT(.\LCDP0.lst) OBJECT(LCDP0.obj)

line level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                                uC/GUI
   4          *                        Universal graphic software for embedded applications
   5          *
   6          *                       (c) Copyright 2002, Micrium Inc., Weston, FL
   7          *                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
   8          *
   9          *              礐/GUI is protected by international copyright laws. Knowledge of the
  10          *              source code may not be used to write a similar product. This file may
  11          *              only be used in accordance with a license and should not be redistributed
  12          *              in any way. We appreciate your understanding and fairness.
  13          *
  14          ----------------------------------------------------------------------
  15          File        : LCDP0.C
  16          Purpose     : Color conversion routines for LCD-drivers
  17          ---------------------------END-OF-HEADER------------------------------
  18          */
  19          
  20          #include <stdlib.h>
  21          #include "gui\Core\LCD_Protected.h"    /* inter modul definitions */
  22          
  23          /*
  24                  *********************************************************
  25                  *                                                       *
  26                  *       calculation macros and support                  *
  27                  *                                                       *
  28                  *********************************************************
  29          */
  30          #if 1  /* Normaly calculate square values */
  31            #define  SQUARE(Dist) ((U16)Dist) * ((U16)Dist)
  32          #else
              
              #define S(x) ((x)*(x))
              #define SQUARES(Base)  S(Base+0),  S(Base+1),  S(Base+2),  S(Base+3), S(Base+4),  S(Base+5),   \
                                     S(Base+6),  S(Base+7),  S(Base+8),  S(Base+9), S(Base+10), S(Base+11), \
                                     S(Base+12), S(Base+13), S(Base+14), S(Base+15)
              
              static const U16 aSquare[] = {
                SQUARES(0*16)
                ,SQUARES(1*16), SQUARES(2*16), SQUARES(3*16)
                ,SQUARES(4*16) ,SQUARES(5*16), SQUARES(6*16), SQUARES(7*16)
                ,SQUARES(8*16) ,SQUARES(9*16), SQUARES(10*16),SQUARES(11*16)
                ,SQUARES(12*16),SQUARES(13*16),SQUARES(14*16),SQUARES(15*16)
              };
              
                #define  SQUARE(Dist) aSquare[Dist]
              #endif
  49          
  50          /*
  51                  *********************************************************
  52                  *                                                       *
  53                  *       Color conversions for palette based displays    *
  54                  *                                                       *
C51 COMPILER V8.05a   LCDP0                                                                04/11/2008 14:18:23 PAGE 2   

  55                  *********************************************************
  56          */
  57          
  58          static U32 CalcColorDist (LCD_COLOR PalColor, LCD_COLOR  Color) {
  59   1      /* This routine does not use abs() because we are optimizing for speed ! */
  60   1        I16 Dist;
  61   1        U32 Sum;
  62   1        Dist  = (PalColor&0xff) - (Color&0xff);
  63   1        if (Dist < 0)
  64   1                Dist = -Dist;
  65   1        Sum = SQUARE(Dist);
  66   1        Dist  = ((PalColor>>8)&0xff) -  ((Color>>8)&0xff);
  67   1        if (Dist < 0)
  68   1                Dist = -Dist;
  69   1        Sum += SQUARE(Dist);
  70   1        Dist  = (PalColor>>16) - (Color>>16);
  71   1        if (Dist < 0)
  72   1                Dist = -Dist;
  73   1        return Sum + SQUARE(Dist);
  74   1      }
  75          
  76          
  77            /*
  78                    *********************************************************
  79                    *                                                       *
  80                    *   Color conversions for 1/2/4/8 bpp color displays    *
  81                    *                                                       *
  82                    *              with table based palette                 *
  83                    *                                                       *
  84                    *********************************************************
  85            */
  86          
  87            int LCD_Color2Index_0(LCD_COLOR Color, const LCD_PHYSPALETTE* pPhysPal) {
  88   1          int i;
  89   1          int NumEntries = pPhysPal->NumEntries;
  90   1          int BestIndex;
  91   1          U32 BestDiff = 0xffffff; /* Initialize to worst match */
  92   1          const LCD_COLOR* pPalEntry;
  93   1      /* Try to find perfect match */
  94   1          i=0; pPalEntry = &pPhysPal->pPalEntries[0];
  95   1          do {
  96   2                  if (Color==*(pPalEntry+i))
  97   2                    return i;
  98   2          } while (++i<NumEntries);
  99   1      /* Find best match */
 100   1          i=0; pPalEntry = &pPhysPal->pPalEntries[0];
 101   1          do {
 102   2            U32 Diff = CalcColorDist (Color, *(pPalEntry+i));
 103   2            if (Diff < BestDiff) {
 104   3              BestDiff  = Diff;
 105   3              BestIndex = i;
 106   3            }
 107   2          } while (++i<NumEntries);
 108   1          return BestIndex;
 109   1        }
 110          
 111            LCD_COLOR LCD_Index2Color_0(int Index, const LCD_PHYSPALETTE* pPhysPal) {
 112   1          if ((unsigned)Index >= (unsigned) pPhysPal->NumEntries) {
 113   2            return 0;     /* Illegal index */
 114   2          }
 115   1          return *(pPhysPal->pPalEntries+Index);
 116   1        }
C51 COMPILER V8.05a   LCDP0                                                                04/11/2008 14:18:23 PAGE 3   

 117          
 118          
 119          
 120          
 121          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    773    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----      40
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -