RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUIDRV_Lin_Opt_32.h Source File

GUIDRV_Lin_Opt_32.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software has been licensed to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : GUIDRV_Lin_Opt_32.h
00040 Purpose     : Optimized routines, included by GUIDRV_Lin_..._32.c
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 /*********************************************************************
00045 *
00046 *       Static functions
00047 *
00048 **********************************************************************
00049 */
00050 /*********************************************************************
00051 *
00052 *       _FillRectOpt32
00053 *
00054 * Purpose:
00055 *   Optimized filling routine for 32 bpp
00056 */
00057 static void _FillRectOpt32(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1) {
00058   DRIVER_CONTEXT * pContext;
00059   register LCD_PIXELINDEX ColorIndex;
00060   U32 * pDest;
00061   U32 * pDest0;
00062   U32 Off, Off0, RemPixels, NumLines, RemLines, OffLine, RemItems;
00063   LCD_PIXELINDEX IndexMask;
00064 
00065   pContext  = (DRIVER_CONTEXT *)pDevice->u.pContext;
00066   RemPixels = x1 - x0 + 1;
00067   NumLines  = y1 - y0 + 1;
00068   OffLine   = pContext->vxSizePhys;
00069   pDest     = NULL;
00070   if (GUI_pContext->DrawMode & LCD_DRAWMODE_XOR) {
00071     IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
00072     Off0      = XY2OFF32(pContext->vxSizePhys, x0, y0);
00073     if (RemPixels) {
00074       for (RemLines = NumLines; RemLines; RemLines--) {
00075         RemItems = RemPixels;
00076         Off = Off0 + OffLine * (RemLines - 1);
00077         do {
00078           ColorIndex  = READ_MEM32(pContext->VRAMAddr, Off);
00079           ColorIndex ^= IndexMask;
00080           WRITE_MEM32(pContext->VRAMAddr, Off, ColorIndex);
00081           Off++;
00082         } while (--RemItems);
00083       }
00084     }
00085   } else {
00086     Off        = XY2OFF32(pContext->vxSizePhys, x0, y0);
00087     pDest0     = OFF2PTR32(pContext->VRAMAddr, Off);
00088     ColorIndex = LCD__GetColorIndex();
00089     if (RemPixels >= 16) {
00090       for (RemLines = NumLines; RemLines; RemLines--) {
00091         RemItems = RemPixels;
00092         pDest    = pDest0 + OffLine * (RemLines - 1);
00093         do {
00094           WRITE_MEM32P(pDest     , ColorIndex);
00095           WRITE_MEM32P(pDest +  1, ColorIndex);
00096           WRITE_MEM32P(pDest +  2, ColorIndex);
00097           WRITE_MEM32P(pDest +  3, ColorIndex);
00098           WRITE_MEM32P(pDest +  4, ColorIndex);
00099           WRITE_MEM32P(pDest +  5, ColorIndex);
00100           WRITE_MEM32P(pDest +  6, ColorIndex);
00101           WRITE_MEM32P(pDest +  7, ColorIndex);
00102           WRITE_MEM32P(pDest +  8, ColorIndex);
00103           WRITE_MEM32P(pDest +  9, ColorIndex);
00104           WRITE_MEM32P(pDest + 10, ColorIndex);
00105           WRITE_MEM32P(pDest + 11, ColorIndex);
00106           WRITE_MEM32P(pDest + 12, ColorIndex);
00107           WRITE_MEM32P(pDest + 13, ColorIndex);
00108           WRITE_MEM32P(pDest + 14, ColorIndex);
00109           WRITE_MEM32P(pDest + 15, ColorIndex);
00110           pDest     += 16;
00111           RemItems -= 16;
00112         } while (RemItems >= 16);
00113       }
00114       pDest0 = pDest;
00115       RemPixels -= (RemPixels >> 4) << 4;
00116     }
00117     if (RemPixels) {
00118       for (RemLines = NumLines; RemLines; RemLines--) {
00119         RemItems = RemPixels;
00120         pDest    = pDest0 + OffLine * (RemLines - 1);
00121         do {
00122           WRITE_MEM32P(pDest, ColorIndex);
00123           pDest++;
00124         } while (--RemItems);
00125       }
00126     }
00127   }
00128 }
00129 
00130 /*************************** End of file ****************************/