亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? guicurs.c

?? ucCos移植到廣州友善nano2410
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/GUI
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : GUICurs.C
Purpose     : Cursor routines of the graphics library
---------------------------END-OF-HEADER------------------------------
*/

#include <stddef.h>           /* needed for definition of NULL */
#include "GUI_Private.h"

#if GUI_SUPPORT_CURSOR

/*********************************************************************
*
*       static data
*
**********************************************************************
*/

static GUI_HMEM          _hBuffer;
static GUI_RECT          _Rect;
static char              _CursorIsVis;        /* Currently visible ? */
static char              _CursorOn;
static const GUI_CURSOR GUI_UNI_PTR * _pCursor;
static U8                _CursorDeActCnt;
static int               _AllocSize;
static int               _x, _y;              /* Position of hot spot */
static GUI_RECT          _ClipRect;
static LCD_PIXELINDEX    _ColorIndex[4];      /* Color-Cache */

/*********************************************************************
*
*       static code, helper functions
*
**********************************************************************
*/
/*********************************************************************
*
*       _SetPixelIndex
*
* Purpose
*   Sets the pixel index for the Cursor.
*   Note the following:
*   - We do the clipping in this routine
*   - We do NOT call the driver directly, but thru its API table.
*     This allows others (e.g. the VNC server) to be in the loop-
*/
static void _SetPixelIndex(int x, int y, int Index) {
  if ((y >= _ClipRect.y0) && (y <= _ClipRect.y1)) {
    if ((x >= _ClipRect.x0) && (x <= _ClipRect.x1)) {
      LCD_aAPI[0]->pfSetPixelIndex(x, y, Index);
    }
  }
}

/*********************************************************************
*
*       _GetPixelIndex
*
* Purpose
*   Gets a pixel index for the Cursor.
*/
static int _GetPixelIndex(int x, int y) {
  if ((y >= _ClipRect.y0) && (y <= _ClipRect.y1)) {
    if ((x >= _ClipRect.x0) && (x <= _ClipRect.x1)) {
      return LCD_L0_GetPixelIndex(x, y);
    }
  }
  return 0;
}

/*********************************************************************
*
*       _Undraw
*
* Purpose
*   Remove the cursors
*/
static void _Undraw(void) {
  int x, y, xSize, ySize;
  LCD_PIXELINDEX* pData;
  /* Save bitmap data */
  GUI_LOCK();
  if (_hBuffer) {
    pData = (LCD_PIXELINDEX*)GUI_ALLOC_h2p(_hBuffer);
    xSize = _Rect.x1 - _Rect.x0 + 1;
    ySize = _Rect.y1 - _Rect.y0 + 1;
    for (y = 0; y < ySize; y++) {
      for (x = 0; x < xSize; x++) {
        _SetPixelIndex(x + _Rect.x0, y + _Rect.y0, *(pData + x));
      }
      pData += _pCursor->pBitmap->XSize;
    }
  }
  GUI_UNLOCK();
}

/*********************************************************************
*
*       _Log2Phys
*/
static int _Log2Phys(int Index) {
  if (Index < 4) {
    return _ColorIndex[Index];
  } else {
    LCD_COLOR Color = *(_pCursor->pBitmap->pPal->pPalEntries + Index);
    return LCD_Color2Index(Color);
  }
}

/*********************************************************************
*
*       _Draw
*/
static void _Draw(void) {
  int x, y, xSize, ySize;
  LCD_PIXELINDEX* pData;
  const GUI_BITMAP GUI_UNI_PTR * pBM;
  GUI_LOCK();
  if (_hBuffer) {
    /* Save bitmap data */
    pBM = _pCursor->pBitmap;
    pData = (LCD_PIXELINDEX*)GUI_ALLOC_h2p(_hBuffer);
    xSize = _Rect.x1 - _Rect.x0 + 1;
    ySize = _Rect.y1 - _Rect.y0 + 1;
    for (y = 0; y < ySize; y++) {
      for (x = 0; x < xSize; x++) {
        int BitmapPixel;
        *(pData + x) = _GetPixelIndex(_Rect.x0 + x, _Rect.y0 + y);
        BitmapPixel = GUI_GetBitmapPixelIndex(pBM, x, y);
        if (BitmapPixel) {
          _SetPixelIndex(_Rect.x0 + x, _Rect.y0 + y, _Log2Phys(BitmapPixel));
        }
      }
      pData += pBM->XSize;
    }
  }
  GUI_UNLOCK();
}

/*********************************************************************
*
*       _CalcRect
*/
static void _CalcRect(void) {
  if (_pCursor) {
    _Rect.x0 = _x - _pCursor->xHot;
    _Rect.y0 = _y - _pCursor->yHot;
    _Rect.x1 = _Rect.x0 + _pCursor->pBitmap->XSize - 1;
    _Rect.y1 = _Rect.y0 + _pCursor->pBitmap->YSize - 1;
  }
}

/*********************************************************************
*
*       _Hide
*/
static void _Hide(void) {
  if (_CursorIsVis) {
    _Undraw();
    _CursorIsVis = 0;
  }
}

/*********************************************************************
*
*       _Show
*/
static void _Show(void) {
  if (_CursorOn && (_CursorDeActCnt==0)) {
    _CursorIsVis = 1;
    _Draw();  
  }
}

/*********************************************************************
*
*       _TempHide
*
* Purpose:
*   Hide cursor if a part of the given rectangle is located in the
*   rectangle used for the cursor. This routine is called automatically
*   by the window manager. This way the window manager can
*   automatically make sure that the cursor is always displayed
*   correctly.
*
* Params:
*   pRect   Rectangle under consideration
*
* Return value:
*   0:      No action taken
*           Cursor was not visible or not affected because rectangles
*           did not overlap
*   1:      Cursor hidden -> WM needs to restore cursor after
*           drawing operation
*/
static char _TempHide(const GUI_RECT* pRect) {
  if (!_CursorIsVis) {
    return 0;             /* Cursor not visible -> nothing to do */
  }
  if ((pRect == NULL) || GUI_RectsIntersect(pRect, &_Rect)) {
    _Hide();              /* Cursor needs to be hidden */
    return 1;
  }
  return 0;               /* Cursor not affected -> nothing to do */
}

/*********************************************************************
*
*       _TempUnhide
*/
static void _TempUnhide(void) {
  _Show();
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       GUI_CURSOR_Activate
*/
void GUI_CURSOR_Activate(void) {
  GUI_LOCK();
  if ((--_CursorDeActCnt) ==0) {
    _Show();
  }
  GUI_UNLOCK();
}

/*********************************************************************
*
*       GUI_CURSOR_Deactivate
*/
void GUI_CURSOR_Deactivate(void) {
  GUI_LOCK();
  if (_CursorDeActCnt++ ==0)
    _Hide();
  GUI_UNLOCK();
}

/*********************************************************************
*
*       GUI_CURSOR_Select
*/
const GUI_CURSOR GUI_UNI_PTR * GUI_CURSOR_Select(const GUI_CURSOR GUI_UNI_PTR * pCursor) {
  int AllocSize;
  const GUI_BITMAP GUI_UNI_PTR * pBM;
  const GUI_CURSOR GUI_UNI_PTR * pOldCursor;
  GUI_LOCK();
  pOldCursor = _pCursor;
  if (pCursor != _pCursor) {
    int i;
    pBM = pCursor->pBitmap;
    i = pBM->pPal->NumEntries > 4 ? 4 : pBM->pPal->NumEntries;
    while (i--) {
      LCD_COLOR Color = *(pBM->pPal->pPalEntries + i);
      _ColorIndex[i] = LCD_Color2Index(Color);
    }
    _Hide();
    AllocSize = pBM->XSize * pBM->YSize * sizeof(LCD_PIXELINDEX);
    if (AllocSize != _AllocSize) {
      GUI_ALLOC_Free(_hBuffer);
      _hBuffer = 0;
    }
    _hBuffer = GUI_ALLOC_AllocZero(AllocSize);
    _CursorOn = 1;
    _pCursor = pCursor;
    _CalcRect();
    _Show();
  }
  GUI_UNLOCK();
  return pOldCursor;
}

/*********************************************************************
*
*       GUI_CURSOR_Hide
*/
void GUI_CURSOR_Hide(void) {
  GUI_LOCK();
  _Hide();
  _CursorOn = 0;
  /* Set function pointer which window manager can use */
  GUI_CURSOR_pfTempHide   = NULL;
  GUI_CURSOR_pfTempUnhide = NULL;
  GUI_UNLOCK();
}

/*********************************************************************
*
*       GUI_CURSOR_Show
*/
void GUI_CURSOR_Show(void) {
  GUI_LOCK();
  LCDDEV_L0_GetRect(&_ClipRect);
  _Hide();
  _CursorOn = 1;
  /* Set function pointer which window manager can use */
  GUI_CURSOR_pfTempHide   = _TempHide;
  GUI_CURSOR_pfTempUnhide = _TempUnhide;
  if (!_pCursor) {
    GUI_CURSOR_Select(GUI_DEFAULT_CURSOR);
  } else {
    _Show();
  }
  GUI_UNLOCK();
}

/*********************************************************************
*
*       GUI_CURSOR_SetPosition
*/
void GUI_CURSOR_SetPosition(int xNewPos, int yNewPos) {
  int x, xStart, xStep, xEnd, xOff, xOverlapMin, xOverlapMax;
  int y, yStart, yStep, yEnd, yOff, yOverlapMin, yOverlapMax;
  int xSize;
  LCD_PIXELINDEX* pData;
  GUI_LOCK();
  if (_hBuffer) {
    if ((_x != xNewPos) | (_y != yNewPos)) {
      if (_CursorOn) {
        const GUI_BITMAP GUI_UNI_PTR * pBM = _pCursor->pBitmap;
        /* Save & set clip rect */
        /* Compute helper variables */
        pData = (LCD_PIXELINDEX*)GUI_ALLOC_h2p(_hBuffer);
        xSize = _pCursor->pBitmap->XSize;
        xOff = xNewPos - _x;
        if (xOff > 0) {
          xStep  = 1;
          xStart = 0;
          xEnd   = _pCursor->pBitmap->XSize;
          xOverlapMax = xEnd -1;
          xOverlapMin = xOff;
        } else {
          xStep  = -1;
          xStart = xSize - 1;
          xEnd   = -1;
          xOverlapMin = 0;
          xOverlapMax = xStart + xOff;
        }
        yOff = yNewPos - _y;
        if (yOff > 0) {
          yStep  = 1;
          yStart = 0;
          yEnd   = _pCursor->pBitmap->YSize;
          yOverlapMax = yEnd -1;
          yOverlapMin = yOff;
        } else {
          yStep  = -1;
          yStart = _pCursor->pBitmap->YSize - 1;
          yEnd   = -1;
          yOverlapMin = 0;
          yOverlapMax = yStart + yOff;
        }
        /* Restore & Draw */
        for (y = yStart; y != yEnd; y += yStep) {
          char yOverlaps;
          char yNewOverlaps;
          int yNew = y + yOff;
          yOverlaps    = (y >= yOverlapMin) && (y <= yOverlapMax);
          yNewOverlaps = (yNew >= yOverlapMin) && (yNew <= yOverlapMax);
          for (x= xStart; x != xEnd; x += xStep) {
            char xyOverlaps, xyNewOverlaps;
            int BitmapPixel;
            LCD_PIXELINDEX Pixel;
            LCD_PIXELINDEX* pSave = pData + x + y * xSize;
            int xNew = x + xOff;
            BitmapPixel = GUI_GetBitmapPixelIndex(pBM, x, y);
            xyOverlaps    = (x    >= xOverlapMin) && (x    <= xOverlapMax) && yOverlaps;
            xyNewOverlaps = (xNew >= xOverlapMin) && (xNew <= xOverlapMax) && yNewOverlaps;
            /* Restore old pixel if it was not transparent */
            if (BitmapPixel) {
              if (!xyOverlaps || (GUI_GetBitmapPixelIndex(pBM, x - xOff, y - yOff) == 0)) {
                _SetPixelIndex(x + _Rect.x0, y + _Rect.y0, *(pSave));
              }
            }
            /* Save */
            if (xyNewOverlaps) {
              Pixel = *(pData + xNew + yNew * xSize);
            } else {
              Pixel = _GetPixelIndex(_Rect.x0 + xNew, _Rect.y0 + yNew);
            }
            *pSave = Pixel;
            /* Write new  ... We could write pixel by pixel here */
            if (BitmapPixel) {
              LCD_PIXELINDEX NewPixel = _Log2Phys(BitmapPixel);
              _SetPixelIndex(_Rect.x0 + xNew, _Rect.y0 + yNew, NewPixel);
            }
          }
        }
      }
      _x = xNewPos;
      _y = yNewPos;
      _CalcRect();
    }
  }
  GUI_UNLOCK();
}

#else

void GUICurs_C(void);
void GUICurs_C(void) {} /* avoid empty object files */

#endif   /* GUI_SUPPORT_CURSOR */

/*************************** End of file ****************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品456露脸| 欧美视频完全免费看| aaa欧美色吧激情视频| 在线亚洲欧美专区二区| 欧美一区日韩一区| 中文字幕+乱码+中文字幕一区| 亚洲精品亚洲人成人网在线播放| 亚洲线精品一区二区三区| 日本三级亚洲精品| 成人看片黄a免费看在线| 欧美日韩一区二区在线视频| 欧美不卡123| 一区2区3区在线看| 国产一区二区三区精品欧美日韩一区二区三区| av在线一区二区| 日韩一区二区电影在线| 国产精品久久综合| 蜜臀av一区二区在线观看 | 日韩一区二区在线看片| 国产欧美日本一区二区三区| 午夜成人在线视频| 成人午夜精品在线| 日韩一区二区免费高清| 亚洲视频免费在线观看| 精品一区二区三区香蕉蜜桃| 欧美自拍偷拍一区| 国产欧美日韩在线| 日韩和的一区二区| 日本韩国欧美国产| 国产日产欧美一区| 久久99这里只有精品| 国产综合久久久久久久久久久久| 91黄视频在线| 1024成人网| 欧美性色欧美a在线播放| 久久久久88色偷偷免费 | 免费的国产精品| 99国产欧美久久久精品| 久久影院视频免费| 久久成人av少妇免费| 欧美午夜精品理论片a级按摩| 国产精品理论片| 亚洲风情在线资源站| 国产91精品久久久久久久网曝门| 欧美乱妇20p| 亚洲精品免费看| www.亚洲在线| 久久嫩草精品久久久久| 七七婷婷婷婷精品国产| 91黄色免费版| 亚洲欧美日韩在线播放| 国产高清无密码一区二区三区| 欧美一区午夜视频在线观看 | 国产传媒久久文化传媒| 欧美精品一卡两卡| 一区二区三区不卡视频| av在线一区二区三区| 国产精品视频线看| 国产福利一区二区三区视频在线 | 精品中文av资源站在线观看| 欧美日韩免费一区二区三区视频 | 在线观看日韩一区| 亚洲激情图片qvod| 日本精品视频一区二区| 亚洲女子a中天字幕| 91啪在线观看| 综合av第一页| 99视频有精品| 亚洲天堂久久久久久久| 99久久精品国产精品久久 | 欧洲激情一区二区| 亚洲一区电影777| 91官网在线免费观看| 又紧又大又爽精品一区二区| 91社区在线播放| 亚洲一区视频在线观看视频| 欧美性色黄大片| 五月婷婷欧美视频| 欧美一区二区免费| 亚洲综合色成人| 久久久久综合网| 日韩免费看的电影| 国产日韩欧美电影| 欧美日韩一卡二卡三卡| 国内欧美视频一区二区| 国产综合久久久久久久久久久久 | av福利精品导航| 亚洲国产视频一区二区| 国产精品免费视频一区| 4438x亚洲最大成人网| 成人午夜av电影| av男人天堂一区| 亚洲另类色综合网站| 91福利在线免费观看| 亚洲一卡二卡三卡四卡无卡久久| 欧美少妇一区二区| 麻豆极品一区二区三区| 久久久久高清精品| 91片在线免费观看| 午夜久久久久久久久| 欧美videos中文字幕| 国产成人亚洲综合a∨婷婷| 国产精品女主播av| 91黄色免费看| 美国十次综合导航| 中文字幕第一区| 欧美日韩专区在线| 精品写真视频在线观看| 国产精品免费视频观看| 欧美日韩国产中文| 国产在线精品国自产拍免费| 18欧美亚洲精品| 欧美一区二区三区色| 国产精品99久久久久久宅男| 亚洲美女屁股眼交| 91精品免费在线观看| 国产成人精品免费| 亚洲高清一区二区三区| 日韩色视频在线观看| 成人avav在线| 日韩国产精品久久| 国产精品伦理在线| 91精品国产福利| 91免费视频观看| 精品一区二区在线播放| 一区二区久久久久久| 精品少妇一区二区三区免费观看| www.性欧美| 日韩av在线免费观看不卡| 国产亲近乱来精品视频| 欧美日韩亚洲另类| 国产91富婆露脸刺激对白| 日韩专区欧美专区| 亚洲欧美日韩精品久久久久| www国产成人免费观看视频 深夜成人网 | 大尺度一区二区| 日本少妇一区二区| 亚洲综合激情小说| 国产精品乱人伦一区二区| 日韩精品一区二区三区老鸭窝| 91免费在线播放| 欧美福利视频一区| 日韩电影免费在线| 国产精品一区二区黑丝| 色婷婷亚洲综合| 午夜精品一区在线观看| 国产乱子伦视频一区二区三区 | 精品欧美一区二区在线观看 | 美女视频黄 久久| 亚洲国产精品精华液2区45| 日韩欧美国产综合| 欧美日韩性生活| 色综合久久中文字幕综合网| 国产激情精品久久久第一区二区 | 日韩你懂的电影在线观看| 一本大道久久a久久综合婷婷 | 国产精品福利电影一区二区三区四区| 欧美精品久久一区| 欧美综合欧美视频| 在线一区二区观看| 99riav久久精品riav| 成人小视频在线| 国产在线看一区| 狠狠色丁香久久婷婷综合丁香| 日韩经典一区二区| 爽好久久久欧美精品| 亚洲一区二区三区中文字幕在线| 中文字幕av一区二区三区免费看| 久久精品网站免费观看| xvideos.蜜桃一区二区| 精品久久免费看| 日韩一级片网址| 日韩欧美国产精品一区| 日韩一区二区三区高清免费看看| 欧美日韩免费观看一区二区三区| 色菇凉天天综合网| 色婷婷综合久久久中文一区二区| 不卡一区二区中文字幕| 成人黄动漫网站免费app| 丁香另类激情小说| 成人动漫一区二区在线| 国产麻豆成人传媒免费观看| 国产麻豆日韩欧美久久| 国产高清视频一区| 丁香婷婷综合色啪| 成人av在线电影| 97se亚洲国产综合自在线观| eeuss国产一区二区三区| 91视视频在线直接观看在线看网页在线看| av亚洲精华国产精华精| 91久久久免费一区二区| 在线看国产一区| 欧美日韩黄色一区二区| 欧美一区午夜视频在线观看 | 国产91精品一区二区麻豆网站| 国产精品一区二区久久精品爱涩 | 天天影视色香欲综合网老头| 欧美日韩国产综合久久| 在线日韩av片| 91首页免费视频|