NXP
/
rt1050_emwin_gui_demo
RT1050 GUI demo using emWin library
Embed:
(wiki syntax)
Show/hide line numbers
GUIDRV_Lin_Opt_16.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_16.h 00040 Purpose : Optimized routines, included by GUIDRV_Lin_..._16.c 00041 ---------------------------END-OF-HEADER------------------------------ 00042 */ 00043 00044 /********************************************************************* 00045 * 00046 * Static functions 00047 * 00048 ********************************************************************** 00049 */ 00050 /********************************************************************* 00051 * 00052 * _FillRectOpt16 00053 * 00054 * Purpose: 00055 * Optimized filling routine for 16 bpp 00056 */ 00057 static void _FillRectOpt16(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1) { 00058 DRIVER_CONTEXT * pContext; 00059 U32 * pDest; 00060 U32 * pDest0; 00061 U32 Off, OffLine; 00062 int RemPixels, NumLines, RemLines, RemItems; 00063 U32 Data, ColorMask; 00064 LCD_PIXELINDEX ColorIndex; 00065 00066 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; 00067 ColorIndex = LCD__GetColorIndex(); 00068 Off = XY2OFF32(pContext->vxSizePhys, x0, y0); 00069 pDest0 = OFF2PTR32(pContext->VRAMAddr, Off); 00070 RemPixels = x1 - x0 + 1; 00071 NumLines = y1 - y0 + 1; 00072 OffLine = pContext->vxSizePhys >> 1; 00073 pDest = NULL; 00074 if (GUI_pContext->DrawMode & LCD_DRAWMODE_XOR) { 00075 // 00076 // First DWORD 00077 // 00078 if (x0 & 1) { 00079 for (RemLines = NumLines, pDest = pDest0; RemLines; RemLines--) { 00080 Data = READ_MEM32P(pDest); 00081 #if (LCD_ENDIAN_BIG == 0) 00082 Data ^= 0xFFFF0000; 00083 #else 00084 Data ^= 0xFFFF; 00085 #endif 00086 WRITE_MEM32P(pDest, Data); 00087 pDest += OffLine; 00088 } 00089 pDest0++; 00090 RemPixels--; 00091 } 00092 // 00093 // Complete DWORDS 00094 // 00095 if (RemPixels >= 2) { 00096 for (RemLines = NumLines; RemLines; RemLines--) { 00097 RemItems = RemPixels; 00098 pDest = pDest0 + OffLine * (RemLines - 1); 00099 do { 00100 Data = READ_MEM32P(pDest); 00101 Data ^= 0xFFFFFFFF; 00102 WRITE_MEM32P(pDest, Data); 00103 pDest++; 00104 RemItems -= 2; 00105 } while (RemItems >= 2); 00106 } 00107 pDest0 = pDest; 00108 RemPixels -= (RemPixels >> 1) << 1; 00109 } 00110 // 00111 // Last DWORD 00112 // 00113 if (RemPixels > 0) { 00114 for (RemLines = NumLines, pDest = pDest0; RemLines; RemLines--) { 00115 Data = READ_MEM32P(pDest); 00116 #if (LCD_ENDIAN_BIG == 0) 00117 Data ^= 0xFFFF; 00118 #else 00119 Data ^= 0xFFFF0000; 00120 #endif 00121 WRITE_MEM32P(pDest, Data); 00122 pDest += OffLine; 00123 } 00124 } 00125 } else { 00126 // 00127 // First DWORD 00128 // 00129 if (x0 & 1) { 00130 for (RemLines = NumLines, pDest = pDest0; RemLines; RemLines--) { 00131 Data = READ_MEM32P(pDest); 00132 #if (LCD_ENDIAN_BIG == 0) 00133 Data &= 0xFFFF; 00134 Data |= (((U32)ColorIndex) << 16); 00135 #else 00136 Data &= 0xFFFF0000; 00137 Data |= ColorIndex; 00138 #endif 00139 WRITE_MEM32P(pDest, Data); 00140 pDest += OffLine; 00141 } 00142 pDest0++; 00143 RemPixels--; 00144 } 00145 // 00146 // Complete DWORDS 00147 // 00148 ColorMask = ColorIndex * 0x00010001; 00149 if (RemPixels >= 16) { 00150 RemPixels -= 16; 00151 00152 for (RemLines = NumLines; RemLines; RemLines--) { 00153 RemItems = RemPixels; 00154 pDest = pDest0 + OffLine * (RemLines - 1); 00155 do { 00156 WRITE_MEM32P(pDest, ColorMask); 00157 WRITE_MEM32P(pDest + 1, ColorMask); 00158 WRITE_MEM32P(pDest + 2, ColorMask); 00159 WRITE_MEM32P(pDest + 3, ColorMask); 00160 WRITE_MEM32P(pDest + 4, ColorMask); 00161 WRITE_MEM32P(pDest + 5, ColorMask); 00162 WRITE_MEM32P(pDest + 6, ColorMask); 00163 WRITE_MEM32P(pDest + 7, ColorMask); 00164 pDest += 8; 00165 RemItems -= 16; 00166 } while (RemItems >= 0); 00167 } 00168 pDest0 = pDest; 00169 00170 RemPixels += 16; 00171 RemPixels -= (RemPixels >> 4) << 4; 00172 } 00173 if (RemPixels >= 2) { 00174 for (RemLines = NumLines; RemLines; RemLines--) { 00175 RemItems = RemPixels; 00176 pDest = pDest0 + OffLine * (RemLines - 1); 00177 do { 00178 WRITE_MEM32P(pDest, ColorMask); 00179 pDest++; 00180 RemItems -= 2; 00181 } while (RemItems >= 2); 00182 } 00183 pDest0 = pDest; 00184 RemPixels -= (RemPixels >> 1) << 1; 00185 } 00186 // 00187 // Last DWORD 00188 // 00189 if (RemPixels > 0) { 00190 for (RemLines = NumLines, pDest = pDest0; RemLines; RemLines--) { 00191 Data = READ_MEM32P(pDest); 00192 #if (LCD_ENDIAN_BIG == 0) 00193 Data &= 0xFFFF0000; 00194 Data |= ColorIndex; 00195 #else 00196 Data &= 0xFFFF; 00197 Data |= (((U32)ColorIndex) << 16); 00198 #endif 00199 WRITE_MEM32P(pDest, Data); 00200 pDest += OffLine; 00201 } 00202 } 00203 } 00204 } 00205 00206 /*************************** End of file ****************************/
Generated on Tue Jul 12 2022 19:43:36 by 1.7.2