Headers for emWin lib

Dependents:   DISCO-F746NG_rtos_test

Committer:
redbird
Date:
Sat Mar 26 22:49:50 2016 +0000
Revision:
0:1bf8f02b0770
new code integration

Who changed what in which revision?

UserRevisionLine numberNew contents of line
redbird 0:1bf8f02b0770 1 /*********************************************************************
redbird 0:1bf8f02b0770 2 * SEGGER Microcontroller GmbH & Co. KG *
redbird 0:1bf8f02b0770 3 * Solutions for real time microcontroller applications *
redbird 0:1bf8f02b0770 4 **********************************************************************
redbird 0:1bf8f02b0770 5 * *
redbird 0:1bf8f02b0770 6 * (c) 1996 - 2014 SEGGER Microcontroller GmbH & Co. KG *
redbird 0:1bf8f02b0770 7 * *
redbird 0:1bf8f02b0770 8 * Internet: www.segger.com Support: support@segger.com *
redbird 0:1bf8f02b0770 9 * *
redbird 0:1bf8f02b0770 10 **********************************************************************
redbird 0:1bf8f02b0770 11
redbird 0:1bf8f02b0770 12 ** emWin V5.24 - Graphical user interface for embedded applications **
redbird 0:1bf8f02b0770 13 All Intellectual Property rights in the Software belongs to SEGGER.
redbird 0:1bf8f02b0770 14 emWin is protected by international copyright laws. Knowledge of the
redbird 0:1bf8f02b0770 15 source code may not be used to write a similar product. This file may
redbird 0:1bf8f02b0770 16 only be used in accordance with the following terms:
redbird 0:1bf8f02b0770 17
redbird 0:1bf8f02b0770 18 The software has been licensed to NXP Semiconductors USA, Inc. whose
redbird 0:1bf8f02b0770 19 registered office is situated at 411 E. Plumeria Drive, San Jose,
redbird 0:1bf8f02b0770 20 CA 95134, USA solely for the purposes of creating libraries for
redbird 0:1bf8f02b0770 21 NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and
redbird 0:1bf8f02b0770 22 distributed under the terms and conditions of the NXP End User License
redbird 0:1bf8f02b0770 23 Agreement.
redbird 0:1bf8f02b0770 24 Full source code is available at: www.segger.com
redbird 0:1bf8f02b0770 25
redbird 0:1bf8f02b0770 26 We appreciate your understanding and fairness.
redbird 0:1bf8f02b0770 27 ----------------------------------------------------------------------
redbird 0:1bf8f02b0770 28 File : GUI_SetOrientationC0.c
redbird 0:1bf8f02b0770 29 Purpose : Runtime display orientation without cache
redbird 0:1bf8f02b0770 30 ---------------------------END-OF-HEADER------------------------------
redbird 0:1bf8f02b0770 31 */
redbird 0:1bf8f02b0770 32
redbird 0:1bf8f02b0770 33 #include "GUI_SetOrientation.h"
redbird 0:1bf8f02b0770 34
redbird 0:1bf8f02b0770 35 /*********************************************************************
redbird 0:1bf8f02b0770 36 *
redbird 0:1bf8f02b0770 37 * Defines
redbird 0:1bf8f02b0770 38 *
redbird 0:1bf8f02b0770 39 **********************************************************************
redbird 0:1bf8f02b0770 40 */
redbird 0:1bf8f02b0770 41 #define XY2PTR(x, y) (PIXEL *)(pContext->pData + y * pContext->BytesPerLine + x * pContext->pDrawingAPI->BytesPerPixel)
redbird 0:1bf8f02b0770 42
redbird 0:1bf8f02b0770 43 #ifdef __cplusplus
redbird 0:1bf8f02b0770 44 extern "C" {
redbird 0:1bf8f02b0770 45 #endif
redbird 0:1bf8f02b0770 46
redbird 0:1bf8f02b0770 47 /*********************************************************************
redbird 0:1bf8f02b0770 48 *
redbird 0:1bf8f02b0770 49 * Static code
redbird 0:1bf8f02b0770 50 *
redbird 0:1bf8f02b0770 51 **********************************************************************
redbird 0:1bf8f02b0770 52 */
redbird 0:1bf8f02b0770 53 /*********************************************************************
redbird 0:1bf8f02b0770 54 *
redbird 0:1bf8f02b0770 55 * Static code
redbird 0:1bf8f02b0770 56 *
redbird 0:1bf8f02b0770 57 **********************************************************************
redbird 0:1bf8f02b0770 58 */
redbird 0:1bf8f02b0770 59 /*********************************************************************
redbird 0:1bf8f02b0770 60 *
redbird 0:1bf8f02b0770 61 * _Sort
redbird 0:1bf8f02b0770 62 *
redbird 0:1bf8f02b0770 63 * Purpose:
redbird 0:1bf8f02b0770 64 * Sorts the values pointed by the given pointers. Please note that
redbird 0:1bf8f02b0770 65 * the same static function is also in GUI_SetOrientationC0.h
redbird 0:1bf8f02b0770 66 * to enable better compiler optimization.
redbird 0:1bf8f02b0770 67 */
redbird 0:1bf8f02b0770 68 static void _Sort(int * p0, int * p1) {
redbird 0:1bf8f02b0770 69 int temp;
redbird 0:1bf8f02b0770 70
redbird 0:1bf8f02b0770 71 if (*p0 > *p1) {
redbird 0:1bf8f02b0770 72 temp = *p0;
redbird 0:1bf8f02b0770 73 *p0 = *p1;
redbird 0:1bf8f02b0770 74 *p1 = temp;
redbird 0:1bf8f02b0770 75 }
redbird 0:1bf8f02b0770 76 }
redbird 0:1bf8f02b0770 77
redbird 0:1bf8f02b0770 78 /*********************************************************************
redbird 0:1bf8f02b0770 79 *
redbird 0:1bf8f02b0770 80 * Static code: Bitmap drawing routines
redbird 0:1bf8f02b0770 81 *
redbird 0:1bf8f02b0770 82 **********************************************************************
redbird 0:1bf8f02b0770 83 */
redbird 0:1bf8f02b0770 84 /*********************************************************************
redbird 0:1bf8f02b0770 85 *
redbird 0:1bf8f02b0770 86 * Draw Bitmap 1 BPP
redbird 0:1bf8f02b0770 87 */
redbird 0:1bf8f02b0770 88 static void _DrawBitLine1BPP(GUI_DEVICE * pDevice, unsigned x, unsigned y, U8 const * p, int Diff, int xsize, const LCD_PIXELINDEX * pTrans) {
redbird 0:1bf8f02b0770 89 LCD_PIXELINDEX IndexMask, Index0, Index1, Pixel;
redbird 0:1bf8f02b0770 90 unsigned (* pfGetPixelIndex)(GUI_DEVICE *, int, int);
redbird 0:1bf8f02b0770 91 PIXEL * pData;
redbird 0:1bf8f02b0770 92 int x_phys, y_phys;
redbird 0:1bf8f02b0770 93 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 94
redbird 0:1bf8f02b0770 95 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 96 Index0 = *(pTrans + 0);
redbird 0:1bf8f02b0770 97 Index1 = *(pTrans + 1);
redbird 0:1bf8f02b0770 98 x += Diff;
redbird 0:1bf8f02b0770 99 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 100 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 101 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
redbird 0:1bf8f02b0770 102 case 0:
redbird 0:1bf8f02b0770 103 do {
redbird 0:1bf8f02b0770 104 *pData = (PIXEL)(*p & (0x80 >> Diff)) ? Index1 : Index0;
redbird 0:1bf8f02b0770 105 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 106 if (++Diff == 8) {
redbird 0:1bf8f02b0770 107 Diff = 0;
redbird 0:1bf8f02b0770 108 p++;
redbird 0:1bf8f02b0770 109 }
redbird 0:1bf8f02b0770 110 } while (--xsize);
redbird 0:1bf8f02b0770 111 break;
redbird 0:1bf8f02b0770 112 case LCD_DRAWMODE_TRANS:
redbird 0:1bf8f02b0770 113 do {
redbird 0:1bf8f02b0770 114 if (*p & (0x80 >> Diff)) {
redbird 0:1bf8f02b0770 115 *pData = Index1;
redbird 0:1bf8f02b0770 116 }
redbird 0:1bf8f02b0770 117 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 118 if (++Diff == 8) {
redbird 0:1bf8f02b0770 119 Diff = 0;
redbird 0:1bf8f02b0770 120 p++;
redbird 0:1bf8f02b0770 121 }
redbird 0:1bf8f02b0770 122 } while (--xsize);
redbird 0:1bf8f02b0770 123 break;
redbird 0:1bf8f02b0770 124 case LCD_DRAWMODE_XOR | LCD_DRAWMODE_TRANS:
redbird 0:1bf8f02b0770 125 case LCD_DRAWMODE_XOR:
redbird 0:1bf8f02b0770 126 pfGetPixelIndex = pDevice->pDeviceAPI->pfGetPixelIndex;
redbird 0:1bf8f02b0770 127 IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
redbird 0:1bf8f02b0770 128 do {
redbird 0:1bf8f02b0770 129 if (*p & (0x80 >> Diff)) {
redbird 0:1bf8f02b0770 130 Pixel = pfGetPixelIndex(pDevice, x, y);
redbird 0:1bf8f02b0770 131 Pixel ^= IndexMask;
redbird 0:1bf8f02b0770 132 *pData = Pixel;
redbird 0:1bf8f02b0770 133 }
redbird 0:1bf8f02b0770 134 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 135 x++;
redbird 0:1bf8f02b0770 136 if (++Diff == 8) {
redbird 0:1bf8f02b0770 137 Diff = 0;
redbird 0:1bf8f02b0770 138 p++;
redbird 0:1bf8f02b0770 139 }
redbird 0:1bf8f02b0770 140 } while (--xsize);
redbird 0:1bf8f02b0770 141 break;
redbird 0:1bf8f02b0770 142 }
redbird 0:1bf8f02b0770 143 }
redbird 0:1bf8f02b0770 144
redbird 0:1bf8f02b0770 145 /*********************************************************************
redbird 0:1bf8f02b0770 146 *
redbird 0:1bf8f02b0770 147 * Draw Bitmap 2 BPP
redbird 0:1bf8f02b0770 148 */
redbird 0:1bf8f02b0770 149 static void _DrawBitLine2BPP(GUI_DEVICE * pDevice, int x, int y, U8 const * p, int Diff, int xsize, const LCD_PIXELINDEX * pTrans) {
redbird 0:1bf8f02b0770 150 LCD_PIXELINDEX Pixels, PixelIndex;
redbird 0:1bf8f02b0770 151 int CurrentPixel, Shift, Index;
redbird 0:1bf8f02b0770 152 PIXEL * pData;
redbird 0:1bf8f02b0770 153 int x_phys, y_phys;
redbird 0:1bf8f02b0770 154 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 155
redbird 0:1bf8f02b0770 156 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 157 Pixels = *p;
redbird 0:1bf8f02b0770 158 CurrentPixel = Diff;
redbird 0:1bf8f02b0770 159 x += Diff;
redbird 0:1bf8f02b0770 160 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 161 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 162 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
redbird 0:1bf8f02b0770 163 case 0:
redbird 0:1bf8f02b0770 164 if (pTrans) {
redbird 0:1bf8f02b0770 165 do {
redbird 0:1bf8f02b0770 166 Shift = (3 - CurrentPixel) << 1;
redbird 0:1bf8f02b0770 167 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 168 PixelIndex = *(pTrans + Index);
redbird 0:1bf8f02b0770 169 *pData = (PIXEL)PixelIndex;
redbird 0:1bf8f02b0770 170 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 171 if (++CurrentPixel == 4) {
redbird 0:1bf8f02b0770 172 CurrentPixel = 0;
redbird 0:1bf8f02b0770 173 Pixels = *(++p);
redbird 0:1bf8f02b0770 174 }
redbird 0:1bf8f02b0770 175 } while (--xsize);
redbird 0:1bf8f02b0770 176 } else {
redbird 0:1bf8f02b0770 177 do {
redbird 0:1bf8f02b0770 178 Shift = (3 - CurrentPixel) << 1;
redbird 0:1bf8f02b0770 179 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 180 *pData = (PIXEL)Index;
redbird 0:1bf8f02b0770 181 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 182 if (++CurrentPixel == 4) {
redbird 0:1bf8f02b0770 183 CurrentPixel = 0;
redbird 0:1bf8f02b0770 184 Pixels = *(++p);
redbird 0:1bf8f02b0770 185 }
redbird 0:1bf8f02b0770 186 } while (--xsize);
redbird 0:1bf8f02b0770 187 }
redbird 0:1bf8f02b0770 188 break;
redbird 0:1bf8f02b0770 189 case LCD_DRAWMODE_TRANS:
redbird 0:1bf8f02b0770 190 if (pTrans) {
redbird 0:1bf8f02b0770 191 do {
redbird 0:1bf8f02b0770 192 Shift = (3 - CurrentPixel) << 1;
redbird 0:1bf8f02b0770 193 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 194 if (Index) {
redbird 0:1bf8f02b0770 195 PixelIndex = *(pTrans + Index);
redbird 0:1bf8f02b0770 196 *pData = (PIXEL)PixelIndex;
redbird 0:1bf8f02b0770 197 }
redbird 0:1bf8f02b0770 198 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 199 if (++CurrentPixel == 4) {
redbird 0:1bf8f02b0770 200 CurrentPixel = 0;
redbird 0:1bf8f02b0770 201 Pixels = *(++p);
redbird 0:1bf8f02b0770 202 }
redbird 0:1bf8f02b0770 203 } while (--xsize);
redbird 0:1bf8f02b0770 204 } else {
redbird 0:1bf8f02b0770 205 do {
redbird 0:1bf8f02b0770 206 Shift = (3 - CurrentPixel) << 1;
redbird 0:1bf8f02b0770 207 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 208 if (Index) {
redbird 0:1bf8f02b0770 209 *pData = (PIXEL)Index;
redbird 0:1bf8f02b0770 210 }
redbird 0:1bf8f02b0770 211 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 212 if (++CurrentPixel == 4) {
redbird 0:1bf8f02b0770 213 CurrentPixel = 0;
redbird 0:1bf8f02b0770 214 Pixels = *(++p);
redbird 0:1bf8f02b0770 215 }
redbird 0:1bf8f02b0770 216 } while (--xsize);
redbird 0:1bf8f02b0770 217 }
redbird 0:1bf8f02b0770 218 break;
redbird 0:1bf8f02b0770 219 }
redbird 0:1bf8f02b0770 220 }
redbird 0:1bf8f02b0770 221
redbird 0:1bf8f02b0770 222 /*********************************************************************
redbird 0:1bf8f02b0770 223 *
redbird 0:1bf8f02b0770 224 * Draw Bitmap 4 BPP
redbird 0:1bf8f02b0770 225 */
redbird 0:1bf8f02b0770 226 static void _DrawBitLine4BPP(GUI_DEVICE * pDevice, int x, int y, U8 const * p, int Diff, int xsize, const LCD_PIXELINDEX * pTrans) {
redbird 0:1bf8f02b0770 227 LCD_PIXELINDEX Pixels, PixelIndex;
redbird 0:1bf8f02b0770 228 int CurrentPixel, Shift, Index;
redbird 0:1bf8f02b0770 229 PIXEL * pData;
redbird 0:1bf8f02b0770 230 int x_phys, y_phys;
redbird 0:1bf8f02b0770 231 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 232
redbird 0:1bf8f02b0770 233 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 234 Pixels = *p;
redbird 0:1bf8f02b0770 235 CurrentPixel = Diff;
redbird 0:1bf8f02b0770 236 x += Diff;
redbird 0:1bf8f02b0770 237 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 238 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 239 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
redbird 0:1bf8f02b0770 240 case 0:
redbird 0:1bf8f02b0770 241 if (pTrans) {
redbird 0:1bf8f02b0770 242 do {
redbird 0:1bf8f02b0770 243 Shift = (1 - CurrentPixel) << 2;
redbird 0:1bf8f02b0770 244 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 245 PixelIndex = *(pTrans + Index);
redbird 0:1bf8f02b0770 246 *pData = (PIXEL)PixelIndex;
redbird 0:1bf8f02b0770 247 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 248 if (++CurrentPixel == 2) {
redbird 0:1bf8f02b0770 249 CurrentPixel = 0;
redbird 0:1bf8f02b0770 250 Pixels = *(++p);
redbird 0:1bf8f02b0770 251 }
redbird 0:1bf8f02b0770 252 } while (--xsize);
redbird 0:1bf8f02b0770 253 } else {
redbird 0:1bf8f02b0770 254 do {
redbird 0:1bf8f02b0770 255 Shift = (1 - CurrentPixel) << 2;
redbird 0:1bf8f02b0770 256 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 257 *pData = (PIXEL)Index;
redbird 0:1bf8f02b0770 258 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 259 if (++CurrentPixel == 2) {
redbird 0:1bf8f02b0770 260 CurrentPixel = 0;
redbird 0:1bf8f02b0770 261 Pixels = *(++p);
redbird 0:1bf8f02b0770 262 }
redbird 0:1bf8f02b0770 263 } while (--xsize);
redbird 0:1bf8f02b0770 264 }
redbird 0:1bf8f02b0770 265 break;
redbird 0:1bf8f02b0770 266 case LCD_DRAWMODE_TRANS:
redbird 0:1bf8f02b0770 267 if (pTrans) {
redbird 0:1bf8f02b0770 268 do {
redbird 0:1bf8f02b0770 269 Shift = (1 - CurrentPixel) << 2;
redbird 0:1bf8f02b0770 270 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 271 if (Index) {
redbird 0:1bf8f02b0770 272 PixelIndex = *(pTrans + Index);
redbird 0:1bf8f02b0770 273 *pData = (PIXEL)PixelIndex;
redbird 0:1bf8f02b0770 274 }
redbird 0:1bf8f02b0770 275 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 276 if (++CurrentPixel == 2) {
redbird 0:1bf8f02b0770 277 CurrentPixel = 0;
redbird 0:1bf8f02b0770 278 Pixels = *(++p);
redbird 0:1bf8f02b0770 279 }
redbird 0:1bf8f02b0770 280 } while (--xsize);
redbird 0:1bf8f02b0770 281 } else {
redbird 0:1bf8f02b0770 282 do {
redbird 0:1bf8f02b0770 283 Shift = (1 - CurrentPixel) << 2;
redbird 0:1bf8f02b0770 284 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
redbird 0:1bf8f02b0770 285 if (Index) {
redbird 0:1bf8f02b0770 286 *pData = (PIXEL)Index;
redbird 0:1bf8f02b0770 287 }
redbird 0:1bf8f02b0770 288 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 289 if (++CurrentPixel == 2) {
redbird 0:1bf8f02b0770 290 CurrentPixel = 0;
redbird 0:1bf8f02b0770 291 Pixels = *(++p);
redbird 0:1bf8f02b0770 292 }
redbird 0:1bf8f02b0770 293 } while (--xsize);
redbird 0:1bf8f02b0770 294 }
redbird 0:1bf8f02b0770 295 break;
redbird 0:1bf8f02b0770 296 }
redbird 0:1bf8f02b0770 297 }
redbird 0:1bf8f02b0770 298
redbird 0:1bf8f02b0770 299 /*********************************************************************
redbird 0:1bf8f02b0770 300 *
redbird 0:1bf8f02b0770 301 * Draw Bitmap 8 BPP
redbird 0:1bf8f02b0770 302 */
redbird 0:1bf8f02b0770 303 static void _DrawBitLine8BPP(GUI_DEVICE * pDevice, int x, int y, U8 const * p, int xsize, const LCD_PIXELINDEX * pTrans) {
redbird 0:1bf8f02b0770 304 LCD_PIXELINDEX Pixel;
redbird 0:1bf8f02b0770 305 PIXEL * pData;
redbird 0:1bf8f02b0770 306 int x_phys, y_phys;
redbird 0:1bf8f02b0770 307 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 308
redbird 0:1bf8f02b0770 309 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 310 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 311 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 312 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
redbird 0:1bf8f02b0770 313 case 0:
redbird 0:1bf8f02b0770 314 if (pTrans) {
redbird 0:1bf8f02b0770 315 do {
redbird 0:1bf8f02b0770 316 Pixel = *p++;
redbird 0:1bf8f02b0770 317 *pData = (PIXEL)*(pTrans + Pixel);
redbird 0:1bf8f02b0770 318 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 319 } while (--xsize);
redbird 0:1bf8f02b0770 320 } else {
redbird 0:1bf8f02b0770 321 do {
redbird 0:1bf8f02b0770 322 *pData = (PIXEL)*p++;
redbird 0:1bf8f02b0770 323 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 324 } while (--xsize);
redbird 0:1bf8f02b0770 325 }
redbird 0:1bf8f02b0770 326 break;
redbird 0:1bf8f02b0770 327 case LCD_DRAWMODE_TRANS:
redbird 0:1bf8f02b0770 328 if (pTrans) {
redbird 0:1bf8f02b0770 329 do {
redbird 0:1bf8f02b0770 330 Pixel = *p++;
redbird 0:1bf8f02b0770 331 if (Pixel) {
redbird 0:1bf8f02b0770 332 *pData = (PIXEL)*(pTrans + Pixel);
redbird 0:1bf8f02b0770 333 }
redbird 0:1bf8f02b0770 334 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 335 } while (--xsize);
redbird 0:1bf8f02b0770 336 } else {
redbird 0:1bf8f02b0770 337 do {
redbird 0:1bf8f02b0770 338 Pixel = *p++;
redbird 0:1bf8f02b0770 339 if (Pixel) {
redbird 0:1bf8f02b0770 340 *pData = (PIXEL)Pixel;
redbird 0:1bf8f02b0770 341 }
redbird 0:1bf8f02b0770 342 pData += pContext->PixelOffset;
redbird 0:1bf8f02b0770 343 } while (--xsize);
redbird 0:1bf8f02b0770 344 }
redbird 0:1bf8f02b0770 345 break;
redbird 0:1bf8f02b0770 346 }
redbird 0:1bf8f02b0770 347 }
redbird 0:1bf8f02b0770 348
redbird 0:1bf8f02b0770 349 /*********************************************************************
redbird 0:1bf8f02b0770 350 *
redbird 0:1bf8f02b0770 351 * Draw Bitmap 16 BPP
redbird 0:1bf8f02b0770 352 */
redbird 0:1bf8f02b0770 353 static void _DrawBitLine16BPP(GUI_DEVICE * pDevice, int x, int y, U16 const * p, int xsize) {
redbird 0:1bf8f02b0770 354 PIXEL * pData;
redbird 0:1bf8f02b0770 355 int x_phys, y_phys, PixelOffset;
redbird 0:1bf8f02b0770 356 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 357
redbird 0:1bf8f02b0770 358 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 359 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 360 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 361 PixelOffset = pContext->PixelOffset;
redbird 0:1bf8f02b0770 362 do {
redbird 0:1bf8f02b0770 363 *pData = (PIXEL)*p++;
redbird 0:1bf8f02b0770 364 pData += PixelOffset;
redbird 0:1bf8f02b0770 365 } while (--xsize);
redbird 0:1bf8f02b0770 366 }
redbird 0:1bf8f02b0770 367
redbird 0:1bf8f02b0770 368 /*********************************************************************
redbird 0:1bf8f02b0770 369 *
redbird 0:1bf8f02b0770 370 * Draw Bitmap 32 BPP
redbird 0:1bf8f02b0770 371 */
redbird 0:1bf8f02b0770 372 static void _DrawBitLine32BPP(GUI_DEVICE * pDevice, int x, int y, U32 const * p, int xsize) {
redbird 0:1bf8f02b0770 373 PIXEL * pData;
redbird 0:1bf8f02b0770 374 int x_phys, y_phys, PixelOffset;
redbird 0:1bf8f02b0770 375 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 376
redbird 0:1bf8f02b0770 377 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 378 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 379 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 380 PixelOffset = pContext->PixelOffset;
redbird 0:1bf8f02b0770 381 do {
redbird 0:1bf8f02b0770 382 *pData = (PIXEL)*p++;
redbird 0:1bf8f02b0770 383 pData += PixelOffset;
redbird 0:1bf8f02b0770 384 } while (--xsize);
redbird 0:1bf8f02b0770 385 }
redbird 0:1bf8f02b0770 386
redbird 0:1bf8f02b0770 387 /*********************************************************************
redbird 0:1bf8f02b0770 388 *
redbird 0:1bf8f02b0770 389 * Static code: API functions for drawing operations, no cache
redbird 0:1bf8f02b0770 390 *
redbird 0:1bf8f02b0770 391 **********************************************************************
redbird 0:1bf8f02b0770 392 */
redbird 0:1bf8f02b0770 393 /*********************************************************************
redbird 0:1bf8f02b0770 394 *
redbird 0:1bf8f02b0770 395 * _DrawBitmap_CX
redbird 0:1bf8f02b0770 396 */
redbird 0:1bf8f02b0770 397 static void _DrawBitmap_CX(GUI_DEVICE * pDevice, int x0, int y0,
redbird 0:1bf8f02b0770 398 int xSize, int ySize,
redbird 0:1bf8f02b0770 399 int BitsPerPixel,
redbird 0:1bf8f02b0770 400 int BytesPerLine,
redbird 0:1bf8f02b0770 401 const U8 * pData, int Diff,
redbird 0:1bf8f02b0770 402 const LCD_PIXELINDEX * pTrans) {
redbird 0:1bf8f02b0770 403 int x0_phys, y0_phys, x1_phys, y1_phys;
redbird 0:1bf8f02b0770 404 int i;
redbird 0:1bf8f02b0770 405 PIXEL * pDataBM;
redbird 0:1bf8f02b0770 406 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 407
redbird 0:1bf8f02b0770 408 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 409 switch (BitsPerPixel) {
redbird 0:1bf8f02b0770 410 case 1:
redbird 0:1bf8f02b0770 411 for (i = 0; i < ySize; i++) {
redbird 0:1bf8f02b0770 412 _DrawBitLine1BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
redbird 0:1bf8f02b0770 413 pData += BytesPerLine;
redbird 0:1bf8f02b0770 414 }
redbird 0:1bf8f02b0770 415 break;
redbird 0:1bf8f02b0770 416 case 2:
redbird 0:1bf8f02b0770 417 for (i = 0; i < ySize; i++) {
redbird 0:1bf8f02b0770 418 _DrawBitLine2BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
redbird 0:1bf8f02b0770 419 pData += BytesPerLine;
redbird 0:1bf8f02b0770 420 }
redbird 0:1bf8f02b0770 421 break;
redbird 0:1bf8f02b0770 422 case 4:
redbird 0:1bf8f02b0770 423 for (i = 0; i < ySize; i++) {
redbird 0:1bf8f02b0770 424 _DrawBitLine4BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
redbird 0:1bf8f02b0770 425 pData += BytesPerLine;
redbird 0:1bf8f02b0770 426 }
redbird 0:1bf8f02b0770 427 break;
redbird 0:1bf8f02b0770 428 case 8:
redbird 0:1bf8f02b0770 429 for (i = 0; i < ySize; i++) {
redbird 0:1bf8f02b0770 430 _DrawBitLine8BPP(pDevice, x0, i + y0, pData, xSize, pTrans);
redbird 0:1bf8f02b0770 431 pData += BytesPerLine;
redbird 0:1bf8f02b0770 432 }
redbird 0:1bf8f02b0770 433 break;
redbird 0:1bf8f02b0770 434 case 16:
redbird 0:1bf8f02b0770 435 for (i = 0; i < ySize; i++) {
redbird 0:1bf8f02b0770 436 _DrawBitLine16BPP(pDevice, x0, i + y0, (U16 *)pData, xSize);
redbird 0:1bf8f02b0770 437 pData += BytesPerLine;
redbird 0:1bf8f02b0770 438 }
redbird 0:1bf8f02b0770 439 break;
redbird 0:1bf8f02b0770 440 case 32:
redbird 0:1bf8f02b0770 441 for (i = 0; i < ySize; i++) {
redbird 0:1bf8f02b0770 442 _DrawBitLine32BPP(pDevice, x0, i + y0, (U32 *)pData, xSize);
redbird 0:1bf8f02b0770 443 pData += BytesPerLine;
redbird 0:1bf8f02b0770 444 }
redbird 0:1bf8f02b0770 445 break;
redbird 0:1bf8f02b0770 446 }
redbird 0:1bf8f02b0770 447
redbird 0:1bf8f02b0770 448 pContext->pfLog2Phys(pContext, x0 + Diff, y0, &x0_phys, &y0_phys);
redbird 0:1bf8f02b0770 449 pContext->pfLog2Phys(pContext, x0 + Diff + xSize - 1, y0 + ySize - 1, &x1_phys, &y1_phys);
redbird 0:1bf8f02b0770 450 _Sort(&x0_phys, &x1_phys);
redbird 0:1bf8f02b0770 451 _Sort(&y0_phys, &y1_phys);
redbird 0:1bf8f02b0770 452 pDataBM = XY2PTR(x0_phys, y0_phys);
redbird 0:1bf8f02b0770 453 pDevice = pDevice->pNext;
redbird 0:1bf8f02b0770 454 pDevice->pDeviceAPI->pfDrawBitmap(pDevice,
redbird 0:1bf8f02b0770 455 x0_phys, y0_phys,
redbird 0:1bf8f02b0770 456 x1_phys - x0_phys + 1,
redbird 0:1bf8f02b0770 457 y1_phys - y0_phys + 1,
redbird 0:1bf8f02b0770 458 pContext->pDrawingAPI->BytesPerPixel << 3,
redbird 0:1bf8f02b0770 459 pContext->pDrawingAPI->BytesPerPixel * pContext->vxSize,
redbird 0:1bf8f02b0770 460 (U8 *)pDataBM, 0, NULL);
redbird 0:1bf8f02b0770 461 }
redbird 0:1bf8f02b0770 462
redbird 0:1bf8f02b0770 463 /*********************************************************************
redbird 0:1bf8f02b0770 464 *
redbird 0:1bf8f02b0770 465 * _GetPixelIndex_CX
redbird 0:1bf8f02b0770 466 */
redbird 0:1bf8f02b0770 467 static unsigned int _GetPixelIndex_CX(GUI_DEVICE * pDevice, int x, int y) {
redbird 0:1bf8f02b0770 468 PIXEL * pData;
redbird 0:1bf8f02b0770 469 PIXEL Pixel;
redbird 0:1bf8f02b0770 470 int x_phys, y_phys;
redbird 0:1bf8f02b0770 471 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 472
redbird 0:1bf8f02b0770 473 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 474 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 475 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 476 Pixel = *pData;
redbird 0:1bf8f02b0770 477 return Pixel;
redbird 0:1bf8f02b0770 478 }
redbird 0:1bf8f02b0770 479
redbird 0:1bf8f02b0770 480 /*********************************************************************
redbird 0:1bf8f02b0770 481 *
redbird 0:1bf8f02b0770 482 * _SetPixelIndex_CX
redbird 0:1bf8f02b0770 483 */
redbird 0:1bf8f02b0770 484 static void _SetPixelIndex_CX(GUI_DEVICE * pDevice, int x, int y, int PixelIndex) {
redbird 0:1bf8f02b0770 485 PIXEL * pData;
redbird 0:1bf8f02b0770 486 int x_phys, y_phys;
redbird 0:1bf8f02b0770 487 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 488
redbird 0:1bf8f02b0770 489 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 490 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
redbird 0:1bf8f02b0770 491 pData = XY2PTR(x_phys, y_phys);
redbird 0:1bf8f02b0770 492 *pData = (PIXEL)PixelIndex;
redbird 0:1bf8f02b0770 493 pDevice = pDevice->pNext;
redbird 0:1bf8f02b0770 494 pDevice->pDeviceAPI->pfSetPixelIndex(pDevice, x_phys, y_phys, PixelIndex);
redbird 0:1bf8f02b0770 495 }
redbird 0:1bf8f02b0770 496
redbird 0:1bf8f02b0770 497 /*********************************************************************
redbird 0:1bf8f02b0770 498 *
redbird 0:1bf8f02b0770 499 * _XorPixel_CX
redbird 0:1bf8f02b0770 500 */
redbird 0:1bf8f02b0770 501 static void _XorPixel_CX(GUI_DEVICE * pDevice, int x, int y) {
redbird 0:1bf8f02b0770 502 PIXEL Pixel, IndexMask;
redbird 0:1bf8f02b0770 503
redbird 0:1bf8f02b0770 504 IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
redbird 0:1bf8f02b0770 505 Pixel = pDevice->pDeviceAPI->pfGetPixelIndex(pDevice, x, y);
redbird 0:1bf8f02b0770 506 Pixel ^= IndexMask;
redbird 0:1bf8f02b0770 507 pDevice->pDeviceAPI->pfSetPixelIndex(pDevice, x, y, Pixel);
redbird 0:1bf8f02b0770 508 }
redbird 0:1bf8f02b0770 509
redbird 0:1bf8f02b0770 510 /*********************************************************************
redbird 0:1bf8f02b0770 511 *
redbird 0:1bf8f02b0770 512 * _DrawHLine_CX
redbird 0:1bf8f02b0770 513 */
redbird 0:1bf8f02b0770 514 static void _DrawHLine_CX(GUI_DEVICE * pDevice, int x0, int y, int x1) {
redbird 0:1bf8f02b0770 515 pDevice->pDeviceAPI->pfFillRect(pDevice, x0, y, x1, y);
redbird 0:1bf8f02b0770 516 }
redbird 0:1bf8f02b0770 517
redbird 0:1bf8f02b0770 518 /*********************************************************************
redbird 0:1bf8f02b0770 519 *
redbird 0:1bf8f02b0770 520 * _DrawVLine_CX
redbird 0:1bf8f02b0770 521 */
redbird 0:1bf8f02b0770 522 static void _DrawVLine_CX(GUI_DEVICE * pDevice, int x, int y0, int y1) {
redbird 0:1bf8f02b0770 523 pDevice->pDeviceAPI->pfFillRect(pDevice, x, y0, x, y1);
redbird 0:1bf8f02b0770 524 }
redbird 0:1bf8f02b0770 525
redbird 0:1bf8f02b0770 526 /*********************************************************************
redbird 0:1bf8f02b0770 527 *
redbird 0:1bf8f02b0770 528 * _FillRect_CX
redbird 0:1bf8f02b0770 529 */
redbird 0:1bf8f02b0770 530 static void _FillRect_CX(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1) {
redbird 0:1bf8f02b0770 531 PIXEL * pData;
redbird 0:1bf8f02b0770 532 PIXEL * pLine;
redbird 0:1bf8f02b0770 533 PIXEL * pPixel;
redbird 0:1bf8f02b0770 534 PIXEL Pixel, IndexMask;
redbird 0:1bf8f02b0770 535 int x0_phys, y0_phys, x1_phys, y1_phys;
redbird 0:1bf8f02b0770 536 int NumPixels, NumLines;
redbird 0:1bf8f02b0770 537 DRIVER_CONTEXT * pContext;
redbird 0:1bf8f02b0770 538
redbird 0:1bf8f02b0770 539 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
redbird 0:1bf8f02b0770 540 pContext->pfLog2Phys(pContext, x0, y0, &x0_phys, &y0_phys);
redbird 0:1bf8f02b0770 541 pContext->pfLog2Phys(pContext, x1, y1, &x1_phys, &y1_phys);
redbird 0:1bf8f02b0770 542 _Sort(&x0_phys, &x1_phys);
redbird 0:1bf8f02b0770 543 _Sort(&y0_phys, &y1_phys);
redbird 0:1bf8f02b0770 544 pData = pLine = XY2PTR(x0_phys, y0_phys);
redbird 0:1bf8f02b0770 545 NumLines = y1_phys - y0_phys + 1;
redbird 0:1bf8f02b0770 546 if (GUI_pContext->DrawMode & LCD_DRAWMODE_XOR) {
redbird 0:1bf8f02b0770 547 IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
redbird 0:1bf8f02b0770 548 do {
redbird 0:1bf8f02b0770 549 pPixel = pLine;
redbird 0:1bf8f02b0770 550 NumPixels = x1_phys - x0_phys + 1;
redbird 0:1bf8f02b0770 551 do {
redbird 0:1bf8f02b0770 552 *pPixel++ ^= IndexMask;
redbird 0:1bf8f02b0770 553 } while (--NumPixels);
redbird 0:1bf8f02b0770 554 pLine += pContext->vxSize;
redbird 0:1bf8f02b0770 555 } while (--NumLines);
redbird 0:1bf8f02b0770 556 } else {
redbird 0:1bf8f02b0770 557 Pixel = (PIXEL)LCD__GetColorIndex();
redbird 0:1bf8f02b0770 558 if (sizeof(Pixel) == 1) {
redbird 0:1bf8f02b0770 559 NumPixels = x1_phys - x0_phys + 1;
redbird 0:1bf8f02b0770 560 do {
redbird 0:1bf8f02b0770 561 GUI_MEMSET((U8 *)pLine, Pixel, NumPixels);
redbird 0:1bf8f02b0770 562 pLine += pContext->vxSize;
redbird 0:1bf8f02b0770 563 } while (--NumLines);
redbird 0:1bf8f02b0770 564 } else {
redbird 0:1bf8f02b0770 565 do {
redbird 0:1bf8f02b0770 566 pPixel = pLine;
redbird 0:1bf8f02b0770 567 NumPixels = x1_phys - x0_phys + 1;
redbird 0:1bf8f02b0770 568 do {
redbird 0:1bf8f02b0770 569 *pPixel++ = Pixel;
redbird 0:1bf8f02b0770 570 } while (--NumPixels);
redbird 0:1bf8f02b0770 571 pLine += pContext->vxSize;
redbird 0:1bf8f02b0770 572 } while (--NumLines);
redbird 0:1bf8f02b0770 573 }
redbird 0:1bf8f02b0770 574 }
redbird 0:1bf8f02b0770 575 pDevice = pDevice->pNext;
redbird 0:1bf8f02b0770 576 pDevice->pDeviceAPI->pfDrawBitmap(pDevice,
redbird 0:1bf8f02b0770 577 x0_phys, y0_phys,
redbird 0:1bf8f02b0770 578 x1_phys - x0_phys + 1,
redbird 0:1bf8f02b0770 579 y1_phys - y0_phys + 1,
redbird 0:1bf8f02b0770 580 pContext->pDrawingAPI->BytesPerPixel << 3,
redbird 0:1bf8f02b0770 581 pContext->pDrawingAPI->BytesPerPixel * pContext->vxSize,
redbird 0:1bf8f02b0770 582 (U8 *)pData, 0, NULL);
redbird 0:1bf8f02b0770 583 }
redbird 0:1bf8f02b0770 584
redbird 0:1bf8f02b0770 585 /*********************************************************************
redbird 0:1bf8f02b0770 586 *
redbird 0:1bf8f02b0770 587 * Static data: Drawing API(s)
redbird 0:1bf8f02b0770 588 *
redbird 0:1bf8f02b0770 589 **********************************************************************
redbird 0:1bf8f02b0770 590 */
redbird 0:1bf8f02b0770 591 /*********************************************************************
redbird 0:1bf8f02b0770 592 *
redbird 0:1bf8f02b0770 593 * GUI_OrientationAPI_CX
redbird 0:1bf8f02b0770 594 */
redbird 0:1bf8f02b0770 595 const GUI_ORIENTATION_API API_NAME = {
redbird 0:1bf8f02b0770 596 _DrawBitmap_CX,
redbird 0:1bf8f02b0770 597 _DrawHLine_CX,
redbird 0:1bf8f02b0770 598 _DrawVLine_CX,
redbird 0:1bf8f02b0770 599 _FillRect_CX,
redbird 0:1bf8f02b0770 600 _GetPixelIndex_CX,
redbird 0:1bf8f02b0770 601 _SetPixelIndex_CX,
redbird 0:1bf8f02b0770 602 _XorPixel_CX,
redbird 0:1bf8f02b0770 603 BYTES_PER_PIXEL
redbird 0:1bf8f02b0770 604 };
redbird 0:1bf8f02b0770 605
redbird 0:1bf8f02b0770 606 #ifdef __cplusplus
redbird 0:1bf8f02b0770 607 }
redbird 0:1bf8f02b0770 608 #endif
redbird 0:1bf8f02b0770 609
redbird 0:1bf8f02b0770 610 /*************************** End of file ****************************/