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

📄 lcd07x1.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
                  }
                } else {
                  while (y0 <= y1) {
                    SETPIXEL(x, y0, COLOR);
                    y0++;
                  }
                }
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          LCD_FillRect, no swap, optimized             *
                      *                                                       *
                      *********************************************************
              */
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 15  

              
              #if (!LCD_SWAP_XY) && (LCD_OPTIMIZE)
              
              static const U8 aStartMask[] = { 255, 255-1, 255-3, 255-7, 255-15, 255-31, 255-63, 255-127 };
              static const U8 aEndMask[] = { 1,3,7,15,31,63,127,255 };
              
              void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
                U8 MaskStart, MaskEnd;
                U8 Page, Page0, Page1;
                int x;
                #if LCD_MIRROR_X
                  #define X0 (LCD_XSIZE - 1 - x1)
                  #define X1 (LCD_XSIZE - 1 - x0)
                #else
                  #define X0 x0
                  #define X1 x1
                #endif
                #if LCD_MIRROR_Y
                  #define Y0 (LCD_YSIZE - 1 - y1)
                  #define Y1 (LCD_YSIZE - 1 - y0)
                #else
                  #define Y0 y0
                  #define Y1 y1
                #endif
                if ((LCD_DrawMode & LCD_DRAWMODE_XOR) ==0) {
                  MaskStart = aStartMask[Y0&7];
                  MaskEnd   = aEndMask[Y1&7];
                  Page0     = Y0>>3;
                  Page1     = Y1>>3;
                  for (Page =Page0; Page<= Page1; Page++) {
                    U8 Mask =0xff;
                    if (Page==Page0) {
                      Mask  = MaskStart;
                    }
                    if (Page==Page1) {
                      Mask &= MaskEnd;
                    }
                    for (x=X0; x<=X1; x++) {
                      U8 aData[2];
                      aData[0] = Cache[Page][x][0];
                      aData[1] = Cache[Page][x][1];
                      if (COLOR&(1<<1)) {
                        aData[0] |= Mask;
                      } else {
                        aData[0] &= ~Mask;
                      }
                      if (COLOR&(1<<0)) {
                        aData[1] |= Mask;
                      } else {
                        aData[1] &= ~Mask;
                      }
                      if (memcmp(&aData[0], &Cache[Page][x],2)) {
                        Cache[Page][x][0]      = aData[0];
                        Cache[Page][x][1]      = aData[1];
                        WRITE_VMEM_PAIR(Page, x, &aData[0]);
                      }
                    }
                  }
              /* ... */
                } else {
                  int x;
                  for (x=X0; x <= X1; x++) {
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 16  

                    LCD_L0_DrawVLine(x,Y0, Y1);
                  }
                }
                #undef X0
                #undef Y0
                #undef X1
                #undef Y1
              }
              
              /*
                      *********************************************************
                      *                                                       *
                      *          LCD_FillRect, unoptimized                    *
                      *                                                       *
                      *********************************************************
              */
              
              #else
              
              void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
                for (; y0 <= y1; y0++) {
                  LCD_L0_DrawHLine(x0,y0, x1);
                }
              }
              
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *    Support for dynamic inversion of entire LCD        *
                      *                                                       *
                      *********************************************************
              
              */
              
              #if LCD_REVERSEMODE_SUPPORT
              
              void LCD_SetNormalDispMode    (void) {
              }
              void LCD_SetReverseDispMode   (void) {
              }
              
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          Draw Bitmap 1 BPP                            *
                      *                                                       *
                      *********************************************************
              */
              
              static void  DrawBitLine1BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
                PIXELCOLOR pixels;
                PIXELCOLOR Index0 = *(pTrans+0);
                PIXELCOLOR Index1 = *(pTrans+1);
              /*
                 Jump to right entry point
              */
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 17  

                pixels = *p;
                switch (LCD_DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
                case 0:
                  #if defined (SETNEXTPIXEL)
                    SetPosXY(x,y);
                  #endif
                  switch (Diff&7) {
                  case 0:   
                    goto WriteBit0;
                  case 1:   
                    goto WriteBit1;
                  case 2:
                    goto WriteBit2;
                  case 3:
                    goto WriteBit3;
                  case 4:
                    goto WriteBit4;
                  case 5:   
                    goto WriteBit5;
                  case 6:   
                    goto WriteBit6;
                  case 7:   
                    goto WriteBit7;
                  }
                  break;
                case LCD_DRAWMODE_TRANS:
                  switch (Diff&7) {
                  case 0:
                    goto WriteTBit0;
                  case 1:
                    goto WriteTBit1;
                  case 2:
                    goto WriteTBit2;
                  case 3:
                    goto WriteTBit3;
                  case 4:
                    goto WriteTBit4;
                  case 5:   
                    goto WriteTBit5;
                  case 6:   
                    goto WriteTBit6;
                  case 7:   
                    goto WriteTBit7;
                  }
                  break;
                case LCD_DRAWMODE_XOR:
                  switch (Diff&7) {
                  case 0:   
                    goto WriteXBit0;
                  case 1:   
                    goto WriteXBit1;
                  case 2:
                    goto WriteXBit2;
                  case 3:
                    goto WriteXBit3;
                  case 4:
                    goto WriteXBit4;
                  case 5:   
                    goto WriteXBit5;
                  case 6:   
                    goto WriteXBit6;
                  case 7:   
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 18  

                    goto WriteXBit7;
                  }
                }
              /*
                      Write with transparency
              */
                WriteTBit0:
                  if (pixels&(1<<7)) SETPIXEL(x+0, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit1:
                  if (pixels&(1<<6)) SETPIXEL(x+1, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit2:
                  if (pixels&(1<<5)) SETPIXEL(x+2, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit3:
                  if (pixels&(1<<4)) SETPIXEL(x+3, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit4:
                  if (pixels&(1<<3)) SETPIXEL(x+4, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit5:
                  if (pixels&(1<<2)) SETPIXEL(x+5, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit6:
                  if (pixels&(1<<1)) SETPIXEL(x+6, y, Index1);
                  if (!--xsize)
                    return;
                WriteTBit7:
                  if (pixels&(1<<0)) SETPIXEL(x+7, y, Index1);
                  if (!--xsize)
                    return;
                  x+=8;
                  pixels = *(++p);
                  goto WriteTBit0;
              
              /*
                      Write without transparency
              */
              #if defined (SETNEXTPIXEL)   /* Optimization ! */
                WriteBit0:
                  SetNextPixel(x+0, y, (pixels&(1<<7)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                WriteBit1:
                  SetNextPixel(x+1, y, (pixels&(1<<6)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                WriteBit2:
                  SetNextPixel(x+2, y, (pixels&(1<<5)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                WriteBit3:
                  SetNextPixel(x+3, y, (pixels&(1<<4)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 19  

                WriteBit4:
                  SetNextPixel(x+4, y, (pixels&(1<<3)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                WriteBit5:
                  SetNextPixel(x+5, y, (pixels&(1<<2)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                WriteBit6:
                  SetNextPixel(x+6, y, (pixels&(1<<1)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                WriteBit7:
                  SetNextPixel(x+7, y, (pixels&(1<<0)) ? Index1 : Index0);
                  if (!--xsize)
                    return;
                  x+=8;
                  pixels = *(++p);

⌨️ 快捷键说明

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