Ejemplo n.º 1
0
static void  DrawBitLine1BPP(GUI_USAGE* pUsage, int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
  LCD_PIXELINDEX pixels;
  LCD_PIXELINDEX Index0 = *(pTrans+0);
  LCD_PIXELINDEX Index1 = *(pTrans+1);
  LCD_PIXELINDEX* pData;
  U8  PixelCnt;
  GUI_MEMDEV* pDev = GUI_MEMDEV_h2p(GUI_Context.hDevData);
  PixelCnt = 8- (Diff&7);
  pixels = (*p) << (Diff&7);
  pData = GUI_MEMDEV_XY2PTR(x,y);
  GUI_DEBUG_ERROROUT3_IF( x < pDev->x0, "GUIDEV.c: DrawBitLine1BPP, Act= %d, Border= %d, Clip= %d"
                    ,x,pDev->x0, GUI_Context.ClipRect.x0);
  switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
  case 0:    /* Write mode */
  PixelLoopWrite:
    if (PixelCnt>xsize)
      PixelCnt =xsize;
    xsize -= PixelCnt;
    do {
      *pData++ = (pixels&0x80) ? Index1 : Index0;
      pixels<<=1;
    } while (--PixelCnt);
    if (xsize) {
      PixelCnt=8;
      pixels = *(++p);
      goto PixelLoopWrite;
    }
    break;
  case LCD_DRAWMODE_TRANS:
  PixelLoopTrans:
    if (PixelCnt>xsize)
      PixelCnt =xsize;
    xsize -= PixelCnt;
    do {
      if ((pixels&0x80)) {
        if (pUsage)
          GUI_USAGE_AddPixel(pUsage, x,y);
        *pData = Index1;
      }
      x++;
      pData++;
      pixels<<=1;
    } while (--PixelCnt);
    if (xsize) {
      PixelCnt=8;
      pixels = *(++p);
      goto PixelLoopTrans;
    }
    break;
  case LCD_DRAWMODE_XOR:;
  PixelLoopXor:
    if (PixelCnt>xsize)
      PixelCnt =xsize;
    xsize -= PixelCnt;
    do {
      if ((pixels&0x80))
        *pData = pDev->NumColors - 1 - *pData;
      pData++;
      pixels<<=1;
    } while (--PixelCnt);
    if (xsize) {
      PixelCnt=8;
      pixels = *(++p);
      goto PixelLoopXor;
    }
    break;
  }
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       _DrawBitLine1BPP
*/
static void _DrawBitLine1BPP(GUI_USAGE* pUsage, int x, int y, const U8 GUI_UNI_PTR * p, int Diff, unsigned int xsize,
                             const LCD_PIXELINDEX* pTrans, GUI_MEMDEV* pDev, PIXELINDEX* pDest)
{
  PIXELINDEX Index1;
  PIXELINDEX IndexMask;
  unsigned pixels;
  unsigned PixelCnt;
  PixelCnt = 8 - Diff;
  pixels = LCD_aMirror[*p] >> Diff;

  GUI_DEBUG_ERROROUT3_IF( x < pDev->x0, "GUIDEV.c: DrawBitLine1BPP, Act= %d, Border= %d, Clip= %d", x,pDev->x0, GUI_Context.ClipRect.x0);

  switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
  case 0:    /* Write mode */
    do {
      /* Prepare loop */
      if (PixelCnt > xsize) {
        PixelCnt = xsize;
      }
      xsize -= PixelCnt;
      /* Write as many pixels as we are allowed to and have loaded in this inner loop */
      do {
        *pDest++ = *(pTrans + (pixels & 1));
        pixels >>= 1;
      } while (--PixelCnt);
      /* Check if an other Source byte needs to be loaded */
      if (xsize == 0) {
        return;
      }
      PixelCnt = 8;
      pixels = LCD_aMirror[*++p];
    } while (1);
  case LCD_DRAWMODE_TRANS:
    Index1 = *(pTrans + 1);
    do {
      /* Prepare loop */
      if (PixelCnt > xsize) {
        PixelCnt = xsize;
      }
      xsize -= PixelCnt;
      if (pUsage) {
        do {
          if (pixels == 0) {      /* Early out optimization; not required */
            pDest += PixelCnt;
            x     += PixelCnt;
            break;
          }
          if ((pixels & 1)) {
            GUI_USAGE_AddPixel(pUsage, x, y);
            *pDest = Index1;
          }
          x++;
          pDest++;
          if (--PixelCnt == 0) {
            break;
          }
          pixels >>= 1;
        } while (1);
      } else {
        do {
          if (pixels == 0) {      /* Early out optimization; not required */
            pDest += PixelCnt;
            break;
          }
          if ((pixels & 1)) {
            *pDest = Index1;
          }
          pDest++;
          if (--PixelCnt == 0) {
            break;
          }
          pixels >>= 1;
        } while (1);
      }
      /* Check if an other Source byte needs to be loaded */
      if (xsize == 0) {
        return;
      }
      PixelCnt = 8;
      pixels = LCD_aMirror[*(++p)];
    } while (1);
  case LCD_DRAWMODE_XOR:
    IndexMask = pDev->pfGetIndexMask();
    do {
      /* Prepare loop */
      if (PixelCnt > xsize) {
        PixelCnt = xsize;
      }
      xsize -= PixelCnt;
      /* Write as many pixels as we are allowed to and have loaded in this inner loop */
      do {
        if ((pixels & 1)) {
          *pDest ^= IndexMask;
        }
        *pDest++;
        pixels >>= 1;
      } while (--PixelCnt);
      /* Check if an other Source byte needs to be loaded */
      if (xsize == 0) {
        return;
      }
      PixelCnt = 8;
      pixels = LCD_aMirror[*(++p)];
    } while (1);
  }
Ejemplo n.º 3
0
static void  DrawBitLine2BPP(GUI_USAGE* pUsage, int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
  U8 pixels;
  U8  PixelCnt;
  LCD_PIXELINDEX* pData;
  PixelCnt = 4- (Diff&3);
  pixels = (*p) << ((Diff&3)<<1);
  pData = GUI_MEMDEV_XY2PTR(x,y);
  switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
  case 0:    /* Write mode */
  PixelLoopWrite:
    if (PixelCnt>xsize) {
      PixelCnt =xsize;
    }
    xsize -= PixelCnt;
    do {
      *pData++ = *(pTrans + (pixels>>6));
      pixels<<=2;
    } while (--PixelCnt);
    if (xsize) {
      PixelCnt=4;
      pixels = *(++p);
      goto PixelLoopWrite;
    }
    break;
  case LCD_DRAWMODE_TRANS:
  PixelLoopTrans:
    if (PixelCnt>xsize)
      PixelCnt =xsize;
    xsize -= PixelCnt;
    do {
      if (pixels&0xc0) {
        *pData = *(pTrans + (pixels>>6));
        GUI_USAGE_AddPixel(pUsage, x,y);
      }
      pData++;
      pixels<<=2;
    } while (--PixelCnt);
    if (xsize) {
      PixelCnt=4;
      pixels = *(++p);
      goto PixelLoopTrans;
    }
    break;
  case LCD_DRAWMODE_XOR:;
  PixelLoopXor:
    if (PixelCnt>xsize)
      PixelCnt =xsize;
    xsize -= PixelCnt;
    do {
      if ((pixels&0xc0))
        *pData ^= 255;
      pData++;
      pixels<<=2;
    } while (--PixelCnt);
    if (xsize) {
      PixelCnt=4;
      pixels = *(++p);
      goto PixelLoopXor;
    }
    break;
  }