FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/com/src/driver/display_obsolete.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : display.c | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 /* | |
21 | |
22 July 1, 2005 REF: CRR 32677 - xpradipg | |
23 Description: Alignmnet of the display for each row. Send the un negated value to LCD driver | |
24 Solution: The alignment of the display is corrected by decreasing the number of columns by 1. | |
25 The negated value is corrected and sent to the driver | |
26 | |
27 June 03, 2005 REF: GSM-ENH-31636 xpradipg | |
28 Description: Change the board ID for Isample to 71 and add new defination | |
29 for the CALLISTO with baord ID 70 | |
30 Solution: Add the definition of ALLISTO with board ID 70 and change the | |
31 board Id to 71 for Isample | |
32 | |
33 Mar 30, 2005 REF: CRR 29986 xpradipg | |
34 Description: Optimisation 1: Removal of unused variables and dynamically | |
35 allocate/ deallocate mbndata | |
36 Solution: removed the unused variable pictureCopy_col and the static | |
37 qualifier so as to be accessed by the ATB module | |
38 | |
39 | |
40 CRR 28825: xpradipg - 11 Feb 2005 | |
41 Description:Extension of GDI-for display of ISample and code cleanup | |
42 Solution: The code replication for D_Sample and E_sample are removed and a | |
43 new flag is added for the ISample. currently the BOARD ID is set to 70 for | |
44 CALLISTO and 71 for ISample. | |
45 | |
46 GW 31/01/03 - Added support for 16 bit LCD buffer - | |
47 Split DSAMPLE_COLOUR code into DSAMPLE_COLOUR32 (original 32bits/pixel) | |
48 and DSAMPLE_COLOUR16 (16 bits/pixel - untested) | |
49 Removed CSAMPLE_COLOUR option | |
50 Removed 'PLOT' option for D-sample - too slow to be useful | |
51 | |
52 */ | |
53 | |
54 #ifndef DRV_DSPL_C | |
55 #define DRV_DSPL_C | |
56 #endif | |
57 | |
58 /*==== INCLUDES ===================================================*/ | |
59 #define ENTITY_CST | |
60 | |
61 #include <string.h> | |
62 #if defined (WIN32) | |
63 #include <stdio.h> | |
64 #endif | |
65 | |
66 #include "typedefs.h" | |
67 #include "gdi.h" | |
68 #include "dspl.h" | |
69 #include "font_bitmaps.h" | |
70 #include "vsi.h" | |
71 #include "custom.h" | |
72 #include "gsm.h" | |
73 #include "prim.h" | |
74 #include "p_mmi.h" | |
75 #include "tok.h" | |
76 #include "cst/cst.h" | |
77 #include "os.h" | |
78 | |
79 #include "rvf/rvf_api.h" | |
80 | |
81 #undef R2D_ENABLED | |
82 #ifndef _SIMULATION_ | |
83 | |
84 #if (defined(_TARGET_) && (BOARD!=10) && (BOARD!=34)&& (BOARD!=35)&& (BOARD!=46)) | |
85 /* | |
86 * R2D is not supported by EP2 module (BOARD == 10, of customer 6351/36) | |
87 * and by Avenger2/Perseus1 board (BOARD == 34). (dbachran / 2002-11-27) | |
88 * and by P2 board (BOARD == 35) and F-sample (BOARD == 46) (rsauer / 2004-05-27) | |
89 */ | |
90 #define R2D_ENABLED | |
91 #endif | |
92 #endif | |
93 | |
94 #ifndef _SIMULATION_ | |
95 #ifdef R2D_ENABLED | |
96 #include "r2d/r2d.h" | |
97 #include "r2d/r2d_config.h" | |
98 #endif | |
99 #endif | |
100 /* GW enable/disable trace using the MMI */ | |
101 /* NB. Traces are only for diagnostics while developing and must be removed for code deliveries!*/ | |
102 /* defining mmi_trace as <empty> will remove them */ | |
103 //#define MMI_TRACE | |
104 #define mmi_trace | |
105 //void mmi_trace(char* str); | |
106 /*==== EXPORT =====================================================*/ | |
107 #define ENCODE_OFFSET 24 | |
108 //define EASY_TEXT_ENABLED | |
109 | |
110 /************************************************************************ | |
111 * The following macros define what hardware we are running on and what * | |
112 * drivers are being used to drive the display * | |
113 * BSAMPLE - 84x48 display * | |
114 * CSAMPLE - 84x48 display * | |
115 * CSAMPLE_COLOUR - no longer supported * | |
116 * DSAMPLE - 176x220 display which can be driven as 16 bit colour or b+w * | |
117 * DSAMPLE_COLOUR - colour display * | |
118 * DSAMPLE_COLOUR16 - 16 bits per pixel displayed * | |
119 * NB. This has not been tested at all - it * | |
120 * may not display correctly or may crash * | |
121 * although it does not crash when enabled * | |
122 * with the 32bit drivers) * | |
123 * * | |
124 * DSAMPLE_COLOUR32 - 32 bits per pixel displayed (16 bits are * | |
125 * zero and have no effect) * | |
126 * DSAMPLE_LITE - 1 bit per pixel (b+w display) * | |
127 * GW SPR#1840 25/03/03 * | |
128 * Also, the compiler switches have been added to allow us to develop * | |
129 * the MMI for a different final format (b+w/smaller display). * | |
130 * COLOURDISPLAY - If not defined - all output is to be b+w * | |
131 * LSCREEN - If not defined - screen is 'small' - use the 8x6 font * | |
132 *************************************************************************/ | |
133 #if (defined(_TARGET_)) | |
134 //#if (BOARD==33) | |
135 #if ((BOARD == 8) || (BOARD == 9)) | |
136 #define CSAMPLE | |
137 #elif ((BOARD == 40) || (BOARD == 41)) | |
138 #define DSAMPLE | |
139 #elif (BOARD == 43) | |
140 #define ESAMPLE | |
141 //June 03, 2005 REF: GSM-ENH-31636 xpradipg | |
142 #elif (BOARD == 70) | |
143 #define CALLISTO | |
144 //CRR 28825: xpradipg - 11 Feb 2005 | |
145 #elif (BOARD == 71) // LCD enabling of ISAMPLE | |
146 #define ISAMPLE | |
147 #else | |
148 //Other board type | |
149 #define BSAMPLE | |
150 #endif | |
151 #else | |
152 //_TARGET_ not defined | |
153 //Not running on hardware - select the hw for simulation purposes. | |
154 #define BSAMPLE | |
155 | |
156 //Also, if not already disabled - disable trace code | |
157 #ifdef MMI_TRACE | |
158 #undef MMI_TRACE | |
159 #endif | |
160 #endif | |
161 //June 03, 2005 REF: GSM-ENH-31636 xpradipg | |
162 //CRR 28825: xpradipg - 11 Feb 2005 | |
163 #if (defined(DSAMPLE) || defined(ESAMPLE) || defined(ISAMPLE) || defined(CALLISTO)) | |
164 /* For a start, we use exactly the same definitions for E-Sample as we do | |
165 for D-Sample. IMPORTANT: If the E-Sample LCD differs from D-Sample, the | |
166 following lines must be properly adapted! | |
167 */ | |
168 #if (R2D_LCD_DISPLAY == R2D_COLOR) | |
169 #define DSAMPLE_COLOUR | |
170 #if (R2D_PIXEL_POS_TO_BIT_POS == 5) | |
171 #define DSAMPLE_COLOUR32 | |
172 #endif | |
173 #if (R2D_PIXEL_POS_TO_BIT_POS == 4) | |
174 #define DSAMPLE_COLOUR16 | |
175 #endif | |
176 #else | |
177 #define DSAMPLE_LITE | |
178 #undef COLOURDISPLAY | |
179 #endif | |
180 #endif /* ESAMPLE */ | |
181 | |
182 | |
183 //Ensure that if the H/W does not support colour, the compiler option is overridden | |
184 //- we can display b+w only on a colour display but not the other way round | |
185 #ifndef DSAMPLE_COLOUR | |
186 #ifdef COLOURDISPLAY | |
187 #undef COLOURDISPLAY | |
188 #endif | |
189 #endif | |
190 | |
191 | |
192 /* | |
193 USE_PLOT - Defined if we are to use r2d_draw_point to output a display | |
194 This method will always produce a display (of sorts) but can be very slow | |
195 USE_BLIT_RECT - Defined if we provide a 24 bit colour display and allow the riviera code to | |
196 translate into the LCD format. | |
197 USE_BUFFER - This must be defined if USE_BLIT_RECT is being used. This will require an image | |
198 of the colour display to be stored in local memory. | |
199 | |
200 If neither are defined then we must create our buffer in the same format as the LCD. | |
201 NB if 'USE_BLIT_RECT' is not defined, any changes to the h/w or driver software will have an | |
202 impact on the code below. | |
203 | |
204 */ | |
205 | |
206 /*==== CONSTANTS ==================================================*/ | |
207 // Mar 30, 2005 REF: CRR 29986 xpradipg | |
208 // removed the static qualifier to be accessed by the ATB module. | |
209 #ifdef FF_MMI_OPTIM | |
210 const int translation_ascii_2_unicode[256] = { | |
211 #else | |
212 static const int translation_ascii_2_unicode[256] = { | |
213 #endif | |
214 0x0000, 0x00A4, 0x00d8, 0xFFFF, 0x0394, 0x03A8, 0x00BF, 0x00F8, 0xFFFF, 0xFFFF, 0x000A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
215 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
216 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026,0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, | |
217 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, | |
218 0x0040,0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, | |
219 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, /* SPR#2034 - SH */ | |
220 0xFFFF, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, | |
221 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
222 | |
223 0xFFFF, 0x00C7, 0x00FC, 0x00E9, 0x00E4, 0x00E0, 0x00E5, 0xFFFF, 0xFFFF, 0xFFFF, 0x00E8, 0xFFFF, 0xFFFF, 0x00EC, 0x00C4, 0x00C5, | |
224 0x00C9, 0x00E6, 0x00C6, 0xFFFF, 0x00F6, 0x00F2, 0xFFFF, 0x00F9, 0xFFFF, 0x00D6, 0x00DC, 0xFFFF, 0x00A3, 0x00A5, 0xFFFF, 0xFFFF, | |
225 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00F1, 0x00D1, 0xFFFF, 0xFFFF, 0x00A7, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00A1, 0xFFFF, 0xFFFF, | |
226 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
227 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
228 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
229 0xFFFF, 0x00DF, 0x0393, 0x03A0, 0x03A3, 0xFFFF, 0xFFFF, 0xFFFF, 0x03A6, 0x0398, 0x03A9, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x039B, | |
230 0x039E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF | |
231 | |
232 }; | |
233 /*==== VARIABLES ==================================================*/ | |
234 //EXTERN UBYTE extDisplay; /* external display ? */ | |
235 EXTERN UBYTE extDisplay; /* external display ? */ | |
236 GLOBAL UBYTE dspl_char_type; | |
237 | |
238 | |
239 /* | |
240 * We don't need display.c with ACI-only builds, but CST references extDisplay | |
241 * above, so we need to keep that one for now. | |
242 * Only process this file, if MMI is set to 1 (SMI) or 2 (BMI). | |
243 */ | |
244 #if (MMI != 0) | |
245 | |
246 GLOBAL dspl_DevCaps displayData; | |
247 #if defined (NEW_FRAME) | |
248 EXTERN T_HANDLE hCommL1; | |
249 #else | |
250 EXTERN T_VSI_CHANDLE hCommL1; | |
251 #endif | |
252 | |
253 static int scrEnabled = 0; /* screen update enable */ | |
254 static int txtInvert = 0; //Text invert | |
255 | |
256 static T_HANDLE mmi_handle; | |
257 static T_HANDLE hCommMMI = VSI_ERROR; | |
258 | |
259 /*==== FUNCTIONS ==================================================*/ | |
260 /* | |
261 * send to external Display | |
262 */ | |
263 LOCAL void dspl_SendDisplayReq (USHORT x, USHORT y, char *text); | |
264 GLOBAL void kbd_test (UBYTE key); | |
265 | |
266 /* | |
267 * TI driver functions | |
268 */ | |
269 extern void LCD_SetPower (void); | |
270 extern void LCD_Reset (void); | |
271 extern void LCD_Enable (int); | |
272 extern void LCD_Clear (void); | |
273 extern void LCD_WriteString (int y, int x, char *s); | |
274 extern void LCD_PixBlt (int x, int y, int w, int h, char *bmp); | |
275 extern void LCD_DrawIcon (int x, int y, char id); | |
276 extern void LCD_TranslateBitmap (int w, int h, char *bo, char *bt); | |
277 extern void LCD_Cursor (int row, int col); | |
278 | |
279 GLOBAL void rt_ExtPrimitive ( USHORT TaskHandle, USHORT DestComHandle, | |
280 char *ExtDest, OS_QDATA *Msg ); | |
281 /* | |
282 * Internal Functions for Graphic Driver (Workaround) | |
283 */ | |
284 LOCAL void scrInit (void); | |
285 LOCAL void scrExit (void); | |
286 LOCAL void scrSize (int *x, int *y); | |
287 #if (!CUST)//JVJE #if (CUST==1) | |
288 | |
289 LOCAL void scrClear (void); | |
290 #endif | |
291 LOCAL void scrClearRect (int px, int py, int sx, int sy); | |
292 LOCAL void scrText (int x, int y, char *txt); | |
293 LOCAL void scrText_Unicode (int x, int y, USHORT *txt); | |
294 LOCAL void scrLine (int px, int py, int sx, int sy); | |
295 LOCAL void scrRect (int px, int py, int sx, int sy); | |
296 LOCAL int scrFntSelect (int font); | |
297 LOCAL int scrFntHeight (void); | |
298 LOCAL int scrFntGetFit (char *tp, int lineWidth); | |
299 LOCAL int scrFntGetLen (char *tp, int nChars); | |
300 LOCAL int scrBmpDraw (int px, int py, int sx, int sy, | |
301 int ix, char *bm, int mode); | |
302 LOCAL void scrCurType (int type); | |
303 LOCAL void scrCursor (int x, int y); | |
304 //accessible from outside e.g 3th application MMS | |
305 void scrPoint (int px, int py, int col); | |
306 LOCAL int scrUpdate (int onOff); | |
307 | |
308 LOCAL void scrText_Invert_Unicode (int x, int y, USHORT *txt); /*kk*/ | |
309 | |
310 LOCAL int checkPixelColour(int px, int py, U32 col); | |
311 LOCAL void scrLCDUpdate (void); | |
312 | |
313 void scrText_Invert (int x, int y, char *txt); | |
314 | |
315 void scrDrawFilledRect (int px, int py, int sx, int sy, U32 col); | |
316 | |
317 int scrGetRealLength(char *str, int* totChar, int* totPixel); | |
318 | |
319 LOCAL void scrUnfocusDisplay(void); | |
320 | |
321 | |
322 | |
323 | |
324 void dspl_show_bitmap(int x, int y,t_font_bitmap* current_bitmap,U32 attr ); | |
325 | |
326 | |
327 | |
328 | |
329 GLOBAL UBYTE dspl_SetWindow(USHORT in_X1, | |
330 USHORT in_Y1, | |
331 USHORT in_X2, | |
332 USHORT in_Y2); | |
333 | |
334 | |
335 | |
336 | |
337 | |
338 | |
339 | |
340 /*==== CONSTANTS ==================================================*/ | |
341 | |
342 /******************************************************************* | |
343 * * | |
344 * PART I: Driver Interface * | |
345 * * | |
346 *******************************************************************/ | |
347 | |
348 /* | |
349 +--------------------------------------------------------------------+ | |
350 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
351 | STATE : code ROUTINE : dspl_Init | | |
352 +--------------------------------------------------------------------+ | |
353 | |
354 PURPOSE : The function initializes the driver´s internal data. The | |
355 function returns DRV_INITIALIZED if the driver has already | |
356 been initialized and is ready to be used or already in use. | |
357 In case of an initialization failure, which means that the | |
358 driver cannot be used, the function returns DRV_INITFAILURE. | |
359 | |
360 */ | |
361 | |
362 GLOBAL UBYTE dspl_Init (void) | |
363 { | |
364 /* | |
365 * Default is character Display | |
366 */ | |
367 displayData.DisplayType = DSPL_TYPE_CHARACTER; | |
368 | |
369 if (!extDisplay) /* use internal display */ | |
370 { | |
371 #if defined (SIMULATE_LCD) | |
372 LCD_Reset (); /* use character oriented display */ | |
373 LCD_Enable (1); | |
374 LCD_Clear (); | |
375 scrInit(); /* we need this also for glob vars, kk 14.02.2000*/ | |
376 #else | |
377 scrInit(); /* use graphic display */ | |
378 #endif | |
379 } | |
380 else | |
381 #if defined (SIMULATE_LCD) | |
382 LCD_Enable (0); | |
383 #else | |
384 scrExit(); | |
385 #endif | |
386 | |
387 return DRV_OK; | |
388 } | |
389 | |
390 /* | |
391 +--------------------------------------------------------------------+ | |
392 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
393 | STATE : code ROUTINE : dspl_Exit | | |
394 +--------------------------------------------------------------------+ | |
395 | |
396 PURPOSE : The function is called when the driver functionality is | |
397 not longer needed. The function "de-allocates" all | |
398 allocated resources and finalizes the driver. | |
399 | |
400 */ | |
401 | |
402 GLOBAL void dspl_Exit (void) | |
403 { | |
404 scrExit(); | |
405 } | |
406 | |
407 /* | |
408 +--------------------------------------------------------------------+ | |
409 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
410 | STATE : code ROUTINE : dspl_Clear | | |
411 +--------------------------------------------------------------------+ | |
412 | |
413 PURPOSE : This function is used to clear a specific region of the | |
414 display using the current background colour. The region | |
415 is specified by the upper left corner (X1, Y1) and the | |
416 lower right corner (X2, Y2) inclusive. The background | |
417 color can be set using dspl_SetBkgColor () function. | |
418 | |
419 */ | |
420 | |
421 GLOBAL UBYTE dspl_Clear (USHORT in_X1, | |
422 USHORT in_Y1, | |
423 USHORT in_X2, | |
424 USHORT in_Y2) | |
425 { | |
426 scrClearRect ((int)in_X1,(int)in_Y1,(int)(in_X2-in_X1+1),(int)(in_Y2-in_Y1+1)); | |
427 | |
428 return DRV_OK; | |
429 } | |
430 | |
431 /* | |
432 +--------------------------------------------------------------------+ | |
433 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
434 | STATE : code ROUTINE : dspl_Clear | | |
435 +--------------------------------------------------------------------+ | |
436 | |
437 PURPOSE : This function is used to clear a specific region of the | |
438 display using the current background colour. The region | |
439 is specified by the upper left corner (X1, Y1) and the | |
440 lower right corner (X2, Y2) inclusive. The background | |
441 color can be set using dspl_SetBkgColor () function. | |
442 | |
443 */ | |
444 | |
445 GLOBAL UBYTE dspl_ClearAll (void) | |
446 { | |
447 #if (!CUST) | |
448 scrClear (); | |
449 #endif | |
450 | |
451 return DRV_OK; | |
452 } | |
453 | |
454 /* | |
455 +--------------------------------------------------------------------+ | |
456 | PROJECT : GSM-PS (6147) MODULE : SMI_WM | | |
457 | STATE : code ROUTINE : dspl_UnfocusDisplay | | |
458 +--------------------------------------------------------------------+ | |
459 | |
460 PURPOSE : Calls the function that will cause the entire display to appear much | |
461 darker, allowing the pop-up dialog to be more clearly the focus | |
462 especially the softkeys. | |
463 GW #2294 23/07/03 - Created | |
464 */ | |
465 GLOBAL UBYTE dspl_unfocusDisplay (void) | |
466 { | |
467 scrUnfocusDisplay(); | |
468 return DRV_OK; | |
469 } | |
470 | |
471 /* | |
472 +--------------------------------------------------------------------+ | |
473 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
474 | STATE : code ROUTINE : dspl_Enable | | |
475 +--------------------------------------------------------------------+ | |
476 | |
477 PURPOSE : The function is used to turn the display on or off. While | |
478 a display is switched off, it is possible to perform any | |
479 drawing function. | |
480 | |
481 */ | |
482 | |
483 GLOBAL UBYTE dspl_Enable (UBYTE in_Enable) | |
484 { | |
485 return scrUpdate (in_Enable); | |
486 } | |
487 | |
488 /* | |
489 xreddymn Apr-07-2005 MMI-SPR-29655: Added function to update region | |
490 +--------------------------------------------------------------------+ | |
491 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
492 | STATE : code ROUTINE : dspl_Enable_Region | | |
493 +--------------------------------------------------------------------+ | |
494 | |
495 PURPOSE : The function is used to update a region on the screen | |
496 | |
497 */ | |
498 | |
499 void dspl_Enable_Region(INT16 x1, INT16 y1, INT16 x2, INT16 y2) | |
500 { | |
501 #ifdef R2D_ENABLED | |
502 r2d_flush_region(x1, y1, x2, y2); | |
503 #endif | |
504 } | |
505 | |
506 | |
507 /* | |
508 +--------------------------------------------------------------------+ | |
509 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
510 | STATE : code ROUTINE : dspl_GetDeviceCaps | | |
511 +--------------------------------------------------------------------+ | |
512 | |
513 PURPOSE : This function is used to retrieve the capabilities of the | |
514 display device including the dimensions of the display and | |
515 the logical unit in which the dimensions is measured. | |
516 | |
517 */ | |
518 | |
519 GLOBAL void dspl_GetDeviceCaps (dspl_DevCaps * out_DeviceCapsPtr) | |
520 { | |
521 int x,y; | |
522 | |
523 scrSize (&x, &y); | |
524 | |
525 out_DeviceCapsPtr->Height = (USHORT)y; | |
526 out_DeviceCapsPtr->Width = (USHORT)x; | |
527 } | |
528 | |
529 /* | |
530 +--------------------------------------------------------------------+ | |
531 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
532 | STATE : code ROUTINE : dspl_SetDeviceCaps | | |
533 +--------------------------------------------------------------------+ | |
534 | |
535 PURPOSE : This function is used to set the capabilities of the | |
536 display device including the dimensions of the display and | |
537 the logical unit in which the dimensions is measured. | |
538 | |
539 */ | |
540 | |
541 GLOBAL void dspl_SetDeviceCaps (dspl_DevCaps * in_DeviceCapsPtr) | |
542 { | |
543 displayData.DisplayType = in_DeviceCapsPtr->DisplayType; | |
544 } | |
545 | |
546 /* | |
547 +--------------------------------------------------------------------+ | |
548 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
549 | STATE : code ROUTINE : dspl_GetIconImage | | |
550 +--------------------------------------------------------------------+ | |
551 | |
552 PURPOSE : This function is used to copy the image of a driver | |
553 internal icon into an application specific icon buffer. | |
554 The icon may modify the icon. In case of a successful | |
555 completion the function returns DRV_OK. In case the | |
556 size of the buffer where the icon image shall be copied | |
557 is too small the driver returns DRV_INVALID_PARAMS. In | |
558 case a specific driver implementation does not support | |
559 this functionality the driver returns DSPL_FCT_NOTSUPPORTED. | |
560 | |
561 */ | |
562 | |
563 GLOBAL UBYTE dspl_GetIconImage (UBYTE in_Icon, | |
564 USHORT in_Size, | |
565 UBYTE * out_IconImagePtr) | |
566 { | |
567 return DSPL_FCT_NOTSUPPORTED; | |
568 } | |
569 | |
570 /* | |
571 +--------------------------------------------------------------------+ | |
572 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
573 | STATE : code ROUTINE : dspl_SetCursor | | |
574 +--------------------------------------------------------------------+ | |
575 | |
576 PURPOSE : This function is used to change the current cursor settings. | |
577 These settings include the type of cursor and the mode | |
578 (e.g. static cursor, not flashing). A set of standard | |
579 types and modes is defined. | |
580 | |
581 */ | |
582 | |
583 GLOBAL UBYTE dspl_SetCursor (UBYTE in_CursorType, | |
584 UBYTE in_CursorMode) | |
585 { | |
586 return DRV_OK; | |
587 } | |
588 | |
589 /* | |
590 +--------------------------------------------------------------------+ | |
591 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
592 | STATE : code ROUTINE : dspl_SetCursorPos | | |
593 +--------------------------------------------------------------------+ | |
594 | |
595 PURPOSE : This function is used to set the current cursor position. | |
596 If the function succeeds, the cursor is set to the new | |
597 position. If one of the values is out of range, the function | |
598 returns DRV_INVALID_PARAMS. The number of rows and columns | |
599 the display supports can be retrieved using the function | |
600 dspl_GetDevCaps(). The upper left corner has the coordinates | |
601 0,0. The values in_X and in_Y are measured in logical units | |
602 depending on the capabilities of the device. The means a | |
603 graphical display will use pixels. | |
604 | |
605 GW 05/09/01 Added size x and size y parameters to allow for chinese chars. | |
606 */ | |
607 | |
608 GLOBAL UBYTE dspl_SetCursorPos (USHORT in_X, | |
609 USHORT in_Y, | |
610 USHORT in_SizeX, | |
611 USHORT in_SizeY | |
612 ) | |
613 { | |
614 if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER) | |
615 { | |
616 LCD_Cursor (in_Y, in_X); /* set cursor position */ | |
617 if (extDisplay) /* if external display */ | |
618 dspl_SendDisplayReq (in_X, in_Y, NULL); | |
619 } | |
620 else | |
621 scrLine(in_X,in_Y+in_SizeY-1,in_X+in_SizeX-1,in_Y+in_SizeY-1); | |
622 return DRV_OK; | |
623 } | |
624 | |
625 /* | |
626 +--------------------------------------------------------------------+ | |
627 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
628 | STATE : code ROUTINE : dspl_ShowCursor | | |
629 +--------------------------------------------------------------------+ | |
630 | |
631 PURPOSE : This function is used to change the status of the cursor. | |
632 The cursor can be visible or invisible. The function returns | |
633 the previous status of the cursor. | |
634 | |
635 */ | |
636 | |
637 GLOBAL UBYTE dspl_ShowCursor (UBYTE in_Show) | |
638 { | |
639 return DSPL_CURSOR_VISIBLE; | |
640 } | |
641 | |
642 | |
643 /* | |
644 +--------------------------------------------------------------------+ | |
645 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
646 | STATE : code ROUTINE : dspl_SetBkgColor | | |
647 +--------------------------------------------------------------------+ | |
648 | |
649 PURPOSE : This function is used to change the color used for | |
650 background painting. If the color is out of range, the | |
651 driver returns DRV_INVALID_PARAMS and leaves the color | |
652 unchanged. | |
653 | |
654 */ | |
655 | |
656 GLOBAL UBYTE dspl_SetBkgColor (UBYTE in_Color) | |
657 { | |
658 return DRV_OK; | |
659 } | |
660 | |
661 /* | |
662 +--------------------------------------------------------------------+ | |
663 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
664 | STATE : code ROUTINE : dspl_SetFrgColor | | |
665 +--------------------------------------------------------------------+ | |
666 | |
667 PURPOSE : This function is used to change the color used for | |
668 foreground painting, e.g. text color. If the color is | |
669 out of range, the driver returns DRV_INVALID_PARAMS and | |
670 leaves the color unchanged. | |
671 set a call-back function which | |
672 | |
673 */ | |
674 | |
675 GLOBAL UBYTE dspl_SetFrgColor (UBYTE in_Color) | |
676 { | |
677 return DSPL_FCT_NOTSUPPORTED; | |
678 } | |
679 | |
680 enum | |
681 { | |
682 COL_TYPE_FGD =0, | |
683 COL_TYPE_BGD, | |
684 COL_TYPE_HIGHLIGHT, | |
685 COL_TYPE_BORDER, | |
686 COL_TYPE_SHADOW, | |
687 MAX_COL_TYPE | |
688 }; | |
689 enum | |
690 { | |
691 COL_CMD_INIT, | |
692 COL_CMD_GET, | |
693 COL_CMD_SET, | |
694 COL_CMD_SETSHADOW, | |
695 COL_CMD_RESTORECOL, | |
696 MAX_COL_CMD | |
697 }; | |
698 | |
699 //This definition allows us to have a transparent colour in 256 colour bitmaps. | |
700 //We lose the colour nearly-black gray but I don't think it will be missed! | |
701 //Better to lose white than gray but will require all icons to be updated! | |
702 #define TRANSPARENT_256_COL 0x25 | |
703 | |
704 //This definition allows us to have a transparent colour in 16bit LCD colour bitmaps. | |
705 //We lose almost white R=0xF8 G=0xFC B=0xF8. NB word is inverted | |
706 #define TRANSPARENT_16BIT_COL 0x0020 | |
707 | |
708 //using ARGB format, transparent = 0xFFxxxxxx | |
709 #define TRANSPARENT_32BIT_COLOUR 0xFF000000 | |
710 | |
711 //Hide colours | |
712 LOCAL U32 colour_class (int cmd, int colId, U32 inColour) | |
713 { | |
714 static U32 g_col[MAX_COL_TYPE]; | |
715 static U32 g_colOld[MAX_COL_TYPE]; | |
716 switch (cmd) | |
717 { | |
718 case COL_CMD_INIT: | |
719 colour_class(COL_CMD_SET, COL_TYPE_FGD, 0x00404040 ); | |
720 colour_class(COL_CMD_SET, COL_TYPE_BGD, 0x00FFFFFF ); //white | |
721 colour_class(COL_CMD_SET, COL_TYPE_HIGHLIGHT, 0x00FF00FF ); | |
722 colour_class(COL_CMD_SET, COL_TYPE_BORDER, 0x00FFFFFF ); | |
723 colour_class(COL_CMD_SET, COL_TYPE_SHADOW, 0x40010101 ); //50% translucency | |
724 return (0); | |
725 break; | |
726 case COL_CMD_SET: | |
727 if (inColour != 0) | |
728 { | |
729 g_colOld[colId] = g_col[colId]; | |
730 g_col[colId] = inColour; | |
731 } | |
732 return(g_colOld[colId]); | |
733 break; | |
734 case COL_CMD_GET: | |
735 #ifdef COLOURDISPLAY | |
736 #ifdef DSAMPLE_COLOUR | |
737 return(g_col[colId]); | |
738 #endif | |
739 #else | |
740 switch (colId) | |
741 { | |
742 case COL_TYPE_FGD: return (0x00FFFFFF); | |
743 case COL_TYPE_BGD: return (0x00000000); | |
744 case COL_TYPE_HIGHLIGHT: return (0x00000000); | |
745 case COL_TYPE_BORDER: return (0x00000000); | |
746 case COL_TYPE_SHADOW: return (0x00000000); | |
747 default: return (0); | |
748 } | |
749 #endif | |
750 break; | |
751 case COL_CMD_SETSHADOW: | |
752 g_colOld[colId] = g_col[colId];//currently we dont really need to save the old value | |
753 // set shadow to 50% black | |
754 g_col[colId] = 0x40010101;// | ((inColour >> 2) & 0x003F3F3F); | |
755 return(0x40010101); | |
756 break; | |
757 case COL_CMD_RESTORECOL: | |
758 g_col[colId] = g_colOld[colId]; | |
759 return (0); | |
760 break; | |
761 default: | |
762 break; | |
763 } | |
764 return (0); | |
765 } | |
766 | |
767 GLOBAL U32 dspl_SetFgdColour (U32 inColour) { return (colour_class(COL_CMD_SET, COL_TYPE_FGD, inColour)); } | |
768 GLOBAL U32 dspl_SetBgdColour (U32 inColour) { return (colour_class(COL_CMD_SET, COL_TYPE_BGD, inColour)); } | |
769 GLOBAL U32 dspl_SetHighlightColour (U32 inColour) { return (colour_class(COL_CMD_SET, COL_TYPE_HIGHLIGHT, inColour)); } | |
770 GLOBAL U32 dspl_SetBorderColour (U32 inColour) { return (colour_class(COL_CMD_SET, COL_TYPE_BORDER, inColour)); } | |
771 GLOBAL U32 dspl_SetShadowColour (U32 inColour) { return (colour_class(COL_CMD_SETSHADOW, COL_TYPE_SHADOW, inColour)); } | |
772 | |
773 GLOBAL U32 dspl_GetFgdColour ( void ) { return (colour_class(COL_CMD_GET, COL_TYPE_FGD, 0)); } | |
774 GLOBAL U32 dspl_GetBgdColour ( void ) { return (colour_class(COL_CMD_GET, COL_TYPE_BGD, 0)); } | |
775 GLOBAL U32 dspl_GetHighlightColour ( void ) { return (colour_class(COL_CMD_GET, COL_TYPE_HIGHLIGHT, 0)); } | |
776 GLOBAL U32 dspl_GetBorderColour ( void ) { return (colour_class(COL_CMD_GET, COL_TYPE_BORDER, 0)); } | |
777 GLOBAL U32 dspl_GetShadowColour (void) { return (colour_class(COL_CMD_GET, COL_TYPE_SHADOW, 0)); } | |
778 | |
779 GLOBAL void dspl_InitColour (void) | |
780 { | |
781 colour_class(COL_CMD_INIT, 0, 0); | |
782 } | |
783 GLOBAL void dspl_RestoreColour (void) | |
784 { | |
785 colour_class(COL_CMD_RESTORECOL, COL_TYPE_FGD, 0); | |
786 colour_class(COL_CMD_RESTORECOL, COL_TYPE_BGD, 0); | |
787 } | |
788 | |
789 /* | |
790 +--------------------------------------------------------------------+ | |
791 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
792 | STATE : code ROUTINE : dspl_DrawIcon | | |
793 +--------------------------------------------------------------------+ | |
794 | |
795 PURPOSE : This function is used to draw a driver internal icon. | |
796 The origin of the icon is the upper left corner, defined | |
797 by the parameters in_X/in_Y. | |
798 | |
799 */ | |
800 | |
801 GLOBAL UBYTE dspl_DrawIcon (UBYTE in_IconID, | |
802 USHORT in_X, | |
803 USHORT in_Y) | |
804 { | |
805 return DSPL_FCT_NOTSUPPORTED; | |
806 } | |
807 | |
808 /* | |
809 +--------------------------------------------------------------------+ | |
810 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
811 | STATE : code ROUTINE : dspl_DrawLine | | |
812 +--------------------------------------------------------------------+ | |
813 | |
814 PURPOSE : This function is used to draw a line from a specific | |
815 location defined by the parameters in_X1/in_Y1, to a | |
816 specific location defined by the parameters in_X2/in_Y2. | |
817 The display´s origin is the upper left corner with the | |
818 co-ordinates (0,0). The function uses the current | |
819 foreground color, which can be set using the | |
820 dspl_SetFrgColor (), to draw the line. | |
821 | |
822 */ | |
823 | |
824 GLOBAL UBYTE dspl_DrawLine (USHORT in_X1, | |
825 USHORT in_Y1, | |
826 USHORT in_X2, | |
827 USHORT in_Y2) | |
828 { | |
829 scrLine(in_X1,in_Y1,in_X2,in_Y2); | |
830 | |
831 return DRV_OK; | |
832 } | |
833 | |
834 /* | |
835 +--------------------------------------------------------------------+ | |
836 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
837 | STATE : code ROUTINE : dspl_DrawRect | | |
838 +--------------------------------------------------------------------+ | |
839 | |
840 PURPOSE : This function is used to draw a rectangle. The upper left | |
841 corner of the rectangle is defined by the parameters | |
842 in_X1/in_Y1. The lower right corner of the rectangle is | |
843 defined by the parameters in_X2/in_Y2. | |
844 The display´s origin is the upper left corner with the | |
845 co-ordinates (0,0). The function uses the current | |
846 foreground color, which can be set using the | |
847 dspl_SetFrgColor (), to draw the rectangle. | |
848 | |
849 */ | |
850 | |
851 GLOBAL UBYTE dspl_roundRectFill (int px, | |
852 int py, | |
853 int sx, | |
854 int sy, | |
855 int border) | |
856 { | |
857 int i,j,col; | |
858 col = dspl_GetBgdColour(); | |
859 scrDrawFilledRect(px-border,py, sx+border*2,sy, col ); | |
860 scrDrawFilledRect(px,py-border, sx,sy+border*2, col ); | |
861 | |
862 for (i=0;i<border;i++) | |
863 for (j=0;j<border-i;j++) | |
864 { | |
865 scrPoint(px-i, py-j,col); | |
866 scrPoint(px+sx+i, py-j,col); | |
867 scrPoint(px+sx+i, py+sy+j,col); | |
868 scrPoint(px-i, py+sy+j,col); | |
869 } | |
870 | |
871 return DRV_OK; | |
872 } | |
873 GLOBAL UBYTE dspl_roundRect (int px, | |
874 int py, | |
875 int sx, | |
876 int sy, | |
877 int border) | |
878 { | |
879 scrLine(px ,py-border, px+sx,py-border); | |
880 scrLine(px,py+sy+border, px+sx,py+sy+border); | |
881 scrLine(px-border ,py, px-border,py+sy); | |
882 scrLine(px+sx+border,py, px+sx+border,py+sy); | |
883 | |
884 scrLine(px ,py-border, px-border ,py ); | |
885 scrLine(px,py+sy+border, px-border,py+sy ); | |
886 scrLine(px+sx,py+sy+border, px+sx+border,py+sy ); | |
887 scrLine(px+sx+border,py, px+sx,py-border ); | |
888 | |
889 return DRV_OK; | |
890 } | |
891 | |
892 GLOBAL UBYTE dspl_DrawRect (USHORT in_X1, | |
893 USHORT in_Y1, | |
894 USHORT in_X2, | |
895 USHORT in_Y2) | |
896 { | |
897 scrRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1); | |
898 | |
899 return DRV_OK; | |
900 } | |
901 | |
902 GLOBAL UBYTE dspl_DrawFilledRect (USHORT in_X1, | |
903 USHORT in_Y1, | |
904 USHORT in_X2, | |
905 USHORT in_Y2) | |
906 { | |
907 scrDrawFilledRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1, dspl_GetFgdColour() ); | |
908 return DRV_OK; | |
909 } | |
910 GLOBAL UBYTE dspl_DrawFilledBgdRect (USHORT in_X1, | |
911 USHORT in_Y1, | |
912 USHORT in_X2, | |
913 USHORT in_Y2) | |
914 { | |
915 scrDrawFilledRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1, dspl_GetBgdColour() ); | |
916 return DRV_OK; | |
917 } | |
918 GLOBAL UBYTE dspl_DrawFilledColRect (USHORT in_X1, | |
919 USHORT in_Y1, | |
920 USHORT in_X2, | |
921 USHORT in_Y2, | |
922 U32 Col) | |
923 { | |
924 scrDrawFilledRect(in_X1,in_Y1,in_X2-in_X1,in_Y2-in_Y1, Col ); | |
925 return DRV_OK; | |
926 } | |
927 /* | |
928 +--------------------------------------------------------------------+ | |
929 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
930 | STATE : code ROUTINE : dspl_DrawEllipse | | |
931 +--------------------------------------------------------------------+ | |
932 | |
933 PURPOSE : This function is used to draw an ellipse. The center of | |
934 the ellipse is the center of the bounding rectangle | |
935 specified by the parameters. | |
936 The display´s origin is the upper left corner with the | |
937 co-ordinates (0,0). The function uses the current | |
938 foreground color, which can be set using the | |
939 dspl_SetFrgColor (), to draw the ellipse. | |
940 | |
941 */ | |
942 | |
943 GLOBAL UBYTE dspl_DrawEllipse (USHORT in_X1, | |
944 USHORT in_Y1, | |
945 USHORT in_X2, | |
946 USHORT in_Y2) | |
947 { | |
948 return DSPL_FCT_NOTSUPPORTED; | |
949 } | |
950 | |
951 | |
952 | |
953 | |
954 /* | |
955 +--------------------------------------------------------------------+ | |
956 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
957 | STATE : code ROUTINE : dspl_BitBlt | | |
958 +--------------------------------------------------------------------+ | |
959 | |
960 PURPOSE : This function is used to display a bitmap at the | |
961 specified location using the raster operation provided. | |
962 The bitmap format is customer specific but must include | |
963 the size of the bitmap. | |
964 | |
965 | |
966 */ | |
967 | |
968 GLOBAL UBYTE dspl_BitBlt2(short in_X, | |
969 short in_Y, | |
970 USHORT in_Width, | |
971 USHORT in_Height, | |
972 void * in_BmpPtr, | |
973 USHORT in_index, | |
974 int bmpFormat) | |
975 { | |
976 t_font_bitmap current_bitmap; | |
977 char *bmpPtr; | |
978 int bmpSize; | |
979 int fScale = 1; | |
980 int attr = SHOWBITMAP_NORMAL; | |
981 bmpPtr = (char *)in_BmpPtr; | |
982 if (bmpFormat == BMP_FORMAT_256_COLOUR) | |
983 { | |
984 bmpSize = in_Height*in_Width; //bitmaps are 256 colour | |
985 bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states | |
986 } | |
987 else if (bmpFormat == BMP_FORMAT_32BIT_COLOUR) | |
988 { | |
989 bmpSize = in_Height*in_Width; //bitmaps are 256 colour | |
990 bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states | |
991 } | |
992 else if (bmpFormat == BMP_FORMAT_16BIT_LCD_COLOUR) | |
993 { | |
994 #ifdef DSAMPLE_COLOUR32 | |
995 fastCopyBitmap(in_X,in_Y, // start position of bitmap | |
996 in_Width, in_Height, //size of bitmap | |
997 (char*) in_BmpPtr, | |
998 in_X,in_Y, // start position of output area | |
999 in_Width, in_Height, //size of output area | |
1000 dspl_GetBgdColour(), bmpFormat); | |
1001 return DRV_OK; | |
1002 #else | |
1003 bmpSize = in_Height*in_Width*4; //bitmaps are 16bit colour | |
1004 bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states | |
1005 #endif | |
1006 } | |
1007 else if (bmpFormat == BMP_FORMAT_16BIT_LCD_COMPRESSED_COLOUR) | |
1008 { | |
1009 #ifdef DSAMPLE_COLOUR16 | |
1010 fastCopyBitmap(in_X,in_Y, // start position of bitmap | |
1011 in_Width, in_Height, //size of bitmap | |
1012 (char*) in_BmpPtr, | |
1013 in_X,in_Y, // start position of output area | |
1014 in_Width, in_Height, //size of output area | |
1015 dspl_GetBgdColour(), bmpFormat); | |
1016 return DRV_OK; | |
1017 #else | |
1018 bmpSize = in_Height*in_Width*2; //bitmaps are 16bit colour | |
1019 bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states | |
1020 #endif | |
1021 } | |
1022 else //b+w image | |
1023 { | |
1024 #ifdef MMI_TRACE | |
1025 mmi_trace("b+w image"); | |
1026 #endif | |
1027 if (bmpFormat == BMP_FORMAT_BW_2x4 ) | |
1028 { | |
1029 //Temp fix to display larger b+w bitmaps (160x124) | |
1030 attr = SHOWBITMAP_SCALE_2x4; | |
1031 in_Width = in_Width /2; | |
1032 in_Height = in_Height /4; | |
1033 #ifdef MMI_TRACE | |
1034 mmi_trace("Icontype = scale 2x4"); | |
1035 #endif | |
1036 } | |
1037 | |
1038 bmpSize = in_Height*((in_Width+7) >> 3); //bitmaps are unpacked | |
1039 bmpPtr = &bmpPtr[bmpSize*in_index]; //for bitmaps that have multiple states | |
1040 | |
1041 } | |
1042 current_bitmap.height = in_Height; | |
1043 current_bitmap.width = in_Width; | |
1044 current_bitmap.bitmapSize = 0;// bmpSize; | |
1045 current_bitmap.bitmap = bmpPtr; | |
1046 current_bitmap.format = bmpFormat; | |
1047 dspl_show_bitmap(in_X,in_Y, ¤t_bitmap, attr); | |
1048 | |
1049 return DRV_OK; | |
1050 | |
1051 } | |
1052 | |
1053 GLOBAL UBYTE dspl_BitBlt (USHORT in_X, | |
1054 USHORT in_Y, | |
1055 USHORT in_Width, | |
1056 USHORT in_Height, | |
1057 USHORT in_Index, | |
1058 void * in_BmpPtr, | |
1059 USHORT in_Rop) | |
1060 { | |
1061 #ifdef BSAMPLE | |
1062 //Use old procedure | |
1063 scrBmpDraw ((int)in_X, (int) in_Y, (int) in_Width, | |
1064 (int)in_Height, (int)in_Index, | |
1065 (char *)in_BmpPtr, (int)in_Rop); | |
1066 return DRV_OK; | |
1067 #else | |
1068 return (dspl_BitBlt2( (short) in_X, (short) in_Y, in_Width, in_Height, in_BmpPtr, in_Index, BMP_FORMAT_BW_UNPACKED)); | |
1069 #endif | |
1070 | |
1071 } | |
1072 | |
1073 /* | |
1074 +--------------------------------------------------------------------+ | |
1075 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1076 | STATE : code ROUTINE : dspl_SelectFontbyID | | |
1077 +--------------------------------------------------------------------+ | |
1078 | |
1079 PURPOSE : This function is used to select a font used for | |
1080 displaying text. Text can be displayed using the | |
1081 functions dspl_TextOut_Cmode. | |
1082 Driver specific fonts are identified be a font ID | |
1083 (parameter in_Font). The definition of fonts and font | |
1084 identifiers is not in scope of G23. Fonts and font | |
1085 identifiers have to be defined by the customer. The | |
1086 specific implementation of the display driver and the MMI | |
1087 using the driver have the knowledge about the available | |
1088 fonts, their identification and how to use them. | |
1089 | |
1090 */ | |
1091 | |
1092 GLOBAL UBYTE dspl_SelectFontbyID (UBYTE in_Font) | |
1093 { | |
1094 return DSPL_FCT_NOTSUPPORTED; | |
1095 } | |
1096 | |
1097 /* | |
1098 +--------------------------------------------------------------------+ | |
1099 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1100 | STATE : code ROUTINE : dspl_SelectFontbyImage | | |
1101 +--------------------------------------------------------------------+ | |
1102 | |
1103 PURPOSE : This function is used to select a font used for | |
1104 displaying text. Text can be displayed using the | |
1105 functions dspl_TextOut_Cmode. | |
1106 Application specific fonts are identified by the parameter | |
1107 in_FontPtr, the address of the buffer containing the | |
1108 application specific font. The structure of the font image | |
1109 in not in the scope of G23. The structure of the font images | |
1110 have to be defined by the customer implementing the driver. | |
1111 | |
1112 */ | |
1113 | |
1114 GLOBAL UBYTE dspl_SelectFontbyImage (UBYTE * in_FontPtr) | |
1115 { | |
1116 return DSPL_FCT_NOTSUPPORTED; | |
1117 } | |
1118 | |
1119 /* | |
1120 +--------------------------------------------------------------------+ | |
1121 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1122 | STATE : code ROUTINE : dspl_GetFontImage | | |
1123 +--------------------------------------------------------------------+ | |
1124 | |
1125 PURPOSE : This function is used to copy the image of a font into an | |
1126 application specific font buffer. The application may modify | |
1127 the font. In case of a successful completion the function | |
1128 returns DRV_OK. In case the size of the buffer where the | |
1129 font image shall be copied to is too small the driver returns | |
1130 DRV_INVALID_PARAMS. In case a specific driver implementation | |
1131 does not support this functionality the driver returns | |
1132 DSPL_FCT_NOTSUPPORTED. | |
1133 | |
1134 */ | |
1135 | |
1136 GLOBAL UBYTE dspl_GetFontImage (UBYTE in_Font, | |
1137 USHORT in_Size, | |
1138 UBYTE * out_FontPtr) | |
1139 { | |
1140 return DSPL_FCT_NOTSUPPORTED; | |
1141 } | |
1142 | |
1143 /* | |
1144 +--------------------------------------------------------------------+ | |
1145 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1146 | STATE : code ROUTINE : dspl_GetFontHeight | | |
1147 +--------------------------------------------------------------------+ | |
1148 | |
1149 PURPOSE : This function is used to retrieve the vertical size of | |
1150 the currently selected font. The function returns the | |
1151 height measured in logical units depending on the device | |
1152 capabilities (e.g. pixels or multiple of characters). Call | |
1153 the function dspl_SelectFont() to select a font. | |
1154 | |
1155 */ | |
1156 | |
1157 GLOBAL UBYTE dspl_GetFontHeight (void) | |
1158 { | |
1159 return scrFntHeight(); | |
1160 } | |
1161 | |
1162 /* | |
1163 +--------------------------------------------------------------------+ | |
1164 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1165 | STATE : code ROUTINE : dspl_GetTextExtent | | |
1166 +--------------------------------------------------------------------+ | |
1167 | |
1168 PURPOSE : This function is used to calculate the size of a 0-terminated | |
1169 string, to which the parameter in_Text points. The function | |
1170 returns the size needed to display the text. The value of | |
1171 the size is measured in units depending on the device | |
1172 capabilities (e.g. pixels or multiple of characters). Call | |
1173 the function dspl_SelectFont() to select a font. | |
1174 | |
1175 */ | |
1176 | |
1177 GLOBAL USHORT dspl_GetTextExtent_old (char * in_Text, USHORT in_Length) | |
1178 { | |
1179 if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER) | |
1180 return in_Length; | |
1181 else | |
1182 return scrFntGetLen ( in_Text, ( int ) in_Length ); | |
1183 } | |
1184 | |
1185 | |
1186 GLOBAL USHORT dspl_GetTextExtent (char * in_Text, USHORT in_Length) | |
1187 { | |
1188 int nPixel=0; | |
1189 int nChar = in_Length; | |
1190 if (in_Text==NULL) | |
1191 return(0); | |
1192 | |
1193 if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER ) | |
1194 { | |
1195 return in_Length; | |
1196 } | |
1197 scrGetRealLength(in_Text, &nChar, &nPixel); | |
1198 | |
1199 return (nPixel); | |
1200 } | |
1201 | |
1202 | |
1203 | |
1204 | |
1205 | |
1206 int dspl_GetTextExtent2 (char * in_Text, USHORT in_Length) | |
1207 { | |
1208 return (dspl_GetTextExtent ( in_Text, in_Length)); | |
1209 | |
1210 } | |
1211 /* | |
1212 +--------------------------------------------------------------------+ | |
1213 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1214 | STATE : code ROUTINE : dspl_GetNcharToFit | | |
1215 +--------------------------------------------------------------------+ | |
1216 | |
1217 PURPOSE : This function is used to calculate the number of characters of the input | |
1218 string that will fit into the specified width. | |
1219 | |
1220 */ | |
1221 /*SPR 1541, added function*/ | |
1222 //Calculate number of chars that fit in the available space. | |
1223 GLOBAL USHORT dspl_GetNcharToFit (char * in_Text, USHORT pixelWidth) | |
1224 { | |
1225 int nPixel=pixelWidth; | |
1226 int nChar= 0; | |
1227 if (in_Text==NULL) | |
1228 return(0); | |
1229 | |
1230 scrGetRealLength(in_Text, &nChar, &nPixel); | |
1231 | |
1232 return (nChar); | |
1233 } | |
1234 /* | |
1235 +--------------------------------------------------------------------+ | |
1236 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1237 | STATE : code ROUTINE : dspl_GetMaxTextLen | | |
1238 +--------------------------------------------------------------------+ | |
1239 | |
1240 PURPOSE : This function is used to calculate the sub-string | |
1241 (number of characters) of a 0-terminated string (in_Text) | |
1242 that can be displayed in the region given by the parameter | |
1243 in_HSize. The value of in_HSize is measured in logical | |
1244 units (e.g. pixels or multiple of characters). Call | |
1245 the function dspl_SelectFont() to select a font. | |
1246 | |
1247 */ | |
1248 | |
1249 GLOBAL USHORT dspl_GetMaxTextLen (char * in_Text, | |
1250 USHORT in_HSize) | |
1251 { | |
1252 if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER) | |
1253 return strlen (in_Text); | |
1254 else | |
1255 return scrFntGetFit ( in_Text, ( int ) in_HSize ); | |
1256 } | |
1257 | |
1258 | |
1259 | |
1260 | |
1261 GLOBAL void dspl_set_char_type(UBYTE char_type){ | |
1262 dspl_char_type = char_type; | |
1263 } | |
1264 | |
1265 GLOBAL UBYTE dspl_get_char_type(void){ | |
1266 return dspl_char_type; | |
1267 } | |
1268 | |
1269 int dspl_getDisplayType( void ) | |
1270 { | |
1271 | |
1272 #ifndef COLOURDISPLAY | |
1273 return (DSPL_BW); | |
1274 #endif | |
1275 | |
1276 #ifdef R2D_ENABLED | |
1277 if (R2D_LCD_DISPLAY == R2D_COLOR) | |
1278 return (DSPL_COLOUR); | |
1279 else | |
1280 #endif | |
1281 return (DSPL_BW); | |
1282 } | |
1283 | |
1284 /* | |
1285 +--------------------------------------------------------------------+ | |
1286 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1287 | STATE : code ROUTINE : dspl_TextOut_Cmode | | |
1288 +--------------------------------------------------------------------+ | |
1289 | |
1290 PURPOSE : This function is used to display a text at the given | |
1291 location in_X/in_Y uding the defined attributes (in_Attrib) | |
1292 and the currently selected color (foreground and background). | |
1293 The cursor position is left unchanged. The driver will not | |
1294 take the displays bounding rectangle into consideration and | |
1295 therefore text may be cut off. | |
1296 Linefeeds and carriage returns are not supported and there- | |
1297 fore must be handled by upper layers. | |
1298 | |
1299 GW 14/02/03 - SPR#1736 Modified code to call 'dspl_ScrText' to allow a border to be drawn | |
1300 round chinese characters. | |
1301 | |
1302 */ | |
1303 | |
1304 | |
1305 GLOBAL UBYTE dspl_TextOut_Cmode (USHORT in_X, | |
1306 USHORT in_Y, | |
1307 UBYTE in_Attrib, | |
1308 char * in_Text) | |
1309 { | |
1310 int in_X_signed; | |
1311 int in_Y_signed; | |
1312 int txtStyle=0; | |
1313 // SH - If we want signed coordinates (i.e. if x and y can have negative numbers) | |
1314 // we need to convert the unsigned values into two's complement. | |
1315 | |
1316 if (in_Attrib & DSPL_TXTATTR_SIGNED_COORDS) | |
1317 { | |
1318 in_X_signed = (SHORT)in_X; | |
1319 in_Y_signed = (SHORT)in_Y; | |
1320 } | |
1321 else | |
1322 { | |
1323 in_X_signed = in_X; | |
1324 in_Y_signed = in_Y; | |
1325 } | |
1326 | |
1327 #if defined (WIN32) | |
1328 if (scrEnabled) | |
1329 { | |
1330 if (in_Attrib & DSPL_TXTATTR_INVERS) | |
1331 { | |
1332 scrText_Invert(in_X, in_Y, in_Text); | |
1333 } | |
1334 else | |
1335 { | |
1336 scrText(in_X, in_Y, in_Text); | |
1337 } | |
1338 } | |
1339 else | |
1340 LCD_WriteString (in_Y, in_X, (UBYTE *) in_Text); | |
1341 #else | |
1342 if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER) | |
1343 { | |
1344 if (in_Attrib & DSPL_TXTATTR_INVERS) | |
1345 { | |
1346 if (dspl_char_type == DSPL_TYPE_ASCII) | |
1347 scrText_Invert(6 * in_X + 2, 8 * in_Y, in_Text); | |
1348 else | |
1349 scrText_Invert_Unicode(12 * in_X + 2, 12 * in_Y,(USHORT*) in_Text); | |
1350 } | |
1351 else | |
1352 { | |
1353 if (dspl_char_type == DSPL_TYPE_ASCII) | |
1354 scrText(6 * in_X_signed + 2, 8 * in_Y_signed, in_Text); | |
1355 else | |
1356 scrText_Unicode(12 * in_X_signed + 2, 12 * in_Y_signed, (USHORT*)in_Text); | |
1357 } | |
1358 } | |
1359 else | |
1360 { | |
1361 txtStyle = 0; | |
1362 if (in_Attrib & DSPL_TXTATTR_INVERS) | |
1363 txtStyle = TXT_STYLE_INVERT; | |
1364 else | |
1365 txtStyle = TXT_STYLE_NORMAL; | |
1366 if (dspl_char_type != DSPL_TYPE_ASCII) | |
1367 txtStyle = txtStyle | TXT_STYLE_UNICODE; | |
1368 dspl_ScrText( in_X_signed,in_Y_signed,in_Text, txtStyle); | |
1369 // scrText_Unicode(in_X_signed,in_Y_signed, (USHORT*)in_Text); | |
1370 | |
1371 } | |
1372 #endif | |
1373 /* | |
1374 * if an external display simulation is used and switched on with the | |
1375 * EXT_DISPLAY config primitive - send a MMI_DISPLAY_REQ primitive. | |
1376 */ | |
1377 if (extDisplay) | |
1378 dspl_SendDisplayReq (in_X, in_Y, in_Text); | |
1379 | |
1380 return DRV_OK; | |
1381 } | |
1382 | |
1383 /* | |
1384 +--------------------------------------------------------------------+ | |
1385 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1386 | STATE : code ROUTINE : dspl_TextOut | | |
1387 +--------------------------------------------------------------------+ | |
1388 | |
1389 PURPOSE : This function is used to display a text at the given | |
1390 location in_X/in_Y using the defined attributes (in_Attrib) | |
1391 It calls dspl_ScrText to actually display the text | |
1392 | |
1393 GW 14/02/03 - SPR#1736 Modified code to call 'dspl_ScrText' to allow a border to be drawn | |
1394 round chinese characters. | |
1395 */ | |
1396 | |
1397 GLOBAL UBYTE dspl_TextOut(USHORT in_X, | |
1398 USHORT in_Y, | |
1399 UBYTE in_Attrib, | |
1400 char * in_Text) | |
1401 { | |
1402 UBYTE temp; | |
1403 int in_X_signed; | |
1404 int in_Y_signed; | |
1405 int txtStyle=0; | |
1406 char* op_str; | |
1407 | |
1408 /*MC SPR 1319*/ | |
1409 if (in_Text == NULL) | |
1410 return DRV_OK; | |
1411 /*MC end*/ | |
1412 | |
1413 op_str = in_Text; | |
1414 | |
1415 #if defined (WIN32) | |
1416 if (!scrEnabled) | |
1417 { | |
1418 LCD_WriteString (in_Y, in_X, (UBYTE *) in_Text); | |
1419 } | |
1420 else | |
1421 #endif | |
1422 { | |
1423 | |
1424 if (in_Attrib & DSPL_TXTATTR_SIGNED_COORDS) | |
1425 { | |
1426 in_X_signed = (SHORT)in_X; | |
1427 in_Y_signed = (SHORT)in_Y; | |
1428 } | |
1429 else | |
1430 { | |
1431 in_X_signed = in_X; | |
1432 in_Y_signed = in_Y; | |
1433 } | |
1434 | |
1435 /*Mc SPR 1526, we no longer check for current mode*/ | |
1436 if (in_Attrib & DSPL_TXTATTR_INVERS) | |
1437 txtStyle = TXT_STYLE_INVERT; | |
1438 else | |
1439 txtStyle = TXT_STYLE_NORMAL; | |
1440 | |
1441 | |
1442 if ((in_Attrib&DSPL_TXTATTR_UNICODE) || (in_Text[0] ==0x80)) | |
1443 { | |
1444 txtStyle = txtStyle | TXT_STYLE_UNICODE; | |
1445 if (op_str[0] ==0x80)//if unicode tag at beginning of string | |
1446 op_str = &op_str[2]; | |
1447 } | |
1448 if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER) | |
1449 { | |
1450 /* the following is only accurate for a fixed-width font*/ | |
1451 if (txtStyle & TXT_STYLE_UNICODE) | |
1452 { | |
1453 in_X_signed = in_X_signed*12+2; | |
1454 in_Y_signed = in_Y_signed*12; | |
1455 } | |
1456 else | |
1457 { | |
1458 in_X_signed = in_X_signed*6+2; | |
1459 in_Y_signed = in_Y_signed*8; | |
1460 } | |
1461 } | |
1462 | |
1463 dspl_ScrText( in_X_signed,in_Y_signed,op_str, txtStyle); | |
1464 } | |
1465 /* | |
1466 * if an external display simulation is used and switched on with the | |
1467 * EXT_DISPLAY config primitive - send a MMI_DISPLAY_REQ primitive. | |
1468 */ | |
1469 if (extDisplay) | |
1470 dspl_SendDisplayReq (in_X, in_Y, in_Text); | |
1471 | |
1472 return DRV_OK; | |
1473 } | |
1474 /**/ | |
1475 | |
1476 | |
1477 | |
1478 /* | |
1479 +--------------------------------------------------------------------+ | |
1480 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1481 | STATE : code ROUTINE : dspl_SetWorkShadow | | |
1482 +--------------------------------------------------------------------+ | |
1483 | |
1484 PURPOSE : This function is used to define the address of the | |
1485 shadow RAM for drawing operations. | |
1486 | |
1487 */ | |
1488 | |
1489 GLOBAL UBYTE dspl_SetWorkShadow (UBYTE * in_ShadowPtr) | |
1490 { | |
1491 return DSPL_FCT_NOTSUPPORTED; | |
1492 } | |
1493 | |
1494 /* | |
1495 +--------------------------------------------------------------------+ | |
1496 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1497 | STATE : code ROUTINE : dspl_SetDisplayShadow | | |
1498 +--------------------------------------------------------------------+ | |
1499 | |
1500 PURPOSE : This function is used to define the address of the | |
1501 shadow RAM for displaying operations. | |
1502 | |
1503 */ | |
1504 | |
1505 GLOBAL UBYTE dspl_SetDisplayShadow (UBYTE * in_ShadowPtr) | |
1506 { | |
1507 return DSPL_FCT_NOTSUPPORTED; | |
1508 } | |
1509 | |
1510 | |
1511 /* | |
1512 +--------------------------------------------------------------------+ | |
1513 | PROJECT : GSM-PS (6147) MODULE : SMI_WM | | |
1514 | STATE : code ROUTINE : dspl_SendDisplayReq | | |
1515 +--------------------------------------------------------------------+ | |
1516 | |
1517 PURPOSE : sends an MMI_DISPLAY_REQ primitive to write | |
1518 the text at position X,Y to PL. If the parameter | |
1519 text is NULL only the cursor position | |
1520 should change. If in this case the X and Y value | |
1521 is 0xffff the cursor will be hide. | |
1522 | |
1523 */ | |
1524 LOCAL void dspl_SendDisplayReq (USHORT x, USHORT y, char *text) | |
1525 { | |
1526 #ifdef NEW_FRAME | |
1527 T_QMSG Msg; | |
1528 T_VOID_STRUCT *prim; | |
1529 #endif | |
1530 | |
1531 USHORT sdu_len = (text NEQ NULL) ? strlen (text) : 0; | |
1532 PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, (USHORT)(sdu_len<<3)); | |
1533 | |
1534 mmi_display_req->c_x = x; | |
1535 mmi_display_req->c_y = y; | |
1536 | |
1537 if (text NEQ NULL) | |
1538 { | |
1539 /* | |
1540 * text output | |
1541 */ | |
1542 mmi_display_req->attrib.content = CON_TEXT; | |
1543 mmi_display_req->attrib.control = CTL_NORMAL; | |
1544 mmi_display_req->sdu.o_buf = 0; | |
1545 mmi_display_req->sdu.l_buf = (sdu_len<<3); | |
1546 memcpy (mmi_display_req->sdu.buf, text, sdu_len); | |
1547 } | |
1548 else | |
1549 { | |
1550 /* | |
1551 * change the cursor position | |
1552 */ | |
1553 mmi_display_req->attrib.content = CON_CURSOR; | |
1554 mmi_display_req->attrib.control = ((x EQ 0xffff) ? CTL_HIDDEN : CTL_NORMAL); | |
1555 mmi_display_req->sdu.o_buf = 0; | |
1556 mmi_display_req->sdu.l_buf = 0; | |
1557 } | |
1558 | |
1559 #if defined NEW_FRAME | |
1560 if ( hCommMMI == VSI_ERROR ) | |
1561 { | |
1562 mmi_handle = vsi_e_handle ( 0, "MMI" ); | |
1563 hCommMMI = vsi_c_open ( 0, "MMI" ); | |
1564 prim = vsi_c_pnew ( 100, 0x8000 FILE_LINE_MACRO ); | |
1565 strcpy ((char*)prim, "REDIRECT MMI 0000111000001010 PAN"); | |
1566 vsi_c_primitive ( mmi_handle, D2P(prim) ); | |
1567 } | |
1568 PSEND(hCommMMI,mmi_display_req); | |
1569 | |
1570 #else | |
1571 ext_primitive (D2P(mmi_display_req), "CST", "PAN", | |
1572 sizeof (T_PRIM_HEADER) + | |
1573 sizeof (T_MMI_DISPLAY_REQ) + | |
1574 sdu_len); | |
1575 PFREE (mmi_display_req); | |
1576 #endif | |
1577 } | |
1578 | |
1579 GLOBAL UBYTE dspl_DrawWin (USHORT px, USHORT py, USHORT sx, USHORT sy, int format, t_font_bitmap *bgdBmp) | |
1580 { | |
1581 USHORT x1,y1,x2,y2; | |
1582 int xOfs,yOfs; | |
1583 | |
1584 if (bgdBmp == NULL) | |
1585 { | |
1586 scrDrawFilledRect( px+3,py+3, sx, sy, 0x00010101 ); //shadow | |
1587 scrDrawFilledRect( px,py, sx, sy, dspl_GetBgdColour() ); | |
1588 | |
1589 scrRect( px-1,py-1, sx+1, sy+1); | |
1590 } | |
1591 else | |
1592 { | |
1593 xOfs = (sx-bgdBmp->width)/2; | |
1594 yOfs = (sy-bgdBmp->height)/2; | |
1595 | |
1596 dspl_GetWindow(&x1,&y1,&x2,&y2 ); | |
1597 | |
1598 switch (format) | |
1599 { | |
1600 case DSPL_WIN_NORMAL: | |
1601 dspl_show_bitmap(px, py, bgdBmp, SHOWBITMAP_NORMAL ); | |
1602 break; | |
1603 case DSPL_WIN_CENTRE: | |
1604 dspl_show_bitmap(px+xOfs, py+yOfs, bgdBmp, SHOWBITMAP_NORMAL ); | |
1605 break; | |
1606 case DSPL_WIN_CLIP: | |
1607 dspl_SetWindow(px,py,px+sx,px+sy ); | |
1608 dspl_show_bitmap(px, py, bgdBmp, SHOWBITMAP_NORMAL ); | |
1609 break; | |
1610 case DSPL_WIN_CENTRE_CLIP: | |
1611 dspl_SetWindow(px,py,px+sx,px+sy ); | |
1612 dspl_show_bitmap(px+xOfs, py+yOfs, bgdBmp, SHOWBITMAP_NORMAL ); | |
1613 break; | |
1614 case DSPL_WIN_TILE: | |
1615 dspl_SetWindow(px,py,px+sx,px+sy ); | |
1616 yOfs=0; | |
1617 while(yOfs < sy) | |
1618 { | |
1619 xOfs=0; | |
1620 while (xOfs < sx) | |
1621 { | |
1622 dspl_show_bitmap(px+xOfs, py+yOfs, bgdBmp, SHOWBITMAP_NORMAL ); | |
1623 xOfs=xOfs+bgdBmp->width; | |
1624 } | |
1625 yOfs=yOfs+bgdBmp->height; | |
1626 } | |
1627 break; | |
1628 } | |
1629 dspl_SetWindow(x1,y1,x2,y2 ); | |
1630 } | |
1631 | |
1632 /* switch (format) | |
1633 { | |
1634 case 0: | |
1635 default: | |
1636 break; | |
1637 }*/ | |
1638 return DRV_OK; | |
1639 } | |
1640 static int win_x1, win_x2, win_y1, win_y2; | |
1641 | |
1642 //Set-up area to be drawn in - limit window to the size of the screen | |
1643 //Inputs in_x1/y1 - first column/row that can be drawn on | |
1644 // in_x2/y2 - last column/row | |
1645 //NB:- inputs are the same as used to clear/draw rectangles BUT | |
1646 // values stored in win_x2/y2 are +1 to ensure values are treated the same as scrX/Y | |
1647 GLOBAL UBYTE dspl_SetWindow(USHORT in_X1, | |
1648 USHORT in_Y1, | |
1649 USHORT in_X2, | |
1650 USHORT in_Y2) | |
1651 { | |
1652 int sizeX,sizeY; | |
1653 | |
1654 scrSize (&sizeX, &sizeY); | |
1655 if (in_X1>0) | |
1656 win_x1 = in_X1; | |
1657 else | |
1658 win_x1 = 0; | |
1659 if (in_Y1>0) | |
1660 win_y1 = in_Y1; | |
1661 else | |
1662 win_y1 = 0; | |
1663 if (in_X2<sizeX) | |
1664 win_x2 = in_X2+1; | |
1665 else | |
1666 win_x2 = sizeX; | |
1667 if (in_Y2<sizeY) | |
1668 win_y2 = in_Y2+1; | |
1669 else | |
1670 win_y2 = sizeY; | |
1671 return DRV_OK; | |
1672 | |
1673 } | |
1674 | |
1675 GLOBAL UBYTE dspl_ResetWindow( void ) | |
1676 { | |
1677 win_x1 = 0; | |
1678 win_y1 = 0; | |
1679 scrSize (&win_x2, &win_y2); | |
1680 | |
1681 return DRV_OK; | |
1682 | |
1683 } | |
1684 | |
1685 GLOBAL UBYTE dspl_GetWindow(USHORT* x1,USHORT* y1,USHORT* x2,USHORT* y2 ) | |
1686 { | |
1687 *x1= win_x1; | |
1688 *x2= win_x2; | |
1689 *y1= win_y1; | |
1690 *y2= win_y2; | |
1691 return DRV_OK; | |
1692 | |
1693 } | |
1694 | |
1695 | |
1696 /******************************************************************* | |
1697 * * | |
1698 * PART II: Workaround for Graphical Displays * | |
1699 * * | |
1700 *******************************************************************/ | |
1701 //June 03, 2005 REF: GSM-ENH-31636 xpradipg | |
1702 //CRR 28825: xpradipg - 11 Feb 2005 | |
1703 #if (defined(DSAMPLE) || defined(ESAMPLE) || defined(ISAMPLE) || defined(CALLISTO)) | |
1704 /*GW 21/02/03 - There is an unused long word at the end of each line for the new drivers for some good reason I'm sure.*/ | |
1705 #ifdef DSAMPLE_COLOUR16 | |
1706 #define LCD_COL (R2D_WIDTH+1) /* display size+32 bits */ | |
1707 #else | |
1708 #define LCD_COL (R2D_WIDTH) /* display size */ | |
1709 #endif | |
1710 #define LCD_ROW (R2D_HEIGHT) | |
1711 #define HEADER_INFO (3) | |
1712 #define DISPLAY_SIZE (LCD_ROW*LCD_ROW_NUM_LWORDS) | |
1713 /* static char scratch [100]; *//* command buffer - does not support output of new display */ | |
1714 #ifndef DSAMPLE_LITE | |
1715 unsigned char bgdColourArray[LCD_COL*4]; | |
1716 #endif | |
1717 #endif | |
1718 | |
1719 #ifdef CSAMPLE | |
1720 #define LCD_COL 84 /* display size */ | |
1721 #define LCD_ROW 48 | |
1722 #define LCD_COL_NUM_LWORDS ((LCD_ROW+31)/32) /* col size in longwords */ | |
1723 #endif //CSAMPLE | |
1724 | |
1725 #ifdef BSAMPLE | |
1726 #define LCD_COL 84 /* display size */ | |
1727 #define LCD_COL_B ((LCD_COL+7)/8) /* row size in byte */ | |
1728 #define LCD_ROW 48 | |
1729 #define DISPL_DIV 4 | |
1730 #endif | |
1731 | |
1732 /* | |
1733 LCD_ROW_NUM_LWORDS - number of long words used to store a row of pixels | |
1734 BYTEPERPIXEL - number of bytes used to store apixel on-screen | |
1735 */ | |
1736 | |
1737 #define CHECK_LIMITS /*Add bounds checks to code */ | |
1738 /******************************************************************************* | |
1739 $Macro: DSPL_SET_BITCOLOUR | |
1740 $Description: This macro sets the colour of the bit at the provided long word address | |
1741 $Returns: None. | |
1742 $Arguments: x - x position of pixel (may be unused) | |
1743 j - 32 bit offset within array of the pixel to be set | |
1744 col - colour (in LCD format) of the pixel to be set | |
1745 txt - debug text for traces - used if 'j' is bounds checked first. | |
1746 *******************************************************************************/ | |
1747 /******************************************************************************* | |
1748 $Macro: DSPL_GET_LWORD | |
1749 $Description: This macro | |
1750 $Returns: The 32bit offset of the word containing the pixel | |
1751 $Arguments: px - x position of pixel | |
1752 py - y position of pixel | |
1753 *******************************************************************************/ | |
1754 /******************************************************************************* | |
1755 $Macro: DSPL_GET_BYTE | |
1756 $Description: This macro | |
1757 $Returns: The 8bit offset of the word containing the pixel | |
1758 $Arguments: px - x position of pixel | |
1759 py - y position of pixel | |
1760 *******************************************************************************/ | |
1761 /******************************************************************************* | |
1762 $Macro: DSPL_GET_BITCOLOUR | |
1763 $Description: This macro | |
1764 $Returns: The colour in LCD format of the RGB input | |
1765 $Arguments: col - 32 bit RGB colour value | |
1766 *******************************************************************************/ | |
1767 /******************************************************************************* | |
1768 $Macro: DSPL_SET_XYBIT_COLOUR | |
1769 $Description: This macro | |
1770 $Returns: None | |
1771 $Arguments: x,y - posiiton of pixel to be set | |
1772 col - 0 =clear bixel, anything else - set pixel | |
1773 txt - trace for debug (if position is out-of-range) | |
1774 *******************************************************************************/ | |
1775 #ifdef DSAMPLE_LITE | |
1776 #define LCD_ROW_NUM_LWORDS ((LCD_COL+31)/32) /* col size in longwords */ | |
1777 #define BYTEPERPIXEL (1/8 - unused) | |
1778 #ifdef CHECK_LIMITS | |
1779 #define DSPL_SET_BITCOLOUR(x,j,col,txt) \ | |
1780 {\ | |
1781 if (((j)>=0) && ((j)<DISPLAY_SIZE)) \ | |
1782 {\ | |
1783 int m_px = 1 << (x & 0x1F);\ | |
1784 if (col) picture_col[j] = picture_col[j] | (m_px);\ | |
1785 else picture_col[j] = picture_col[j] & (~m_px);\ | |
1786 }else {mmi_trace(txt);}\ | |
1787 } | |
1788 #define DSPL_SET_XYBIT_COLOUR(x,y,col,txt) \ | |
1789 {\ | |
1790 int m_px = 1 << (x & 0x1F);\ | |
1791 int word = DSPL_GET_LWORD(x,y);\ | |
1792 if (((word)>=0) && ((word)<DISPLAY_SIZE)) \ | |
1793 {\ | |
1794 if (col) word = word | m_px;\ | |
1795 else word = word & (~m_px);\ | |
1796 }\ | |
1797 } | |
1798 | |
1799 #else | |
1800 #define DSPL_SET_BITCOLOUR(x,j,col,txt) \ | |
1801 {\ | |
1802 int m_px = 1 << (x & 0x1F);\ | |
1803 if (col) picture_col[j] = picture_col[j] | (m_px);\ | |
1804 else picture_col[j] = picture_col[j] & (~m_px);\ | |
1805 } | |
1806 #define DSPL_SET_XYBIT_COLOUR(x,y,col,txt) \ | |
1807 {\ | |
1808 int m_px = 1 << (x & 0x1F);\ | |
1809 int word = DSPL_GET_LWORD(x,y);\ | |
1810 if (col) word = word | m_px;\ | |
1811 else word = word & (~m_px);\ | |
1812 } | |
1813 | |
1814 #endif | |
1815 #define DSPL_GET_LWORD(px,py) ((py)*LCD_ROW_NUM_LWORDS + ((px)/32)) | |
1816 #define DSPL_GET_BYTE(px,py) (((py)*4)*LCD_ROW_NUM_LWORDS + ((px)/8)) | |
1817 #define DSPL_GET_BITCOLOUR(col32) (not used!) | |
1818 #define DSPL_GET_PIXELCOLOUR(col32) (not used!) | |
1819 #endif //DSAMPLE_LITE | |
1820 | |
1821 | |
1822 | |
1823 | |
1824 #ifdef DSAMPLE_COLOUR32 | |
1825 #define LCD_ROW_NUM_LWORDS (LCD_COL) /* col size in longwords */ | |
1826 #define BYTEPERPIXEL 4 | |
1827 #ifdef CHECK_LIMITS | |
1828 //safe version-includes trace for errors | |
1829 #define DSPL_SET_BITCOLOUR(x,j,col,txt) {if (((j)>=0) && ((j)<DISPLAY_SIZE)) picture_col[j] = (col); else {mmi_trace(txt);}} | |
1830 #else | |
1831 #define DSPL_SET_BITCOLOUR(x,j,col,txt) {picture_col[j] = (col);}//faster version - no bounds check | |
1832 #endif | |
1833 #define DSPL_GET_LWORD(px,py) ((py)*LCD_ROW_NUM_LWORDS + (px)) | |
1834 #define DSPL_GET_BYTE(px,py) (((py)*4)*LCD_ROW_NUM_LWORDS + ((px)*4)) | |
1835 #define DSPL_GET_BITCOLOUR(col32) (~(((((col32) &0x00F80000) >> 8) | (((col32) &0x0000FC00) >> 5) | (((col32) &0x000000F8) >> 3)))) | |
1836 #define DSPL_GET_PIXELCOLOUR(col32) (((((col32)<<8) &0x00F80000) | (((col32)<<5) &0x0000FC00) | (((col32)<<3) &0x000000F8))) | |
1837 #endif | |
1838 | |
1839 #ifdef DSAMPLE_COLOUR16 | |
1840 // July 1, 2005 REF: CRR 32677 - xpradipg | |
1841 // the extra word padding is not required for the ISAMPLE AND CALLISTO | |
1842 #if (defined(ISAMPLE) || defined(CALLISTO)) | |
1843 #define LCD_ROW_NUM_LWORDS ((LCD_COL)/2) /* col size in longwords */ | |
1844 #else | |
1845 #define LCD_ROW_NUM_LWORDS ((LCD_COL+1)/2) /* col size in longwords */ | |
1846 #endif | |
1847 #define BYTEPERPIXEL 2 | |
1848 #ifdef PIXEL_0_IN_LSW | |
1849 #ifdef CHECK_LIMITS | |
1850 #define DSPL_SET_BITCOLOUR(x,j,col,txt) \ | |
1851 {\ | |
1852 if (((j)>=0) && ((j)<DISPLAY_SIZE)) \ | |
1853 { if ((x)&0x01)\ | |
1854 picture_col[j] = (picture_col[j] & 0xFFFF0000) | (col & 0x0000FFFF);\ | |
1855 else\ | |
1856 picture_col[j] = (picture_col[j] & 0x0000FFFF) | ((col <<16) & 0xFFFF0000);\ | |
1857 }else {mmi_trace(txt);}\ | |
1858 } | |
1859 #else | |
1860 #define DSPL_SET_BITCOLOUR(x,j,col,txt) \ | |
1861 { if ((x)&0x01)\ | |
1862 picture_col[j] = (picture_col[j] & 0xFFFF0000) | (col & 0x0000FFFF);\ | |
1863 else\ | |
1864 picture_col[j] = (picture_col[j] & 0x0000FFFF) | ((col <<16) & 0xFFFF0000);\ | |
1865 } | |
1866 #endif | |
1867 #else | |
1868 #ifdef CHECK_LIMITS | |
1869 #define DSPL_SET_BITCOLOUR(x,j,col,txt) \ | |
1870 {\ | |
1871 if (((j)>=0) && ((j)<DISPLAY_SIZE)) \ | |
1872 { if ((x)&0x01)\ | |
1873 picture_col[j] = (picture_col[j] & 0x0000FFFF) | ((col <<16) & 0xFFFF0000);\ | |
1874 else\ | |
1875 picture_col[j] = (picture_col[j] & 0xFFFF0000) | (col & 0x0000FFFF);\ | |
1876 }else {mmi_trace(txt);}\ | |
1877 } | |
1878 #else | |
1879 #define DSPL_SET_BITCOLOUR(x,j,col,txt) \ | |
1880 { if ((x)&0x01)\ | |
1881 picture_col[j] = (picture_col[j] & 0x0000FFFF) | ((col <<16) & 0xFFFF0000);\ | |
1882 else\ | |
1883 picture_col[j] = (picture_col[j] & 0xFFFF0000) | (col & 0x0000FFFF);\ | |
1884 } | |
1885 #endif | |
1886 | |
1887 #endif | |
1888 //GW Added () round 'px' in definition below | |
1889 #define DSPL_GET_LWORD(px,py) ((py)*LCD_ROW_NUM_LWORDS + ((px)/2)) | |
1890 #define DSPL_GET_BYTE(px,py) (((py)*4)*LCD_ROW_NUM_LWORDS + ((px)*2)) | |
1891 // July 1, 2005 REF: CRR 32677 - xpradipg | |
1892 // the value is not negated here since the LCD driver expects without negation | |
1893 #if (defined(ISAMPLE) || defined(CALLISTO)) | |
1894 #define DSPL_GET_BITCOLOUR(col32) (((((col32) &0x00F80000) >> 8) | (((col32) &0x0000FC00) >> 5) | (((col32) &0x000000F8) >> 3))) | |
1895 #else | |
1896 #define DSPL_GET_BITCOLOUR(col32) (~(((((col32) &0x00F80000) >> 8) | (((col32) &0x0000FC00) >> 5) | (((col32) &0x000000F8) >> 3)))) | |
1897 #endif | |
1898 #define DSPL_GET_PIXELCOLOUR(col32) (((((col32)<<8) &0x00F80000) | (((col32)<<5) &0x0000FC00) | (((col32)<<3) &0x000000F8))) | |
1899 #endif | |
1900 | |
1901 // 3 words of header info for 'pictures' | |
1902 #ifdef DSAMPLE_LITE | |
1903 static UINT32* picture_bw = NULL;//Pointer to data in display. | |
1904 static UINT32* pictureCopy_bw= NULL;//Pointer to data in display. | |
1905 #endif//DSAMPLE_LITE | |
1906 | |
1907 #ifdef DSAMPLE_COLOUR | |
1908 static UINT32* picture_col = NULL;//Pointer to data in display. | |
1909 // Mar 30, 2005 REF: CRR 29986 xpradipg | |
1910 // removed the unused variable | |
1911 #ifndef FF_MMI_OPTIM | |
1912 static UINT32* pictureCopy_col= NULL;//Pointer to data in display. | |
1913 #endif | |
1914 #endif | |
1915 | |
1916 #ifdef CSAMPLE | |
1917 #define HEADER_INFO (3) | |
1918 #define DISPLAY_SIZE (LCD_COL*LCD_COL_NUM_LWORDS) | |
1919 static UINT32 display_bw [DISPLAY_SIZE+HEADER_INFO+10]; | |
1920 #ifdef USE_PLOT | |
1921 static UINT32 displayCopy_bw [DISPLAY_SIZE+HEADER_INFO+1]; /* copy to flag differences */ | |
1922 #endif | |
1923 static UINT32* picture_bw=NULL;//Pointer to data in display. | |
1924 static UINT32* pictureCopy_bw= NULL;//Pointer to data in display. | |
1925 /* static char scratch [100]; */ /* command buffer - does not support output of new display */ | |
1926 #endif //CSAMPLE | |
1927 | |
1928 #ifdef BSAMPLE | |
1929 static UBYTE displayScr [LCD_ROW][LCD_COL_B]; /* display buffer */ | |
1930 static UBYTE displayCopy [LCD_ROW][LCD_COL_B]; /* copy to flag differences */ | |
1931 /* static char scratch [LCD_ROW*LCD_COL_B*2+100]; */ /* command buffer */ | |
1932 #endif //BSAMPLE | |
1933 | |
1934 | |
1935 | |
1936 static int mobEnabled = 1; /* mobile simulation disabled */ | |
1937 | |
1938 extern int mfwExtOut (char *cmd); /* forward to ext. display */ | |
1939 UBYTE lcd_output_ready = TRUE; | |
1940 UBYTE lcd_output_needed = FALSE; | |
1941 | |
1942 #define scrHlen 18 | |
1943 static const char *scrHeader = "CONFIG MFWMOB SCR "; | |
1944 | |
1945 static int scrX, scrY; /* display size */ | |
1946 #if defined (WIN32) | |
1947 static int mtkEnabled = 0; /* MMI Toolkit */ | |
1948 #endif | |
1949 | |
1950 static int internal = 0; /* internal use only */ | |
1951 | |
1952 static int xIndex; /* data transfer index */ | |
1953 | |
1954 //accessible from outside e.g 3th application MMS | |
1955 void scrPoint (int px, int py, int col); | |
1956 | |
1957 | |
1958 | |
1959 /* | |
1960 +--------------------------------------------------------------------+ | |
1961 | PROJECT : GSM-PS (6103) MODULE : DRV_DSPL | | |
1962 | STATE : code ROUTINE : dspl_BitBlt | | |
1963 +--------------------------------------------------------------------+ | |
1964 | |
1965 PURPOSE : This function is used to display a bitmap at the | |
1966 specified location using the raster operation provided. | |
1967 The bitmap format MUST be the same as the display and | |
1968 cannot contain any transparent colours | |
1969 If the bitmap does not cover the entire screen area, the rest of the | |
1970 area is drawn in the background colour provided. | |
1971 | |
1972 */ | |
1973 #ifdef DSAMPLE_COLOUR | |
1974 void fastCopyBitmap(int startX, int startY, // start position of bitmap | |
1975 int bmpSx, int bmpSy, //size of bitmap | |
1976 char* srcBitmap, | |
1977 int posX, int posY, // start of area to be copied into | |
1978 int sx, int sy, // size of area to be copied into | |
1979 U32 bgd_col, int bmpFormat) | |
1980 { | |
1981 char * image; | |
1982 int image_sx,image_x; | |
1983 int bgd_sx_left; | |
1984 int bgd_sx_right; | |
1985 int i,y; | |
1986 char *screen = (char*)picture_col; | |
1987 U32 bgdColour; | |
1988 | |
1989 if (posX < win_x1) | |
1990 { | |
1991 sx = sx - (win_x1-posX); | |
1992 posX = win_x1; | |
1993 } | |
1994 if (posX+sx >win_x2) | |
1995 { | |
1996 sx = win_x2 - posX; | |
1997 } | |
1998 if (posY < win_y1) | |
1999 { | |
2000 sy = sy - (win_y1-posY); | |
2001 posY = win_y1; | |
2002 } | |
2003 if (posY+sy >win_y2) | |
2004 { | |
2005 sy = win_y2 - posY; | |
2006 } | |
2007 { | |
2008 char trc[80]; | |
2009 sprintf(trc,"%d,%d,%d,%d,%d,%d",sx,sy,win_x1,win_y1,win_x2,win_y2); | |
2010 mmi_trace(trc); | |
2011 } | |
2012 #ifdef DSAMPLE_COLOUR32 | |
2013 if (bmpFormat != BMP_FORMAT_16BIT_LCD_COLOUR) | |
2014 #endif | |
2015 #ifdef DSAMPLE_COLOUR16 | |
2016 if (bmpFormat != BMP_FORMAT_16BIT_LCD_COMPRESSED_COLOUR) | |
2017 #endif | |
2018 { | |
2019 int maxY; | |
2020 //Either display as much of the image as possible or as much as will fit. | |
2021 if (bmpSy > sy) | |
2022 maxY = sy; | |
2023 else | |
2024 maxY = bmpSy; | |
2025 dspl_Clear(posX,posY,(U16)(posX+sx-1),(U16)(posY+sy-1)); | |
2026 dspl_BitBlt2((short) posX,(short)posY,(USHORT)bmpSx,(USHORT)maxY, | |
2027 (void *)srcBitmap,0, bmpFormat); | |
2028 return; | |
2029 } | |
2030 | |
2031 bgdColour = DSPL_GET_BITCOLOUR(bgd_col); | |
2032 bgdColourArray[0] = (bgdColour & 0x000000FF); | |
2033 bgdColourArray[1] = (bgdColour & 0x0000FF00) >>8; | |
2034 bgdColourArray[2] = (bgdColour & 0x00FF0000) >>16; | |
2035 bgdColourArray[3] = (bgdColour & 0xFF000000) >>24; | |
2036 for (i=BYTEPERPIXEL;i<LCD_COL*BYTEPERPIXEL;i++) | |
2037 bgdColourArray[i] = bgdColourArray[i-BYTEPERPIXEL]; | |
2038 bgd_sx_left = (startX- posX); | |
2039 | |
2040 if (srcBitmap) | |
2041 { | |
2042 image_x = posX - startX; | |
2043 image_sx = bmpSx; | |
2044 if (image_x < 0) | |
2045 { | |
2046 image_x = 0; | |
2047 } | |
2048 else | |
2049 image_sx = image_sx - image_x; | |
2050 } | |
2051 else | |
2052 { | |
2053 image_sx = 0; | |
2054 image_x = 0; | |
2055 } | |
2056 if (bgd_sx_left <0) | |
2057 bgd_sx_left=0; | |
2058 if ((image_sx + bgd_sx_left) > sx) | |
2059 { | |
2060 image_sx = sx - bgd_sx_left; | |
2061 bgd_sx_right = 0; | |
2062 } | |
2063 else | |
2064 { | |
2065 bgd_sx_right = sx-(image_sx+bgd_sx_left); | |
2066 } | |
2067 if (bgd_sx_right <0) | |
2068 bgd_sx_right=0; | |
2069 bgd_sx_right = bgd_sx_right*BYTEPERPIXEL; | |
2070 bgd_sx_left = bgd_sx_left*BYTEPERPIXEL; | |
2071 if (image_sx > 0) | |
2072 image_sx = image_sx*BYTEPERPIXEL; | |
2073 else | |
2074 image_sx = 0; | |
2075 if (image_x > 0) | |
2076 image_x = image_x*BYTEPERPIXEL; | |
2077 else | |
2078 image_x = 0; | |
2079 if (posY+sy > LCD_ROW) | |
2080 sy = LCD_ROW - posY; | |
2081 for (y=posY; y<posY+sy; y++) | |
2082 { | |
2083 int yOfs = DSPL_GET_BYTE(posX,y); | |
2084 if ((yOfs >=0) && (yOfs<DISPLAY_SIZE*4)) | |
2085 { | |
2086 if (((srcBitmap) && (y>startY) && (y <bmpSy+startY) && (image_sx >0))) | |
2087 { | |
2088 image = &srcBitmap[(y-startY)*bmpSx*BYTEPERPIXEL]; | |
2089 if (bgd_sx_left >0) | |
2090 memcpy(&screen[yOfs],&bgdColourArray[0],bgd_sx_left); | |
2091 memcpy(&screen[yOfs+bgd_sx_left],&image[image_x],image_sx); | |
2092 if (bgd_sx_right >0) | |
2093 memcpy(&screen[yOfs+bgd_sx_left+image_sx],&bgdColourArray[0],bgd_sx_right); | |
2094 | |
2095 } | |
2096 else | |
2097 { | |
2098 memcpy(&screen[yOfs],&bgdColourArray[0],sx*BYTEPERPIXEL); | |
2099 } | |
2100 } | |
2101 } | |
2102 } | |
2103 #else | |
2104 void fastCopyBitmap(int startX, int startY, // start position of bitmap | |
2105 int bmpSx, int bmpSy, //size of bitmap | |
2106 char* srcBitmap, | |
2107 int posX, int posY, // start of area to be copied into | |
2108 int sx, int sy, // size of area to be copied into | |
2109 U32 bgd_col, int bmpFormat) | |
2110 { | |
2111 //Fast copy is currently only required for colour bitmaps | |
2112 } | |
2113 #endif | |
2114 | |
2115 | |
2116 | |
2117 /* | |
2118 +--------------------------------------------------------------------+ | |
2119 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2120 | STATE : code ROUTINE : scrMobUpdate | | |
2121 +--------------------------------------------------------------------+ | |
2122 | |
2123 PURPOSE : Shadow display to mobile simulation | |
2124 | |
2125 */ | |
2126 | |
2127 void scrMobUpdate (void) | |
2128 { | |
2129 #if defined (WIN32) | |
2130 USHORT x,y; | |
2131 USHORT i; | |
2132 USHORT z; | |
2133 | |
2134 if (mtkEnabled) | |
2135 { | |
2136 USHORT sdu_len; | |
2137 | |
2138 switch (mtkEnabled) | |
2139 { | |
2140 case 1: // ASAMPLE | |
2141 z= LCD_ROW; | |
2142 sdu_len = 13 * z; // (100 * z Pixels); | |
2143 { | |
2144 PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, (USHORT)(sdu_len<<3)); | |
2145 { | |
2146 mmi_display_req->c_x = LCD_COL; | |
2147 mmi_display_req->c_y = z; | |
2148 i=0; | |
2149 for (y=0;y<z;y++) | |
2150 for (x=0; x < 13; x++) | |
2151 mmi_display_req->sdu.buf[i++] = displayScr[y][x]; | |
2152 } | |
2153 | |
2154 TRACE_EVENT ("Send Display Content"); | |
2155 #if defined NEW_FRAME | |
2156 { | |
2157 { | |
2158 T_QMSG Message; | |
2159 | |
2160 Message.MsgType = MSG_PRIMITIVE; | |
2161 Message.Msg.Primitive.Prim = D2P(mmi_display_req); | |
2162 Message.Msg.Primitive.PrimLen = sizeof (T_MMI_DISPLAY_REQ) + LCD_COL_B*z; | |
2163 #ifdef MEMORY_SUPERVISION | |
2164 vsi_c_send (VSI_CALLER hCommL1 ,&Message, __FILE__, __LINE__); | |
2165 #else | |
2166 vsi_c_send (VSI_CALLER hCommL1 ,&Message); | |
2167 #endif | |
2168 } | |
2169 } | |
2170 #else | |
2171 // vsi_c_send (VSI_CALLER hCommL1, D2P(mmi_display_req), sizeof (T_MMI_DISPLAY_REQ) + LCD_COL_B*z); | |
2172 #endif | |
2173 } | |
2174 break; | |
2175 | |
2176 case 2: // another target with other dimensions | |
2177 { | |
2178 char buf[40]; | |
2179 sprintf (buf, "LCD NEEDED %d READY %d", lcd_output_needed, lcd_output_ready); | |
2180 TRACE_EVENT (buf); | |
2181 } | |
2182 lcd_output_needed = TRUE; | |
2183 if (lcd_output_ready) | |
2184 { | |
2185 lcd_output_needed = FALSE; | |
2186 lcd_output_ready = FALSE; | |
2187 | |
2188 sdu_len = 14 * 16 + 20; | |
2189 #if (LCD_ROW >= 64) | |
2190 { | |
2191 PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, sdu_len<<3); | |
2192 | |
2193 mmi_display_req->c_x = LCD_COL; | |
2194 mmi_display_req->c_y = 16; | |
2195 mmi_display_req->attrib.content = 3; | |
2196 i=0; | |
2197 for (y=48;y<64;y++) | |
2198 for (x=0; x < 13; x++) | |
2199 mmi_display_req->sdu.buf[i++] = displayScr[y][x]; | |
2200 #if defined NEW_FRAME | |
2201 { | |
2202 T_QMSG Message; | |
2203 | |
2204 Message.MsgType = MSG_PRIMITIVE; | |
2205 Message.Msg.Primitive.Prim = D2P(mmi_display_req); | |
2206 Message.Msg.Primitive.PrimLen = sizeof (T_MMI_DISPLAY_REQ) + 14*16+20; | |
2207 #ifdef MEMORY_SUPERVISION | |
2208 vsi_c_send (VSI_CALLER hCommL1 ,&Message, __FILE__, __LINE__); | |
2209 #else | |
2210 vsi_c_send (VSI_CALLER hCommL1 ,&Message); | |
2211 #endif | |
2212 } | |
2213 #else | |
2214 vsi_c_send (VSI_CALLER hCommL1, D2P(mmi_display_req), sizeof (T_MMI_DISPLAY_REQ) + 14*16+20); | |
2215 #endif | |
2216 } | |
2217 #endif | |
2218 #if (LCD_ROW >= 48) | |
2219 { | |
2220 PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, (USHORT)(sdu_len<<3)); | |
2221 | |
2222 mmi_display_req->c_x = LCD_COL; | |
2223 mmi_display_req->c_y = 16; | |
2224 mmi_display_req->attrib.content = 2; | |
2225 i=0; | |
2226 for (y=32;y<48;y++) | |
2227 for (x=0; x < 13; x++) | |
2228 mmi_display_req->sdu.buf[i++] = displayScr[y][x]; | |
2229 #if defined NEW_FRAME | |
2230 { | |
2231 T_QMSG Message; | |
2232 | |
2233 Message.MsgType = MSG_PRIMITIVE; | |
2234 Message.Msg.Primitive.Prim = D2P(mmi_display_req); | |
2235 Message.Msg.Primitive.PrimLen = sizeof (T_MMI_DISPLAY_REQ) + 14*16+20; | |
2236 #ifdef MEMORY_SUPERVISION | |
2237 vsi_c_send (VSI_CALLER hCommL1 ,&Message, __FILE__, __LINE__); | |
2238 #else | |
2239 vsi_c_send (VSI_CALLER hCommL1 ,&Message); | |
2240 #endif | |
2241 } | |
2242 #else | |
2243 vsi_c_send (VSI_CALLER hCommL1, D2P(mmi_display_req), sizeof (T_MMI_DISPLAY_REQ) + 14*16+20); | |
2244 #endif | |
2245 } | |
2246 #endif | |
2247 { | |
2248 PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, (USHORT)(sdu_len<<3)); | |
2249 | |
2250 mmi_display_req->c_x = LCD_COL; | |
2251 mmi_display_req->c_y = 16; | |
2252 mmi_display_req->attrib.content = 1; | |
2253 i=0; | |
2254 for (y=16;y<32;y++) | |
2255 for (x=0; x < 13; x++) | |
2256 mmi_display_req->sdu.buf[i++] = displayScr[y][x]; | |
2257 #if defined NEW_FRAME | |
2258 { | |
2259 T_QMSG Message; | |
2260 | |
2261 Message.MsgType = MSG_PRIMITIVE; | |
2262 Message.Msg.Primitive.Prim = D2P(mmi_display_req); | |
2263 Message.Msg.Primitive.PrimLen = sizeof (T_MMI_DISPLAY_REQ) + 14*16+20; | |
2264 #ifdef MEMORY_SUPERVISION | |
2265 vsi_c_send (VSI_CALLER hCommL1 ,&Message, __FILE__, __LINE__); | |
2266 #else | |
2267 vsi_c_send (VSI_CALLER hCommL1 ,&Message); | |
2268 #endif | |
2269 } | |
2270 #else | |
2271 vsi_c_send (VSI_CALLER hCommL1, D2P(mmi_display_req), sizeof (T_MMI_DISPLAY_REQ) + 14*16+20); | |
2272 #endif | |
2273 } | |
2274 { | |
2275 PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, (USHORT)(sdu_len<<3)); | |
2276 | |
2277 mmi_display_req->c_x = LCD_COL; | |
2278 mmi_display_req->c_y = 16; | |
2279 mmi_display_req->attrib.content = 0; | |
2280 i=0; | |
2281 for (y=0;y<16;y++) | |
2282 for (x=0; x < 13; x++) | |
2283 mmi_display_req->sdu.buf[i++] = displayScr[y][x]; | |
2284 #if defined NEW_FRAME | |
2285 { | |
2286 T_QMSG Message; | |
2287 | |
2288 Message.MsgType = MSG_PRIMITIVE; | |
2289 Message.Msg.Primitive.Prim = D2P(mmi_display_req); | |
2290 Message.Msg.Primitive.PrimLen = sizeof (T_MMI_DISPLAY_REQ) + 14*16+20; | |
2291 #ifdef MEMORY_SUPERVISION | |
2292 vsi_c_send (VSI_CALLER hCommL1 ,&Message, __FILE__, __LINE__); | |
2293 #else | |
2294 vsi_c_send (VSI_CALLER hCommL1 ,&Message); | |
2295 #endif | |
2296 } | |
2297 #else | |
2298 vsi_c_send (VSI_CALLER hCommL1, D2P(mmi_display_req), sizeof (T_MMI_DISPLAY_REQ) + 14*16+20); | |
2299 #endif | |
2300 } | |
2301 TRACE_EVENT ("Send Display Content"); | |
2302 } | |
2303 break; | |
2304 } | |
2305 } | |
2306 #endif | |
2307 | |
2308 #ifdef BSAMPLE | |
2309 if (mobEnabled) | |
2310 { | |
2311 /* ## scratch is not required and function mfwExtOut is | |
2312 ## not doing anything | |
2313 sprintf(scratch,"%s%s %d",scrHeader,"disp",LCD_COL_B); | |
2314 xIndex = 0; | |
2315 mfwExtOut(scratch); | |
2316 */ | |
2317 } | |
2318 #endif | |
2319 } | |
2320 | |
2321 | |
2322 int dspl_GetContrastColour( int ipCol) | |
2323 { | |
2324 switch (ipCol & 0x00808080) | |
2325 { | |
2326 case 0x000000: return (0x00FFFFFF); | |
2327 case 0x000080: return (0x00FFFF00); | |
2328 case 0x008000: return (0x00FF00FF); | |
2329 case 0x008080: return (0x00FF0000); | |
2330 case 0x800000: return (0x0000FFFF); | |
2331 case 0x800080: return (0x0000FF00); | |
2332 case 0x808000: return (0x000000FF); | |
2333 case 0x808080: return (0x00000000); | |
2334 default: return (0x00808080); | |
2335 } | |
2336 return (0x00808080); | |
2337 } | |
2338 | |
2339 /* | |
2340 +--------------------------------------------------------------------+ | |
2341 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2342 | STATE : code ROUTINE : scrLCDUpdate | | |
2343 +--------------------------------------------------------------------+ | |
2344 | |
2345 PURPOSE : Shadow display to LCD | |
2346 | |
2347 */ | |
2348 | |
2349 //GW Procedure/data supplied by new TI Driver V5.3.1 | |
2350 #ifdef R2D_ENABLED | |
2351 | |
2352 static T_R2D_SHAPE_PTR scrDisplayRect = NULL; //rectangle defined as shape of the display | |
2353 static T_R2D_GC_PTR scrPicPtr = NULL; //Pointer to gc with picture in it (b+w and col) | |
2354 static T_RVF_MB_ID mb_id; //ID of memory bank | |
2355 void r2d_refresh(void); | |
2356 int riv_err; | |
2357 extern T_R2D_GC_PTR r2d_g_lcd_gc; | |
2358 #endif // R2D_ENABLED | |
2359 static int picInit = 0; //Have we set up the mb id etc yet ? | |
2360 | |
2361 //Initialises data required for bolck copy of a 'picture' | |
2362 void scrRivPictureClear(void) | |
2363 { | |
2364 #ifdef CSAMPLE | |
2365 memset(display_bw,0,sizeof(display_bw)); | |
2366 #ifdef USE_PLOT | |
2367 memset(displayCopy_bw,0,sizeof(displayCopy_bw)); | |
2368 pictureCopy_bw = &displayCopy_bw[3]; //start of input data | |
2369 #endif | |
2370 | |
2371 display_bw[0] = LCD_COL; | |
2372 display_bw[1] = LCD_ROW; | |
2373 display_bw[2] = DISPLAY_SIZE; | |
2374 picture_bw = &display_bw[3]; //start of input data | |
2375 #endif | |
2376 | |
2377 #ifdef DSAMPLE_COLOUR | |
2378 #ifdef USEBUFFER | |
2379 display_colour[0] = LCD_COL; | |
2380 display_colour[1] = LCD_ROW; | |
2381 display_colour[2] = DISPLAY_SIZE; | |
2382 picture_col = &display_colour[3]; //start of input data | |
2383 #else | |
2384 picture_col = r2d_get_pixmap(r2d_g_lcd_gc); | |
2385 #endif | |
2386 { | |
2387 U32 lWord,bitCol; | |
2388 int j,y; | |
2389 //GW When clearing screen - do not allow transparent background colours! | |
2390 int bgdCol = dspl_GetBgdColour(); | |
2391 int fgdCol = dspl_GetFgdColour(); | |
2392 if (((bgdCol & 0x00F0F0F0) == (fgdCol & 0x00F0F0F0)) || | |
2393 ((bgdCol & 0xFF000000) == TRANSPARENT_32BIT_COLOUR)) | |
2394 { | |
2395 /*Foreground and background colours are the same (or near enough) */ | |
2396 /* or background colour is transparent */ | |
2397 /*Select a colour that will contrast with the current foreground colour */ | |
2398 bgdCol = dspl_GetContrastColour(fgdCol); | |
2399 } | |
2400 bitCol = (DSPL_GET_BITCOLOUR(bgdCol)) & 0x00FFFFFF; | |
2401 | |
2402 #ifdef DSAMPLE_COLOUR32 | |
2403 bgdColourArray[0] = (bitCol & 0x000000FF); | |
2404 bgdColourArray[1] = (bitCol & 0x0000FF00) >>8; | |
2405 bgdColourArray[2] = (bitCol & 0x00FF0000) >>16; | |
2406 bgdColourArray[3] = (bitCol & 0xFF000000) >>24; | |
2407 for (j=4;j<LCD_COL*4;j++) | |
2408 bgdColourArray[j] = bgdColourArray[j-4]; | |
2409 for (y=0; y<LCD_ROW; y++) | |
2410 { | |
2411 int yOfs = (y*LCD_ROW_NUM_LWORDS); | |
2412 memcpy(&picture_col[yOfs] ,bgdColourArray,LCD_COL*4); | |
2413 } | |
2414 #endif | |
2415 #ifdef DSAMPLE_COLOUR16 | |
2416 bgdColourArray[0] = (bitCol & 0x000000FF); | |
2417 bgdColourArray[1] = (bitCol & 0x0000FF00) >>8; | |
2418 for (j=2;j<LCD_COL*2;j++) | |
2419 bgdColourArray[j] = bgdColourArray[j-2]; | |
2420 for (y=0; y<LCD_ROW; y++) | |
2421 { | |
2422 int yOfs = (y*LCD_ROW_NUM_LWORDS); | |
2423 memcpy(&picture_col[yOfs] ,bgdColourArray,LCD_COL*2); | |
2424 } | |
2425 #endif | |
2426 } | |
2427 | |
2428 #endif | |
2429 | |
2430 #ifdef DSAMPLE_LITE | |
2431 picture_bw = r2d_get_pixmap(r2d_g_lcd_gc); | |
2432 memset(picture_bw,0,DISPLAY_SIZE*4); | |
2433 #endif | |
2434 | |
2435 | |
2436 } | |
2437 void scrRivPictureInit( void ) | |
2438 { | |
2439 static int err = -1; | |
2440 T_RVF_MB_NAME mb_name; | |
2441 T_RVF_MB_PARAM mb_param; | |
2442 //Ensure data is only created once. | |
2443 #ifdef R2D_ENABLED | |
2444 if (picInit != 0) | |
2445 return; | |
2446 picInit = 1; //int underway. | |
2447 scrRivPictureClear(); | |
2448 #endif | |
2449 | |
2450 #ifdef CSAMPLE | |
2451 strcpy(mb_name, "FRED"); | |
2452 mb_param.size = 256; | |
2453 mb_param.watermark = 128; | |
2454 riv_err = rvf_create_mb( mb_name, mb_param, &mb_id); | |
2455 | |
2456 if (riv_err == 0) | |
2457 { | |
2458 scrPicPtr = r2d_new_picture_context(mb_id, display_bw,R2D_LCD_KIND); | |
2459 scrDisplayRect = r2d_new_rectangle(mb_id,0,0,LCD_COL-1,LCD_ROW-1); | |
2460 } | |
2461 else | |
2462 { | |
2463 scrPicPtr = NULL; | |
2464 scrDisplayRect = NULL; | |
2465 } | |
2466 #endif | |
2467 | |
2468 #ifdef DSAMPLE_COLOUR | |
2469 #ifdef USEBUFFER | |
2470 strcpy(mb_name, "FRED"); | |
2471 mb_param.size = 256; | |
2472 mb_param.watermark = 128; | |
2473 err = rvf_create_mb( mb_name, mb_param, &mb_id); | |
2474 if (err == 0) | |
2475 { | |
2476 scrPicPtr = r2d_new_picture_context(mb_id, display_colourPtr,R2D_FULL_KIND);// R2D_LCD_KIND); | |
2477 scrDisplayRect = r2d_new_rectangle(mb_id,0,0,LCD_COL+1,LCD_ROW+1); | |
2478 } | |
2479 else | |
2480 #endif | |
2481 { | |
2482 scrPicPtr = NULL; | |
2483 scrDisplayRect = NULL; | |
2484 } | |
2485 #endif | |
2486 | |
2487 } | |
2488 | |
2489 //GW Change the display to | |
2490 #ifdef DSAMPLE_COLOUR | |
2491 #ifdef DSAMPLE_COLOUR32 | |
2492 #define TOP_BITS_SET 0xC618 | |
2493 #endif | |
2494 #ifdef DSAMPLE_COLOUR16 | |
2495 #define TOP_BITS_SET 0xC618C618 | |
2496 #endif | |
2497 #endif | |
2498 /* | |
2499 +--------------------------------------------------------------------+ | |
2500 | PROJECT : GSM-PS (6147) MODULE : SMI_WM | | |
2501 | STATE : code ROUTINE : scrUnfocusDisplay | | |
2502 +--------------------------------------------------------------------+ | |
2503 | |
2504 PURPOSE : Causes the entire display to appear much darker, allowing the pop-up | |
2505 dialog to be more clearly the focus especially the softkeys. | |
2506 | |
2507 GW #2294 23/07/03 - Created | |
2508 */ | |
2509 void scrUnfocusDisplay(void) | |
2510 { | |
2511 #ifndef _SIMULATION_ // Turn off this BMI Schnickschnack ... | |
2512 int x,y; | |
2513 UINT32 *picPtr; | |
2514 #ifndef DSAMPLE_COLOUR | |
2515 UINT32 mask; | |
2516 #endif | |
2517 #ifdef DSAMPLE_COLOUR | |
2518 picPtr = picture_col; | |
2519 #else | |
2520 picPtr = picture_bw; | |
2521 #endif | |
2522 if (picPtr != NULL) | |
2523 { | |
2524 for (y=0;y<LCD_ROW;y++) | |
2525 { | |
2526 #ifndef DSAMPLE_COLOUR | |
2527 if (y & 0x01) | |
2528 mask = 0xAAAAAAAA; | |
2529 else | |
2530 mask = 0x55555555; | |
2531 #endif | |
2532 for (x=0;x<LCD_ROW_NUM_LWORDS;x++) | |
2533 { | |
2534 #ifdef DSAMPLE_COLOUR | |
2535 //We Want to reduce colour by 50% (shift left) and set top bits to bits to 0 | |
2536 //Since picture colours are inverted, set top bits. | |
2537 //Also, colouris very bright - reduce by 75% | |
2538 if ((*picPtr & TOP_BITS_SET) != TOP_BITS_SET) | |
2539 *picPtr = ((*picPtr) >> 2) | TOP_BITS_SET; | |
2540 #else | |
2541 //B+W display - blank every second pixel | |
2542 *picPtr = (*picPtr) & mask; | |
2543 #endif | |
2544 picPtr++; | |
2545 } | |
2546 } | |
2547 } | |
2548 #endif /* _SIMULATION_ */ | |
2549 } | |
2550 | |
2551 | |
2552 //Set colour (only when different from last time) | |
2553 void scrSetR2DFgdCol(UINT32 col) | |
2554 { | |
2555 U16 opCol_a,opCol_r,opCol_g,opCol_b; | |
2556 static UINT32 oldCol = 0xFFFFFFFF; | |
2557 if (col != oldCol) | |
2558 { | |
2559 #ifdef DSAMPLE_COLOUR | |
2560 opCol_a = 0xFF; // ((col & 0x0000FF00) >> 16); | |
2561 opCol_r = ((col & 0x0000F800) >> 8); | |
2562 opCol_g = ((col & 0x000007E0) >> 3); | |
2563 opCol_b = ((col & 0x0000001F) << 3); | |
2564 #else | |
2565 opCol_a = 0xFF; // ((col & 0x0000FF00) >> 16); | |
2566 opCol_r = ((col & 0x000000E0) ); | |
2567 opCol_g = ((col & 0x0000001C) << 3); | |
2568 opCol_b = ((col & 0x00000003) << 6); | |
2569 if (opCol_r == 0) opCol_r = 0x80; | |
2570 if (opCol_g == 0) opCol_g = 0x40; | |
2571 #endif | |
2572 #ifdef R2D_ENABLED | |
2573 r2d_set_foreground_color_with_argb(r2d_g_lcd_gc, opCol_a, opCol_r, opCol_g, opCol_b ); | |
2574 oldCol = col; | |
2575 #endif | |
2576 } | |
2577 } | |
2578 //Set colour (only when different from last time) | |
2579 void scrSetR2DBgdCol(UINT32 col) | |
2580 { | |
2581 U16 opCol_a,opCol_r,opCol_g,opCol_b; | |
2582 static UINT32 oldCol = 0xFFFFFFFF; | |
2583 if (col != oldCol) | |
2584 { | |
2585 #ifdef DSAMPLE_COLOUR | |
2586 opCol_a = 0xFF; // ((col & 0x0000FF00) >> 16); | |
2587 opCol_r = ((col & 0x0000F800) >> 8); | |
2588 opCol_g = ((col & 0x000007E0) >> 3); | |
2589 opCol_b = ((col & 0x0000001F) << 3); | |
2590 #else | |
2591 opCol_a = 0xFF; // ((col & 0x0000FF00) >> 16); | |
2592 opCol_r = ((col & 0x000000E0) ); | |
2593 opCol_g = ((col & 0x0000001C) << 3); | |
2594 opCol_b = ((col & 0x00000003) << 6); | |
2595 if (opCol_r == 0) opCol_r = 0x80; | |
2596 if (opCol_g == 0) opCol_g = 0x40; | |
2597 #endif | |
2598 #ifdef R2D_ENABLED | |
2599 r2d_set_background_color_with_argb(r2d_g_lcd_gc, opCol_a, opCol_r, opCol_g, opCol_b ); | |
2600 oldCol = col; | |
2601 #endif | |
2602 } | |
2603 } | |
2604 //GW Procedure/data supplied by new TI Driver V5.3.1 | |
2605 //length of array (32bit words) to hold a copy of the screen (maybe) | |
2606 #ifdef R2D_ENABLED | |
2607 extern T_R2D_GC_PTR r2d_g_lcd_gc; | |
2608 #endif | |
2609 /* */ | |
2610 void scrPlotR2DPoint(U32 col, INT16 x, INT16 y) | |
2611 { | |
2612 #ifdef R2D_ENABLED | |
2613 static U32 fCol=0xFFFFFFFF; | |
2614 static U32 bCol=0xFFFFFFFF; | |
2615 static U32 flip=0; | |
2616 if (fCol==col) | |
2617 { | |
2618 scrSetR2DFgdCol(col ); | |
2619 r2d_draw_point(r2d_g_lcd_gc,x,y); | |
2620 } | |
2621 else if (bCol == col) | |
2622 { | |
2623 scrSetR2DBgdCol(col ); | |
2624 r2d_erase_point(r2d_g_lcd_gc,x,y); | |
2625 } | |
2626 else if (flip) | |
2627 { | |
2628 flip = 0; | |
2629 scrSetR2DBgdCol(col ); | |
2630 | |
2631 r2d_erase_point(r2d_g_lcd_gc,x,y); | |
2632 bCol = col; | |
2633 } | |
2634 else | |
2635 { | |
2636 flip = 1; | |
2637 scrSetR2DFgdCol(col ); | |
2638 r2d_draw_point(r2d_g_lcd_gc,x,y); | |
2639 fCol = col; | |
2640 } | |
2641 #endif | |
2642 } | |
2643 | |
2644 #ifdef BSAMPLE | |
2645 void scrLCDUpdate (void) | |
2646 { | |
2647 #ifdef USE_PLOT | |
2648 int nPlots=0; | |
2649 | |
2650 int row,rowstart; | |
2651 int kstart,kend,k; | |
2652 UBYTE *bcopy; | |
2653 int i,j; | |
2654 UBYTE m; | |
2655 UBYTE *bm; | |
2656 #else | |
2657 int i; | |
2658 #endif | |
2659 | |
2660 #if defined (WIN32_SIM) | |
2661 return; | |
2662 #endif | |
2663 if (!scrEnabled) | |
2664 return; | |
2665 | |
2666 #ifdef USE_PLOT | |
2667 bm = &displayScr[0][0]; | |
2668 bcopy = &displayCopy[0][0]; | |
2669 m = 0x80; | |
2670 for (j = 0; j < LCD_ROW; j++) | |
2671 { | |
2672 for (k = 0; k < (LCD_COL+7)/8; k++) | |
2673 { | |
2674 //Only plot data if it has changed since last time | |
2675 if (*bm != *bcopy) | |
2676 { | |
2677 m = 0x80; | |
2678 kstart = k*8; | |
2679 kend = k*8+8; | |
2680 if (kend>LCD_COL) | |
2681 kend = LCD_COL; | |
2682 for (i = kstart; i < kend; i++) | |
2683 { | |
2684 #ifdef R2D_ENABLED | |
2685 if ((*bm) & m) | |
2686 | |
2687 r2d_draw_point(r2d_g_lcd_gc,i,j); | |
2688 else | |
2689 r2d_erase_point(r2d_g_lcd_gc,j,i); | |
2690 #endif | |
2691 m >>= 1; | |
2692 } | |
2693 *bcopy = *bm;//Update value | |
2694 } | |
2695 bm++; | |
2696 bcopy++; | |
2697 } | |
2698 } | |
2699 | |
2700 #else | |
2701 //* work around limitations of TI driver ! * | |
2702 for (i = 0; i < LCD_ROW; i++) | |
2703 { | |
2704 displayScr[i][LCD_COL_B-1] &= 0xF0; | |
2705 displayScr[i][LCD_COL_B-1] |= (UBYTE) ((displayScr[i][6] >> 2) & 0x0F); | |
2706 } | |
2707 | |
2708 LCD_PixBlt(0,0,LCD_COL_B*8,8,(char*)&displayScr[0][0]); | |
2709 LCD_PixBlt(0,8,LCD_COL_B*8,8,(char*)(&(displayScr[8][0]))); | |
2710 LCD_PixBlt(0,16,LCD_COL_B*8,8,(char*)(&(displayScr[16][0]))); | |
2711 LCD_PixBlt(0,24,LCD_COL_B*8,8,(char*)(&(displayScr[24][0]))); | |
2712 #if (!CUST)//JVJE #if (CUST==1) | |
2713 LCD_PixBlt(0,32,LCD_COL_B*8,8,(char*)(&(displayScr[32][0]))); | |
2714 LCD_PixBlt(0,40,LCD_COL_B*8,8,(char*)(&(displayScr[40][0]))); | |
2715 #endif | |
2716 #endif | |
2717 | |
2718 } | |
2719 #endif | |
2720 | |
2721 | |
2722 | |
2723 | |
2724 #ifdef CSAMPLE | |
2725 void scrLCDUpdate (void) | |
2726 { | |
2727 int kstart,kend,k; | |
2728 int row,rowstart; | |
2729 int i,j; | |
2730 INT16 x1,y1; | |
2731 UINT32 m; | |
2732 UINT32 *bm; | |
2733 UINT32 *bcopy; | |
2734 static UINT32 col=0; | |
2735 int count; | |
2736 int nPlots=0; | |
2737 | |
2738 #if defined (WIN32_SIM) | |
2739 return; | |
2740 #endif | |
2741 if (!scrEnabled) | |
2742 return; | |
2743 | |
2744 #ifdef USE_PLOT | |
2745 | |
2746 bm = picture_bw; | |
2747 bcopy = pictureCopy_bw; | |
2748 for (j = 0; j < DISPLAY_SIZE; j++) | |
2749 { | |
2750 if (*bm != *bcopy) | |
2751 { | |
2752 //Only plot data if it has changed since last time | |
2753 m = 0x80000000; | |
2754 | |
2755 x1 = j / LCD_COL_NUM_LWORDS; | |
2756 y1 = j % LCD_COL_NUM_LWORDS; | |
2757 y1 = y1 << 5; | |
2758 y1 = (y1 + 16); | |
2759 x1 = (scrX-1)-x1; | |
2760 kstart = y1; | |
2761 kend = y1+32; | |
2762 for (i = kstart; i < kend; i++) | |
2763 { | |
2764 nPlots++; | |
2765 #ifdef R2D_ENABLED | |
2766 if ((*bm) & m) | |
2767 r2d_draw_point(r2d_g_lcd_gc,x1,(i%64)); | |
2768 else | |
2769 | |
2770 r2d_erase_point(r2d_g_lcd_gc,x1,(i%64)); | |
2771 #endif | |
2772 m >>= 1; | |
2773 } | |
2774 *bcopy = *bm;//Update value | |
2775 } | |
2776 bm++; | |
2777 bcopy++; | |
2778 if (nPlots > MAX_NUMBER_PLOTS) | |
2779 return; | |
2780 } | |
2781 #else | |
2782 if (scrPicPtr != NULL) | |
2783 { | |
2784 #ifdef R2D_ENABLED | |
2785 r2d_fast_blit(scrPicPtr,r2d_g_lcd_gc); | |
2786 #endif | |
2787 vsi_t_sleep(VSI_CALLER (20)); | |
2788 } | |
2789 #endif //old/new | |
2790 } | |
2791 #endif //CSAMPLE | |
2792 | |
2793 //June 03, 2005 REF: GSM-ENH-31636 xpradipg | |
2794 //CRR 28825: xpradipg - 11 Feb 2005 | |
2795 #if (defined(DSAMPLE) || defined(ESAMPLE) || defined(ISAMPLE) || defined(CALLISTO))// changes for flag cleanup and addition for ISAMPLE | |
2796 void scrLCDUpdate (void) | |
2797 { | |
2798 | |
2799 #if defined (WIN32_SIM) | |
2800 return; | |
2801 #endif | |
2802 if (!scrEnabled) | |
2803 return; | |
2804 | |
2805 #ifdef R2D_ENABLED | |
2806 r2d_flush(); | |
2807 #endif | |
2808 } | |
2809 #endif//D-sample | |
2810 | |
2811 /* | |
2812 +--------------------------------------------------------------------+ | |
2813 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2814 | STATE : code ROUTINE : scrMobCommand | | |
2815 +--------------------------------------------------------------------+ | |
2816 | |
2817 PURPOSE : Command string from mobile simulation | |
2818 | |
2819 */ | |
2820 | |
2821 | |
2822 void scrMobCommand (char *s) | |
2823 { | |
2824 #ifdef BSAMPLE | |
2825 char *p; | |
2826 unsigned char *q; | |
2827 int i; | |
2828 char scratch [LCD_ROW*LCD_COL_B*2+100]; /* command buffer */ | |
2829 | |
2830 if (strstr(s,"ena") == s) | |
2831 { | |
2832 mobEnabled = 1; | |
2833 return; | |
2834 } | |
2835 if (strstr(s,"dis") == s) | |
2836 { | |
2837 mobEnabled = 0; | |
2838 return; | |
2839 } | |
2840 if (strstr(s,"ok") == s) | |
2841 { | |
2842 if (xIndex < 0) | |
2843 return; | |
2844 strcpy(scratch,scrHeader); | |
2845 if (xIndex >= sizeof(displayScr)) | |
2846 { | |
2847 strcat(scratch,"done"); | |
2848 mfwExtOut(scratch); | |
2849 return; | |
2850 } | |
2851 strcat(scratch,"data "); | |
2852 p = scratch + strlen(scratch); | |
2853 sprintf(p,"%04d %04d ",xIndex,LCD_COL_B*LCD_ROW/DISPL_DIV); | |
2854 p = scratch + strlen(scratch); | |
2855 q = (UBYTE *) displayScr; | |
2856 for (i = 0; i < LCD_COL_B * LCD_ROW / DISPL_DIV; i++) | |
2857 { | |
2858 sprintf(p,"%02x",q[xIndex++]); | |
2859 p += 2; | |
2860 } | |
2861 *p = '\0'; | |
2862 mfwExtOut(scratch); | |
2863 return; | |
2864 } | |
2865 #endif | |
2866 } | |
2867 | |
2868 | |
2869 | |
2870 /* | |
2871 +--------------------------------------------------------------------+ | |
2872 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2873 | STATE : code ROUTINE : scrInit | | |
2874 +--------------------------------------------------------------------+ | |
2875 | |
2876 PURPOSE : initialize screen driver | |
2877 | |
2878 */ | |
2879 | |
2880 void scrInit (void) | |
2881 { | |
2882 LCD_SetPower(); /* ES!! */ | |
2883 LCD_Reset(); | |
2884 LCD_Enable(1); | |
2885 dspl_InitColour (); | |
2886 | |
2887 #ifdef LSCREEN | |
2888 font_initFont(1); | |
2889 #else | |
2890 font_initFont(0); | |
2891 #endif | |
2892 | |
2893 #ifdef BSAMPLE | |
2894 memset(displayScr,0,sizeof(displayScr)); | |
2895 memset(displayCopy,0,sizeof(displayCopy)); | |
2896 #else | |
2897 scrRivPictureInit(); | |
2898 #endif | |
2899 #ifdef R2D_ENABLED | |
2900 r2d_erase( r2d_g_lcd_gc ); | |
2901 #endif | |
2902 mobEnabled = 0; | |
2903 scrEnabled = 1; | |
2904 internal = 0; | |
2905 scrX = LCD_COL; | |
2906 scrY = LCD_ROW; | |
2907 xIndex = -1; | |
2908 displayData.DisplayType = DSPL_TYPE_GRAPHIC; | |
2909 //GW Set display window to full screen | |
2910 dspl_ResetWindow(); | |
2911 } | |
2912 | |
2913 | |
2914 /* | |
2915 +--------------------------------------------------------------------+ | |
2916 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2917 | STATE : code ROUTINE : scrExit | | |
2918 +--------------------------------------------------------------------+ | |
2919 | |
2920 PURPOSE : finalize screen driver | |
2921 | |
2922 */ | |
2923 | |
2924 void scrExit (void) | |
2925 { | |
2926 LCD_Enable(0); | |
2927 mobEnabled = 0; | |
2928 scrEnabled = 0; | |
2929 xIndex = -1; | |
2930 } | |
2931 | |
2932 | |
2933 /* | |
2934 +--------------------------------------------------------------------+ | |
2935 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2936 | STATE : code ROUTINE : scrUpdate | | |
2937 +--------------------------------------------------------------------+ | |
2938 | |
2939 PURPOSE : set screen update mode | |
2940 | |
2941 GW 18/09/01 clear text invert flag whenever display is enabled/disabled. | |
2942 */ | |
2943 //GW mmi_trace is a call to the MMI to provide timings for MMI updates - | |
2944 //REMOVE FROM FINAL BUILD (if I forget!) | |
2945 int scrUpdate (int onOff) | |
2946 { | |
2947 int ena = scrEnabled; | |
2948 txtInvert = 0; //clear text invert flag whenever display is enabled/disabled. | |
2949 scrEnabled = onOff; | |
2950 if (scrEnabled) | |
2951 { | |
2952 #ifdef MMI_TRACE | |
2953 mmi_trace("scrupdate() enable start"); | |
2954 #endif | |
2955 scrLCDUpdate(); | |
2956 scrMobUpdate(); | |
2957 #ifdef MMI_TRACE | |
2958 mmi_trace("scrupdate() enable end"); | |
2959 #endif | |
2960 } | |
2961 else | |
2962 { | |
2963 #ifdef MMI_TRACE | |
2964 mmi_trace("scrupdate() disabled"); | |
2965 #endif | |
2966 } | |
2967 return ena; | |
2968 } | |
2969 | |
2970 | |
2971 /* | |
2972 +--------------------------------------------------------------------+ | |
2973 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2974 | STATE : code ROUTINE : scrSize | | |
2975 +--------------------------------------------------------------------+ | |
2976 | |
2977 PURPOSE : retrieve display size | |
2978 | |
2979 */ | |
2980 | |
2981 void scrSize (int *x, int *y) | |
2982 { | |
2983 *x = scrX; | |
2984 *y = scrY; | |
2985 } | |
2986 | |
2987 /* | |
2988 +--------------------------------------------------------------------+ | |
2989 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
2990 | STATE : code ROUTINE : scrOnOff | | |
2991 +--------------------------------------------------------------------+ | |
2992 | |
2993 PURPOSE : switch display On/Off | |
2994 | |
2995 */ | |
2996 | |
2997 void scrOnOff (int on) | |
2998 { | |
2999 //kk to be checked | |
3000 /* ## scratch is not required and function mfwExtOut is | |
3001 ## not doing anything | |
3002 sprintf(scratch,"%sscrOnOff:%d",scrHeader,on); | |
3003 mfwExtOut(scratch); | |
3004 */ | |
3005 } | |
3006 | |
3007 #if (!CUST)//JVJE #if (CUST==1) | |
3008 /* | |
3009 +--------------------------------------------------------------------+ | |
3010 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3011 | STATE : code ROUTINE : scrLight | | |
3012 +--------------------------------------------------------------------+ | |
3013 | |
3014 PURPOSE : switch display backlight On/Off | |
3015 | |
3016 */ | |
3017 | |
3018 void scrLight (int on) | |
3019 { | |
3020 //kk to be checked | |
3021 /* ## scratch is not required and function mfwExtOut is | |
3022 ## not doing anything | |
3023 sprintf(scratch,"%sscrLight:%d",scrHeader,on); | |
3024 mfwExtOut(scratch); | |
3025 */ | |
3026 } | |
3027 | |
3028 /* | |
3029 +--------------------------------------------------------------------+ | |
3030 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3031 | STATE : code ROUTINE : scrClear | | |
3032 +--------------------------------------------------------------------+ | |
3033 | |
3034 PURPOSE : clear display | |
3035 | |
3036 */ | |
3037 | |
3038 void scrClear (void) | |
3039 { | |
3040 | |
3041 #ifdef BSAMPLE | |
3042 memset(displayScr,0,sizeof(displayScr)); | |
3043 #else | |
3044 scrRivPictureClear(); | |
3045 #endif | |
3046 | |
3047 if (scrEnabled) | |
3048 { | |
3049 LCD_Clear(); /* TI driver function */ | |
3050 scrMobUpdate(); /* update mobile simulation */ | |
3051 } | |
3052 } | |
3053 #endif //CUST==1 | |
3054 | |
3055 /* | |
3056 +--------------------------------------------------------------------+ | |
3057 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3058 | STATE : code ROUTINE : scrClearRect | | |
3059 +--------------------------------------------------------------------+ | |
3060 | |
3061 PURPOSE : clear display area | |
3062 | |
3063 */ | |
3064 #ifdef DSAMPLE_LITE | |
3065 | |
3066 void scrDrawFilledRect (int px, int py, int sx, int sy, U32 col) | |
3067 { | |
3068 int i,j; | |
3069 U32 opCol; | |
3070 int word; | |
3071 | |
3072 //Limit rectangle to the size of the screen. | |
3073 if ((px >= scrX) || (py >= scrY)) | |
3074 return; | |
3075 | |
3076 if ((col& 0xFF000000) == TRANSPARENT_32BIT_COLOUR) | |
3077 return; //Background colour is transparent | |
3078 | |
3079 //Allow -ve sizes but change data round | |
3080 if (sx <0) | |
3081 { | |
3082 px = px+sx; | |
3083 sx = -sx; | |
3084 } | |
3085 if (sy <0) | |
3086 { | |
3087 py = py+sy; | |
3088 sy = -sy; | |
3089 } | |
3090 //Limit rectangle to size of window | |
3091 if (px<win_x1) | |
3092 { | |
3093 sx = sx - win_x1; | |
3094 px = win_x1; | |
3095 } | |
3096 if (py<win_y1) | |
3097 { | |
3098 sy = sy - win_y1; | |
3099 py = win_y1; | |
3100 } | |
3101 | |
3102 if (px+sx >=win_x2) | |
3103 sx = win_x2 - px-1; | |
3104 if (py+sy >=win_y2) | |
3105 sy = win_y2 - py-1; | |
3106 if ((sx <= 0) || (sy<=0)) | |
3107 return;//cannot draw zero width rectangle. | |
3108 | |
3109 opCol = col; | |
3110 { | |
3111 U32 maskL, maskR; | |
3112 int skipBits,startWord,endWord; | |
3113 maskL = 0xFFFFFFFF; | |
3114 skipBits = px & 0x1F; | |
3115 maskL = maskL << skipBits; | |
3116 startWord = px >> 5; | |
3117 maskR = 0xFFFFFFFF; | |
3118 skipBits = (px+sx) & 0x1F; | |
3119 maskR = ~(maskR << skipBits); | |
3120 endWord = (px+sx) >> 5; | |
3121 if (startWord == endWord) | |
3122 { | |
3123 maskL = maskL & maskR; | |
3124 maskR = maskL; | |
3125 } | |
3126 | |
3127 if (col == 0) | |
3128 { //Set bgd colour to Black (0) | |
3129 for (j = py; j < py + sy; j++) | |
3130 { | |
3131 word = DSPL_GET_LWORD(px,j); | |
3132 picture_bw[word] = picture_bw[word] & (~maskL); | |
3133 word++; | |
3134 for (i = startWord+1; i < endWord; i++) | |
3135 { | |
3136 picture_bw[word] = 0; | |
3137 word++; | |
3138 } | |
3139 word = DSPL_GET_LWORD(px+sx,j); | |
3140 picture_bw[word] = picture_bw[word] & (~maskR); | |
3141 } | |
3142 } | |
3143 else | |
3144 { //Set bgd colour to White (1) | |
3145 for (j = py; j < py + sy; j++) | |
3146 { | |
3147 word = DSPL_GET_LWORD(px,j); | |
3148 picture_bw[word] = picture_bw[word] | (maskL); | |
3149 word++; | |
3150 for (i = startWord+1; i < endWord; i++) | |
3151 { | |
3152 picture_bw[word] = 0xFFFFFFFF; | |
3153 word++; | |
3154 } | |
3155 word = DSPL_GET_LWORD(px+sx,j); | |
3156 picture_bw[word] = picture_bw[word] | (maskR); | |
3157 } | |
3158 } | |
3159 } | |
3160 } | |
3161 #endif | |
3162 | |
3163 #ifdef DSAMPLE_COLOUR | |
3164 | |
3165 void scrDrawFilledRect (int px, int py, int sx, int sy, U32 col) | |
3166 { | |
3167 int i,j; | |
3168 U32 opCol; | |
3169 char* screen; | |
3170 | |
3171 //Limit rectangle to the size of the screen. | |
3172 if ((px >= scrX) || (py >= scrY)) | |
3173 return; | |
3174 | |
3175 if ((col& 0xFF000000) == TRANSPARENT_32BIT_COLOUR) | |
3176 return; //Background colour is transparent | |
3177 | |
3178 //Allow -ve sizes but change data round | |
3179 if (sx <0) | |
3180 { | |
3181 px = px+sx; | |
3182 sx = -sx; | |
3183 } | |
3184 if (sy <0) | |
3185 { | |
3186 py = py+sy; | |
3187 sy = -sy; | |
3188 } | |
3189 //Limit rectangle to size of window | |
3190 if (px<win_x1) | |
3191 { | |
3192 sx = sx - win_x1; | |
3193 px = win_x1; | |
3194 } | |
3195 if (py<win_y1) | |
3196 { | |
3197 sy = sy - win_y1; | |
3198 py = win_y1; | |
3199 } | |
3200 | |
3201 if (px+sx > win_x2) | |
3202 sx = win_x2 - px; | |
3203 if (py+sy > win_y2) | |
3204 sy = win_y2 - py; | |
3205 if ((sx <= 0) || (sy<=0)) | |
3206 return;//cannot draw zero width rectangle. | |
3207 | |
3208 opCol = col; | |
3209 //GW Fix - invert colour | |
3210 #ifdef USE_PLOT | |
3211 for (j = py; j < py + sy; j++) | |
3212 { | |
3213 for (i = px; i < px+sx; i++) | |
3214 scrPoint(i,j,opCol); | |
3215 } | |
3216 #else | |
3217 { | |
3218 U32 lWord,bgdColour; | |
3219 int y; | |
3220 screen = (char*)picture_col; | |
3221 bgdColour = DSPL_GET_BITCOLOUR(col); | |
3222 bgdColourArray[0] = (bgdColour & 0x000000FF); | |
3223 bgdColourArray[1] = (bgdColour & 0x0000FF00) >>8; | |
3224 bgdColourArray[2] = (bgdColour & 0x00FF0000) >>16; | |
3225 bgdColourArray[3] = (bgdColour & 0xFF000000) >>24; | |
3226 for (i=BYTEPERPIXEL;i<sx*BYTEPERPIXEL;i++) | |
3227 bgdColourArray[i] = bgdColourArray[i-BYTEPERPIXEL]; | |
3228 for (y=py; y<py+sy; y++) | |
3229 { | |
3230 // int yOfs = (y*LCD_COL+px); | |
3231 int yOfs = DSPL_GET_BYTE(px,y); | |
3232 memcpy(&screen[yOfs] ,bgdColourArray,sx*BYTEPERPIXEL); | |
3233 } | |
3234 } | |
3235 #endif//use plot | |
3236 } | |
3237 #endif | |
3238 | |
3239 | |
3240 #ifdef BSAMPLE | |
3241 void scrDrawFilledRect (int px, int py, int sx, int sy, U32 col) | |
3242 { | |
3243 scrClearRect (px, py, sx, sy); | |
3244 } | |
3245 #endif | |
3246 #ifdef CSAMPLE | |
3247 void scrDrawFilledRect (int px, int py, int sx, int sy, U32 col) | |
3248 { | |
3249 scrClearRect (px, py, sx, sy); | |
3250 } | |
3251 #endif | |
3252 | |
3253 void scrClearRect (int px, int py, int sx, int sy) | |
3254 { | |
3255 | |
3256 #ifdef BSAMPLE | |
3257 int i,j; | |
3258 int x1, x2; | |
3259 UBYTE m1, m2; | |
3260 #endif | |
3261 | |
3262 #ifdef CSAMPLE | |
3263 int x1; | |
3264 int i,j; | |
3265 int y1s, y2s; | |
3266 int y1f, y2f; | |
3267 U32 m1s,m2s; | |
3268 U32 m1f,m2f; | |
3269 | |
3270 int y1, y2; | |
3271 U32 m1,m2; | |
3272 #endif | |
3273 | |
3274 if (px < 0 || py < 0 || px >= scrX || py >= scrY | |
3275 || sx < 0 || sy < 0) | |
3276 return; | |
3277 if (px + sx > scrX) | |
3278 sx = scrX - px; | |
3279 if (py + sy > scrY) | |
3280 sy = scrY - py; | |
3281 | |
3282 //Limit rectangle to size of window | |
3283 if (px<win_x1) | |
3284 { | |
3285 sx = sx - win_x1; | |
3286 px = win_x1; | |
3287 } | |
3288 if (py<win_y1) | |
3289 { | |
3290 sy = sy - win_y1; | |
3291 py = win_y1; | |
3292 } | |
3293 | |
3294 if (px+sx >win_x2) | |
3295 sx = win_x2 - px; | |
3296 if (py+sy >win_y2) | |
3297 sy = win_y2 - py; | |
3298 if ((sx <= 0) || (sy<=0)) | |
3299 return;//cannot draw zero width rectangle. | |
3300 | |
3301 #ifdef BSAMPLE | |
3302 x1 = px / 8; /* first x offset */ | |
3303 x2 = (px + sx) / 8; /* last x offset */ | |
3304 m1 = m2 = 0xff; | |
3305 m1 = (UBYTE) ~(m1 >> (px & 7)); /* left mask */ | |
3306 m2 = (UBYTE) (m2 >> ((px + sx) & 7)); /* right mask */ | |
3307 if (x1 == x2) | |
3308 m1 = m2 = m1 | m2; /* combined masks */ | |
3309 for (j = py; j < py + sy; j++) | |
3310 { | |
3311 displayScr[j][x1] &= m1; | |
3312 for (i = x1 + 1; i < x2; i++) | |
3313 displayScr[j][i] = '\0'; | |
3314 displayScr[j][x2] &= m2; | |
3315 } | |
3316 #endif | |
3317 | |
3318 #ifdef CSAMPLE | |
3319 for (i=0;i<sx;i++) | |
3320 for (j=0;j<sy;j++) | |
3321 scrPoint(px+i,py+j,0); | |
3322 #endif | |
3323 | |
3324 //June 03, 2005 REF: GSM-ENH-31636 xpradipg | |
3325 //CRR 28825: xpradipg - 11 Feb 2005 | |
3326 #if (defined(DSAMPLE) || defined(ESAMPLE) || defined(ISAMPLE) || defined(CALLISTO)) //clean up of flag and addition for ISAMPLE | |
3327 scrDrawFilledRect ( px, py, sx, sy, dspl_GetBgdColour()); | |
3328 #endif | |
3329 } | |
3330 | |
3331 | |
3332 /* | |
3333 +--------------------------------------------------------------------+ | |
3334 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3335 | STATE : code ROUTINE : scrText_Unicode | | |
3336 +--------------------------------------------------------------------+ | |
3337 | |
3338 PURPOSE : draw text | |
3339 | |
3340 */ | |
3341 | |
3342 void scrText_Unicode (int x, int y, USHORT *txt) | |
3343 { | |
3344 UBYTE current_width=0; | |
3345 USHORT current_code,first_byte_code,second_byte_code; | |
3346 t_font_bitmap* current_bitmap,*error_bitmap; | |
3347 | |
3348 if ( y > scrY) | |
3349 return; | |
3350 | |
3351 while ((*txt) && (x <= scrX)) | |
3352 { | |
3353 current_code = (USHORT)((*txt)<<8)+(USHORT)((*txt)>>8);/*The USHORT is inverted, therefore we have to apply this simple change*/ | |
3354 current_bitmap = get_bitmap(current_code); | |
3355 if (!current_bitmap) /*ASCII codes will be represented*/ | |
3356 { | |
3357 first_byte_code = (USHORT)((*txt)&0xFF); | |
3358 error_bitmap = get_bitmap(first_byte_code); | |
3359 if (error_bitmap) | |
3360 { | |
3361 dspl_show_bitmap(x,y,error_bitmap,SHOWBITMAP_INVERT); | |
3362 x += error_bitmap->width; | |
3363 } | |
3364 second_byte_code = (USHORT)((*txt)>>8); | |
3365 error_bitmap = get_bitmap(second_byte_code); | |
3366 if (error_bitmap) | |
3367 { | |
3368 dspl_show_bitmap(x,y,error_bitmap,SHOWBITMAP_INVERT); | |
3369 x += error_bitmap->width; | |
3370 } | |
3371 } | |
3372 else | |
3373 { | |
3374 dspl_show_bitmap(x,y,current_bitmap,SHOWBITMAP_NORMAL); | |
3375 x += current_bitmap->width; | |
3376 } | |
3377 txt++; | |
3378 } | |
3379 | |
3380 } | |
3381 | |
3382 | |
3383 #ifndef DSAMPLE_COLOUR | |
3384 //Should work for DSAMPLE_LITE | |
3385 void dspl_show_bitmap(int x,int y,t_font_bitmap* current_bitmap,U32 attr ) | |
3386 { | |
3387 USHORT i, j,a,b; | |
3388 int bmpWidthBytes; | |
3389 bmpWidthBytes = (current_bitmap->width + 0x07) >> 3; | |
3390 | |
3391 for (i = 0; i < current_bitmap->height; i++) | |
3392 for (j = 0; j < current_bitmap->width; j++) | |
3393 { | |
3394 a = (j&(0x07)); | |
3395 b = i*(bmpWidthBytes)+((j&0xF8)>>3); | |
3396 if ((attr & SHOWBITMAP_SCALE_2x4) == 0) | |
3397 { | |
3398 if ((attr & SHOWBITMAP_NORMAL_MASK) == SHOWBITMAP_NORMAL) | |
3399 scrPoint(x+j,y+i,current_bitmap->bitmap[b]&(0x80>>a)); | |
3400 else | |
3401 scrPoint(x+j,y+i,((UBYTE)~(current_bitmap->bitmap[b]))&(0x80>>a)); | |
3402 } | |
3403 else | |
3404 { | |
3405 int x1,y1; | |
3406 int px = (current_bitmap->bitmap[b]&(0x80>>a)); | |
3407 for (x1 = x+j*2;x1 < x+j*2+2; x1++) | |
3408 for (y1 = y+i*4; y1<y+i*4+4; y1++) | |
3409 scrPoint(x1,y1,px); | |
3410 } | |
3411 } | |
3412 } | |
3413 | |
3414 #endif | |
3415 | |
3416 #ifdef DSAMPLE_COLOUR | |
3417 void dspl_show_bitmap(int x,int y,t_font_bitmap* current_bitmap,U32 attr ) | |
3418 { | |
3419 int i, j; | |
3420 int bmpByte; // which byte in bitmap we are looking at | |
3421 UBYTE bmpMask; // which bit in the (b+w) bitmap we are looking at | |
3422 UBYTE bitSet; // is the bit set or clear. | |
3423 U32 bitCol; // colour of bit in a colour bitmap | |
3424 U32 fCol,bCol, col;/*MC SPR 1526*/ | |
3425 int step; | |
3426 int lWord; | |
3427 | |
3428 if (current_bitmap==NULL) | |
3429 return; | |
3430 switch (current_bitmap->format) | |
3431 { | |
3432 case BMP_FORMAT_BW_UNPACKED: | |
3433 case BMP_FORMAT_BW_PACKED: | |
3434 //b+w bitmap - deal with both packed and unpacked. | |
3435 bmpMask = 0x80; | |
3436 bmpByte = 0; | |
3437 if (attr & SHOWBITMAP_INVERT) //invert | |
3438 { | |
3439 fCol = dspl_GetBgdColour(); | |
3440 bCol = dspl_GetFgdColour(); | |
3441 } | |
3442 else | |
3443 { | |
3444 fCol = dspl_GetFgdColour(); | |
3445 bCol = dspl_GetBgdColour(); | |
3446 } | |
3447 if (fCol==bCol) | |
3448 { | |
3449 fCol = 0x000000FF; | |
3450 bCol =0x00FFFF00; | |
3451 } | |
3452 for (i = 0; i < current_bitmap->height; i++) | |
3453 { | |
3454 for (j = 0; j < current_bitmap->width; j++) | |
3455 { | |
3456 /* a = (j&(0x07)); | |
3457 b = i*((current_bitmap->bitmapSize)/(current_bitmap->height))+((j&0xF8)>>3); | |
3458 bitSet = current_bitmap->bitmap[b]&(0x80>>a);*/ | |
3459 bitSet = current_bitmap->bitmap[bmpByte]&(bmpMask); | |
3460 | |
3461 /*MC SPR 1526*/ | |
3462 if (bitSet) | |
3463 col = fCol; | |
3464 else | |
3465 col = bCol; | |
3466 if (col!=TRANSPARENT_32BIT_COLOUR)/*if colour transparent, don't draw point*/ | |
3467 { | |
3468 scrPoint(x+j,y+i,col); | |
3469 } | |
3470 /*MC 1526 end*/ | |
3471 | |
3472 if (bmpMask <= 1) | |
3473 { | |
3474 bmpMask = 0x80; | |
3475 bmpByte++; | |
3476 } | |
3477 else | |
3478 bmpMask = bmpMask >>1; | |
3479 } | |
3480 // If we have an unpacked bitmaps and we are not already on a new byte, we move to a new byte | |
3481 if ((current_bitmap->format == BMP_FORMAT_BW_UNPACKED) && (bmpMask != 0x80)) | |
3482 { | |
3483 bmpMask = 0x80; | |
3484 bmpByte++; | |
3485 } | |
3486 } | |
3487 break; | |
3488 case BMP_FORMAT_256_COLOUR: | |
3489 //bitmap is 256 colour bitmap - ignore 'attr' | |
3490 bmpByte = 0; | |
3491 | |
3492 for (i = 0; i < current_bitmap->height; i++) | |
3493 { | |
3494 for (j = 0; j < current_bitmap->width; j++) | |
3495 { | |
3496 UINT32 col; | |
3497 UINT32 colR,colG,colB; | |
3498 col = current_bitmap->bitmap[bmpByte]; | |
3499 if (col!=TRANSPARENT_256_COL) | |
3500 { | |
3501 bitCol = (((col &0xE0) <<16) | | |
3502 ((col &0x1C) <<11) | | |
3503 ((col &0x03) << 6));/**/ | |
3504 //assume 16 bit colour | |
3505 scrPoint(x+j, y+i,bitCol); | |
3506 } | |
3507 bmpByte = bmpByte+1; //move to next byte | |
3508 | |
3509 } | |
3510 } | |
3511 break; | |
3512 case BMP_FORMAT_32BIT_COLOUR: | |
3513 //bitmap is a 32 bit colour bitmap - ignore 'attr' | |
3514 bmpByte = 0; | |
3515 for (i = 0; i < current_bitmap->height; i++) | |
3516 { | |
3517 for (j = 0; j < current_bitmap->width; j++) | |
3518 { | |
3519 //32 bit bitmap - data is in bytes | |
3520 //bmpByte = (i*current_bitmap->width+j)*4; | |
3521 bitCol = ((current_bitmap->bitmap[bmpByte] <<24) | | |
3522 (current_bitmap->bitmap[bmpByte+1] <<16) | | |
3523 (current_bitmap->bitmap[bmpByte+2] <<8) | | |
3524 (current_bitmap->bitmap[bmpByte+3])); | |
3525 if ((bitCol & 0xFF000000)!=TRANSPARENT_32BIT_COLOUR) | |
3526 scrPoint(x+j,y+i,bitCol); | |
3527 bmpByte = bmpByte+4; //move to next 32bit word | |
3528 } | |
3529 } | |
3530 break; | |
3531 case BMP_FORMAT_16BIT_LCD_COLOUR: //32 bits only first 2 bytes used | |
3532 case BMP_FORMAT_16BIT_LCD_COMPRESSED_COLOUR: //16 bits | |
3533 bmpByte = 0; | |
3534 if (current_bitmap->format == BMP_FORMAT_16BIT_LCD_COMPRESSED_COLOUR) | |
3535 step = 2; | |
3536 else | |
3537 step = 4; | |
3538 for (i = 0; i < current_bitmap->height; i++) | |
3539 { | |
3540 for (j = 0; j < current_bitmap->width; j++) | |
3541 { | |
3542 //32 bit bitmap - data is in bytes | |
3543 //bmpByte = (i*current_bitmap->width+j)*4; | |
3544 bitCol = ((current_bitmap->bitmap[bmpByte+1] <<8) | | |
3545 (current_bitmap->bitmap[bmpByte])); | |
3546 if ((bitCol & 0x0000FFFF)!=TRANSPARENT_16BIT_COL) | |
3547 { | |
3548 | |
3549 lWord = DSPL_GET_LWORD(x+j,y+i); | |
3550 // July 1, 2005 REF: CRR 32677 - xpradipg | |
3551 // The data present of all 16bit images are in the negated format hence we | |
3552 // renegate to get it in the right format | |
3553 #if (defined(ISAMPLE) ||defined(CALLISTO)) | |
3554 bitCol = ~bitCol; | |
3555 #endif | |
3556 DSPL_SET_BITCOLOUR(x+j,lWord,bitCol,"dsplShowbitmap"); | |
3557 } | |
3558 bmpByte = bmpByte+step; //move to next 32/16bit word | |
3559 } | |
3560 } | |
3561 | |
3562 break; | |
3563 default: //Unknown format | |
3564 break; | |
3565 } | |
3566 } | |
3567 #endif | |
3568 | |
3569 | |
3570 #define NO_COLOUR 0xFF123456 | |
3571 /* | |
3572 +--------------------------------------------------------------------+ | |
3573 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3574 | STATE : code ROUTINE : dspl_setBorderWidth | | |
3575 +--------------------------------------------------------------------+ | |
3576 | |
3577 PURPOSE : sets current border width | |
3578 | |
3579 GW 10/02/03 SPR#1721 - Created | |
3580 */ | |
3581 static int txtBorder=0; | |
3582 int dspl_setBorderWidth(int borderSize) | |
3583 { | |
3584 int oldBorder; | |
3585 oldBorder = txtBorder; | |
3586 if ((borderSize >=0) && (borderSize <=4)) | |
3587 txtBorder = borderSize; | |
3588 return (oldBorder); | |
3589 } | |
3590 | |
3591 /* | |
3592 +--------------------------------------------------------------------+ | |
3593 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3594 | STATE : code ROUTINE : dspl_getBorderWidth | | |
3595 +--------------------------------------------------------------------+ | |
3596 | |
3597 PURPOSE : returns current border width | |
3598 | |
3599 GW 10/02/03 SPR#1721 - Created | |
3600 | |
3601 */ | |
3602 int dspl_getBorderWidth(void) | |
3603 { | |
3604 return(txtBorder); | |
3605 } | |
3606 /* | |
3607 +--------------------------------------------------------------------+ | |
3608 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3609 | STATE : code ROUTINE : scrCharBorderOutput | | |
3610 +--------------------------------------------------------------------+ | |
3611 | |
3612 PURPOSE : draw text with a border | |
3613 | |
3614 GW 10/02/03 SPR#1721 - Created | |
3615 */ | |
3616 void scrCharBorderOutput(t_font_bitmap* chrBmp, | |
3617 unsigned int fgdCol,unsigned int bgdCol,unsigned int borderCol, | |
3618 int bWidth, | |
3619 int px,int py | |
3620 ) | |
3621 { | |
3622 int x,y,i; | |
3623 int line[10]; | |
3624 int ofs; | |
3625 int bgdLine; | |
3626 int col; | |
3627 int emask,pmask; | |
3628 int init_emask = (0x01 << (28+bWidth)); | |
3629 int init_pmask = (0x01 << (28+bWidth)); | |
3630 /* | |
3631 | |
3632 */ | |
3633 for (i=0;i<10;i++) | |
3634 line[i] = 0; | |
3635 | |
3636 //trace("col=",fgdCol, bgdCol,borderCol,0x13); | |
3637 | |
3638 //set up border mask | |
3639 for (i=1;i<bWidth*2;i++) | |
3640 { | |
3641 init_emask = init_emask | (init_pmask >> i) | (init_pmask << i); | |
3642 } | |
3643 //trace("masks=",init_emask,init_pmask,0,0x12); | |
3644 | |
3645 for (y=-bWidth;y<chrBmp->height+bWidth;y++) | |
3646 { | |
3647 //trace("y,ht,bWidth",y,chrBmp->height,bWidth, 0x03); | |
3648 for (i=0;i<bWidth*2;i++) | |
3649 line[i]=line[i+1]; | |
3650 line[bWidth*2] =0; | |
3651 | |
3652 if (y+bWidth<chrBmp->height) | |
3653 { | |
3654 //work out where we want to display background | |
3655 bgdLine = 0x0FFFFFF0; | |
3656 bgdLine = bgdLine & (bgdLine << (24-chrBmp->width)); | |
3657 //Assume bitmaps are unpacked | |
3658 switch((chrBmp->width+7) & (0xF8)) | |
3659 { | |
3660 case 0x00: //no data | |
3661 break; | |
3662 case 0x08: // 1 byte/char | |
3663 ofs = y+bWidth; | |
3664 line[bWidth*2] = ((unsigned int)chrBmp->bitmap[ofs]) << 20; | |
3665 break; | |
3666 case 0x10: // 2 bytes/char | |
3667 ofs = (y+bWidth)*2; | |
3668 line[bWidth*2] = (((unsigned int)chrBmp->bitmap[ofs]) << 20) | | |
3669 (((unsigned int)chrBmp->bitmap[ofs+1]) << 12) ; | |
3670 break; | |
3671 case 0x18: // 3 bytes/char | |
3672 ofs = (y+bWidth)*3; | |
3673 line[bWidth*2] = (((unsigned int)chrBmp->bitmap[ofs]) << 20) | | |
3674 (((unsigned int)chrBmp->bitmap[ofs+1]) << 12) | | |
3675 (((unsigned int)chrBmp->bitmap[ofs+2]) << 4) ; | |
3676 break; | |
3677 default:// unable to handle bitmaps > 24 pixels wide | |
3678 //output checkerboard pattern as an error | |
3679 if (y &0x01) | |
3680 line[bWidth*2] = 0x0CCCCCC0; | |
3681 else | |
3682 line[bWidth*2] = 0x05555550; | |
3683 break; | |
3684 } | |
3685 } | |
3686 else | |
3687 { | |
3688 line[bWidth*2] = 0x00000000; | |
3689 bgdLine = 0x00; | |
3690 } | |
3691 //trace("line=",line[0],line[1], line[2], 0x13); | |
3692 | |
3693 emask = init_emask; // if any of the 3 pixels are set - erase point | |
3694 pmask = init_pmask; // only when pixel is set - plot point. | |
3695 | |
3696 for (x=-bWidth;x<chrBmp->width+bWidth;x++) | |
3697 { | |
3698 col = NO_COLOUR; | |
3699 if (line[bWidth] & pmask) | |
3700 { | |
3701 //pixel is in fgd colour | |
3702 col = fgdCol; | |
3703 } | |
3704 else | |
3705 { | |
3706 for (i=0;i<bWidth*2+1;i++) | |
3707 { | |
3708 if (line[i] & emask) | |
3709 col = borderCol; | |
3710 } | |
3711 if ((bgdLine & pmask) && (col == NO_COLOUR)) | |
3712 { | |
3713 col = bgdCol; | |
3714 } | |
3715 } | |
3716 if ((col != NO_COLOUR) && (col != TRANSPARENT_32BIT_COLOUR)) | |
3717 scrPoint(px+x,py+y,col); | |
3718 emask = emask>>1; | |
3719 pmask = pmask>>1; | |
3720 // trace("masks=",emask,pmask,col,0x13); | |
3721 } | |
3722 } | |
3723 } | |
3724 | |
3725 /* | |
3726 +--------------------------------------------------------------------+ | |
3727 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3728 | STATE : code ROUTINE : scrFastCharOutput | | |
3729 +--------------------------------------------------------------------+ | |
3730 | |
3731 PURPOSE : draw text avoiding using scrPoint | |
3732 | |
3733 GW 10/02/03 SPR#1736 - Created | |
3734 */ | |
3735 #ifdef DSAMPLE_COLOUR | |
3736 | |
3737 void scrFastCharOutput(t_font_bitmap* chrBmp, | |
3738 unsigned int fColconv,unsigned int bColconv, | |
3739 int x,int y | |
3740 ) | |
3741 { | |
3742 int fHeight = dspl_GetFontHeight(); | |
3743 int ofs = chrBmp->height - fHeight; | |
3744 int width = chrBmp->width; | |
3745 int i,j,k = 0; | |
3746 int sx,sy,ex,ey,lWord; | |
3747 int bitSet; | |
3748 UBYTE mask; | |
3749 int ofsj,nbytes; | |
3750 unsigned int col; | |
3751 //ensure that the data is never wiritten 'off-screen' | |
3752 if (x+width > win_x2) | |
3753 ex = win_x2-x; | |
3754 else | |
3755 ex = width; | |
3756 if (y+fHeight > win_y2) | |
3757 ey = win_y2-y; | |
3758 else | |
3759 ey = fHeight; | |
3760 if (x < win_x1) | |
3761 sx = win_x1-x; | |
3762 else | |
3763 sx = 0; | |
3764 if (y < win_y1) | |
3765 sy = win_y1-y; | |
3766 else | |
3767 sy = 0; | |
3768 | |
3769 nbytes = (width+7) >>3; | |
3770 ofs = ofs + sy; | |
3771 for (i=sy;i<ey;i++) | |
3772 { | |
3773 mask = 0x80 >> (sx & 0x07); | |
3774 ofsj = sx >> 3; | |
3775 for (j=sx;j<ex;j++) | |
3776 { | |
3777 //Have we data for the bitmap ?. If not, output a blank line. | |
3778 if (ofs >=0) | |
3779 bitSet = chrBmp->bitmap[ofs*nbytes+ofsj]&(mask); | |
3780 else | |
3781 bitSet = 0; | |
3782 | |
3783 if (bitSet) | |
3784 col = fColconv; | |
3785 else | |
3786 col = bColconv; | |
3787 if (col!=TRANSPARENT_32BIT_COLOUR) | |
3788 { | |
3789 lWord = DSPL_GET_LWORD(j+x,i+y); | |
3790 DSPL_SET_BITCOLOUR(j+x,lWord,col,"scrFastCharOutput"); | |
3791 } | |
3792 mask = mask >> 1; | |
3793 if (mask==0) | |
3794 { | |
3795 ofsj++; | |
3796 mask = 0x80; | |
3797 } | |
3798 } | |
3799 ofs++; | |
3800 } | |
3801 } | |
3802 #endif | |
3803 | |
3804 /* | |
3805 +--------------------------------------------------------------------+ | |
3806 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3807 | STATE : code ROUTINE : scrCharOutput | | |
3808 +--------------------------------------------------------------------+ | |
3809 | |
3810 PURPOSE : draw text | |
3811 | |
3812 GW 10/02/03 SPR#1736 - Created | |
3813 */ | |
3814 void scrCharOutput(t_font_bitmap* chrBmp, | |
3815 unsigned int fCol,unsigned int bCol, | |
3816 int x,int y, | |
3817 int wChar, int hChar | |
3818 ) | |
3819 { | |
3820 int fHeight = dspl_GetFontHeight(); | |
3821 int ofs = chrBmp->height - fHeight; | |
3822 int width = chrBmp->width; | |
3823 int i,j,k = 0; | |
3824 int bitSet; | |
3825 UBYTE mask; | |
3826 int ofsj,nbytes; | |
3827 unsigned int col; | |
3828 int shiftj; | |
3829 ofs = chrBmp->height - fHeight; | |
3830 width = chrBmp->width; | |
3831 k = 0; | |
3832 for (i=0;i<fHeight;i++) | |
3833 { | |
3834 k = 0; | |
3835 nbytes = (width+7) >>3; | |
3836 for (j=0;j<width;j++) | |
3837 { | |
3838 shiftj= j & 0x07; | |
3839 ofsj = j >> 3; | |
3840 //Have we data for the bitmap ?. If not, output a blank line. | |
3841 if (ofs >=0) | |
3842 bitSet = chrBmp->bitmap[ofs*nbytes+ofsj]&(0x80>>shiftj); | |
3843 else | |
3844 bitSet = 0; | |
3845 | |
3846 if (bitSet) | |
3847 col = fCol; | |
3848 else | |
3849 col = bCol; | |
3850 if (col!=TRANSPARENT_32BIT_COLOUR) | |
3851 { | |
3852 if (!hChar) | |
3853 scrPoint(k+x,i+y,col); | |
3854 else | |
3855 { | |
3856 scrPoint(k+x,i*2+y,col); | |
3857 scrPoint(k+x,i*2+1+y,col); | |
3858 } | |
3859 if (wChar) | |
3860 { | |
3861 if ((j>=1) && (j<=wChar)) | |
3862 { //for j=1,2,3 - plot 2 pixels | |
3863 k++; | |
3864 if (!hChar) | |
3865 scrPoint(k+x,i+y,col); | |
3866 else | |
3867 { | |
3868 scrPoint(k+x,i*2+y,col); | |
3869 scrPoint(k+x,i*2+1+y,col); | |
3870 } | |
3871 } | |
3872 } | |
3873 } | |
3874 k++; | |
3875 } | |
3876 ofs++; | |
3877 } | |
3878 } | |
3879 | |
3880 | |
3881 /* | |
3882 +--------------------------------------------------------------------+ | |
3883 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
3884 | STATE : code ROUTINE : dspl_ScrText | | |
3885 +--------------------------------------------------------------------+ | |
3886 | |
3887 PURPOSE : draw a line of ascii/unicode text | |
3888 | |
3889 GW 18/09/01 - Made invert flag local to file not procedure | |
3890 GW 10/02/03 SPR#1721 Added code to call separate procedure if a border is required. | |
3891 Removed existing 'border' code. | |
3892 GW 14/02/03 SPR#1736 - Split code into separate procedures | |
3893 Modified error display code to output ascii characters of the code if no | |
3894 matching bitmap is found. | |
3895 */ | |
3896 void dspl_ScrText (int x, int y, char *txt, int style) | |
3897 { | |
3898 int nChar = 0; | |
3899 int i, j, k; | |
3900 t_font_bitmap* chrBmp; | |
3901 t_font_bitmap* errBmp[2] = {NULL,NULL}; | |
3902 int str1, str2; | |
3903 int border = 0; | |
3904 int shadow = 0; | |
3905 int fHeight; | |
3906 int wChar,hChar,shadowHt; | |
3907 unsigned int fCol,bCol,borderCol,shadowCol,fColconv,bColconv; | |
3908 unsigned int col; | |
3909 int startX; | |
3910 USHORT code; | |
3911 | |
3912 startX = x; | |
3913 shadowCol = 0; | |
3914 borderCol = 0; | |
3915 border = dspl_getBorderWidth(); | |
3916 //default to wide chars (for the moment) | |
3917 if (style & TXT_STYLE_WIDECHAR) | |
3918 wChar = 3; | |
3919 else | |
3920 wChar = 0; | |
3921 if (style & TXT_STYLE_HIGHCHAR) | |
3922 hChar = 1; | |
3923 else | |
3924 hChar = 0; | |
3925 | |
3926 //Set-up default colours | |
3927 fCol = dspl_GetFgdColour(); | |
3928 bCol = dspl_GetBgdColour(); | |
3929 switch (style & TXT_STYLE_MASK) | |
3930 { | |
3931 case TXT_STYLE_NORMAL: //Normal | |
3932 default: | |
3933 break; | |
3934 case TXT_STYLE_INVERT: //Invert | |
3935 fCol = dspl_GetBgdColour(); | |
3936 bCol = dspl_GetFgdColour(); | |
3937 break; | |
3938 case TXT_STYLE_HIGHLIGHT: //highlight - colour background of selected item in differently. | |
3939 bCol = dspl_GetHighlightColour(); | |
3940 break; | |
3941 case TXT_STYLE_BORDER: // 1 pixelborder | |
3942 if (border==0) | |
3943 border = 1; | |
3944 break; | |
3945 case TXT_STYLE_2PIXEL_BORDER: // 2 pixelborder | |
3946 if (border==0) | |
3947 border = 2; | |
3948 break; | |
3949 case TXT_STYLE_3PIXEL_BORDER: // 3 pixelborder | |
3950 if (border==0) | |
3951 border = 3; | |
3952 break; | |
3953 case TXT_STYLE_4PIXEL_BORDER: // 4 pixelborder | |
3954 if (border==0) | |
3955 border = 4; | |
3956 break; | |
3957 case TXT_STYLE_SHADOW1: //shadow | |
3958 shadow = 1; | |
3959 break; | |
3960 case TXT_STYLE_SHADOW2: //deeper shadow | |
3961 shadow = 2; | |
3962 break; | |
3963 } | |
3964 | |
3965 if (fCol==bCol) | |
3966 { | |
3967 fCol = 0x00FF0000; | |
3968 bCol = 0x0000FFFF; | |
3969 } | |
3970 if (border) | |
3971 { | |
3972 borderCol = dspl_GetBorderColour(); | |
3973 if (borderCol == fCol) | |
3974 { //A border colour the same as the text colour - get a contrasting colour | |
3975 borderCol = dspl_GetContrastColour(fCol); | |
3976 } | |
3977 } | |
3978 else | |
3979 borderCol = 0; | |
3980 | |
3981 if (shadow) | |
3982 shadowCol = dspl_GetShadowColour(); | |
3983 else | |
3984 shadowCol = 0; | |
3985 | |
3986 // SH - modified because it doesn't allow text to start off the screen | |
3987 // GW - allow text to start off-screen but finish if completely off-screen | |
3988 if (y > scrY) | |
3989 return; | |
3990 if (txt ==NULL) | |
3991 return; | |
3992 | |
3993 fHeight = dspl_GetFontHeight(); | |
3994 if (hChar) | |
3995 shadowHt = fHeight*2; | |
3996 else | |
3997 shadowHt = fHeight; | |
3998 | |
3999 //For faster operation - precalculate colours | |
4000 #ifdef DSAMPLE_COLOUR | |
4001 if (fCol!=TRANSPARENT_32BIT_COLOUR) | |
4002 fColconv = DSPL_GET_BITCOLOUR(fCol); | |
4003 else | |
4004 fColconv = fCol; | |
4005 if (bCol!=TRANSPARENT_32BIT_COLOUR) | |
4006 bColconv = DSPL_GET_BITCOLOUR(bCol); | |
4007 else | |
4008 bColconv = bCol; | |
4009 #endif | |
4010 code = 0xFFFF; | |
4011 while ((code !=0) &&(x <= scrX)) | |
4012 { | |
4013 nChar++; | |
4014 /*mc SPR 1319*/ | |
4015 if (style &TXT_STYLE_UNICODE) | |
4016 { | |
4017 str1 = *txt; | |
4018 str2 = *(txt+1); | |
4019 code = ((str1<<8)&0xFF00) | (str2&0x00ff); | |
4020 } | |
4021 else/*mc end*/ | |
4022 { | |
4023 str1 = *txt; | |
4024 str2 = 0x00; | |
4025 /*SPR 1508, convert ASCII char to unicode before drawing it*/ | |
4026 code = translation_ascii_2_unicode[*txt]; | |
4027 } | |
4028 if (code != 0) | |
4029 { | |
4030 chrBmp = get_bitmap(code); | |
4031 if (chrBmp == NULL) | |
4032 { | |
4033 errBmp[0] = get_bitmap(str1); | |
4034 errBmp[1] = get_bitmap(str2); | |
4035 } | |
4036 #ifdef MMI_TRACE | |
4037 { | |
4038 char bfr[40]; | |
4039 if ((chrBmp==NULL) || (chrBmp->code==0xFFFF)) | |
4040 { | |
4041 sprintf(bfr,"Undefined bitmap for 0x%04X",code); | |
4042 mmi_trace(bfr); | |
4043 } | |
4044 } | |
4045 #endif | |
4046 } | |
4047 else //end of string reached | |
4048 chrBmp =NULL; | |
4049 if (chrBmp != NULL) | |
4050 { | |
4051 if (border) | |
4052 { | |
4053 scrCharBorderOutput(chrBmp,fCol,bCol,borderCol,border,x,y); | |
4054 } | |
4055 #ifdef DSAMPLE_COLOUR | |
4056 else if ((!hChar) && (!wChar)) | |
4057 { //GW 28/11/02 - for speed, don't use 'scrPoint' | |
4058 //NB Code is only correct for a D-sample | |
4059 scrFastCharOutput(chrBmp,fColconv,bColconv,x,y); | |
4060 } | |
4061 #endif //DSAMPLE_COLOUR | |
4062 else | |
4063 { | |
4064 scrCharOutput(chrBmp,fCol,bCol,x,y,wChar,hChar); | |
4065 } | |
4066 x = x + chrBmp->width + wChar; //add 3 for 'wide' chars | |
4067 //If there is a pixel border between chars at the moment - | |
4068 x = x+border; | |
4069 } | |
4070 else if (code!=0) | |
4071 { //We have no bitmap - display ascii equivalent | |
4072 for (i=0;i<2;i++) | |
4073 { if (errBmp[i]!= NULL) | |
4074 { | |
4075 scrCharOutput(errBmp[i],fCol,bCol,x,y,wChar,hChar); | |
4076 x = x + errBmp[i]->width + wChar; | |
4077 errBmp[i] = NULL; | |
4078 } | |
4079 } | |
4080 } | |
4081 /*MC SPR 1319*/ | |
4082 if (style &TXT_STYLE_UNICODE) | |
4083 txt+=2; | |
4084 else | |
4085 /*mc end*/ | |
4086 txt++; | |
4087 } | |
4088 if (shadow) | |
4089 { | |
4090 for (i=0;i<shadowHt;i++) | |
4091 { | |
4092 for (k=0;k<shadow;k++) | |
4093 scrPoint(x+k,i+y+k,shadowCol); | |
4094 } | |
4095 for (j=startX;j<x;j++) | |
4096 { | |
4097 for (k=0;k<shadow;k++) | |
4098 scrPoint(j+1+k,shadowHt+y+k, shadowCol); | |
4099 } | |
4100 } | |
4101 #ifdef MMI_TRACE | |
4102 | |
4103 { | |
4104 char bfr[40]; | |
4105 sprintf(bfr,"Nchr=%d (%d,%d)",nChar,x,y); | |
4106 mmi_trace(bfr); | |
4107 } | |
4108 #endif | |
4109 } | |
4110 | |
4111 | |
4112 void scrText (int x, int y, char *txt) | |
4113 { | |
4114 //Display non-inverted text | |
4115 dspl_ScrText (x,y, txt, TXT_STYLE_NORMAL); | |
4116 } | |
4117 | |
4118 /* | |
4119 +--------------------------------------------------------------------+ | |
4120 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4121 | STATE : code ROUTINE : scrText_Invert_Unicode| | |
4122 +--------------------------------------------------------------------+ | |
4123 | |
4124 PURPOSE : draw text inverted | |
4125 | |
4126 */ | |
4127 | |
4128 void scrText_Invert_Unicode (int x, int y, USHORT *txt) | |
4129 { | |
4130 UBYTE current_width=0; | |
4131 USHORT current_code,first_byte_code,second_byte_code; | |
4132 t_font_bitmap* current_bitmap,*error_bitmap; | |
4133 if (x < 0 || y < 0 || y + 12 > scrY) | |
4134 return; | |
4135 | |
4136 | |
4137 | |
4138 while ((*txt) && (x + current_width <= scrX)) | |
4139 { | |
4140 current_code = (USHORT)((*txt)<<8)+(USHORT)((*txt)>>8);/*The USHORT is inverted, therefore we have to apply this simple change*/ | |
4141 current_bitmap = get_bitmap(current_code); | |
4142 if (!current_bitmap) /*ASCII codes will be represented*/ | |
4143 { | |
4144 first_byte_code = (USHORT)((*txt)&0xFF); | |
4145 error_bitmap = get_bitmap(first_byte_code); | |
4146 if (error_bitmap) | |
4147 { | |
4148 dspl_show_bitmap(x,y,error_bitmap,SHOWBITMAP_INVERT); | |
4149 x += error_bitmap->width; | |
4150 } | |
4151 second_byte_code = (USHORT)((*txt)>>8); | |
4152 error_bitmap = get_bitmap(second_byte_code); | |
4153 if (error_bitmap) | |
4154 { | |
4155 dspl_show_bitmap(x,y,error_bitmap,SHOWBITMAP_INVERT); | |
4156 x += error_bitmap->width; | |
4157 } | |
4158 | |
4159 } | |
4160 else | |
4161 { | |
4162 dspl_show_bitmap(x,y,current_bitmap,SHOWBITMAP_INVERT); | |
4163 x += current_bitmap->width; | |
4164 } | |
4165 txt++; | |
4166 } | |
4167 | |
4168 } | |
4169 | |
4170 | |
4171 | |
4172 /* | |
4173 +--------------------------------------------------------------------+ | |
4174 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4175 | STATE : code ROUTINE : scrText_Invert | | |
4176 +--------------------------------------------------------------------+ | |
4177 | |
4178 PURPOSE : draw text inverted | |
4179 | |
4180 */ | |
4181 | |
4182 void scrText_Invert (int x, int y, char *txt) | |
4183 { | |
4184 //Display inverted text | |
4185 dspl_ScrText (x,y, txt, TXT_STYLE_INVERT); | |
4186 } | |
4187 | |
4188 | |
4189 EXTERN UBYTE dspl_str_length(char * str) | |
4190 { | |
4191 UBYTE count=0; | |
4192 USHORT* current; | |
4193 | |
4194 if (dspl_get_char_type() == DSPL_TYPE_ASCII) | |
4195 return (strlen(str)); | |
4196 else | |
4197 { | |
4198 current = (USHORT*) str; | |
4199 while (*current) | |
4200 { | |
4201 count++; | |
4202 current++; | |
4203 } | |
4204 return count; | |
4205 } | |
4206 } | |
4207 | |
4208 | |
4209 | |
4210 /* | |
4211 +--------------------------------------------------------------------+ | |
4212 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4213 | STATE : code ROUTINE : scrLine | | |
4214 +--------------------------------------------------------------------+ | |
4215 | |
4216 PURPOSE : draw line | |
4217 | |
4218 */ | |
4219 | |
4220 void scrLine (int x1, int y1, int x2, int y2) | |
4221 { | |
4222 int x, y, dx, dy, c1, c2, err, swap = 0; | |
4223 U32 fCol; | |
4224 | |
4225 if (x1 < 0 || x1 >= scrX || x2 < 0 || x2 >= scrX || | |
4226 y1 < 0 || y1 >= scrY || y2 < 0 || y2 >= scrY) | |
4227 return; | |
4228 fCol = dspl_GetFgdColour(); | |
4229 dx = x2 - x1; dy = y2 - y1; | |
4230 if (((dx < 0) ? -dx : dx) < ((dy < 0) ? -dy : dy)) | |
4231 { | |
4232 swap = 1; /* take the long way */ | |
4233 x = x1; x1 = y1; y1 = x; | |
4234 x = x2; x2 = y2; y2 = x; | |
4235 } | |
4236 if (x1 > x2) | |
4237 { | |
4238 x = x1; x1 = x2; x2 = x; /* always move to the right */ | |
4239 y = y1; y1 = y2; y2 = y; | |
4240 } | |
4241 | |
4242 dx = x2 - x1; dy = y2 - y1; | |
4243 c1 = dy * 2; dy = 1; | |
4244 if (c1 < 0) | |
4245 { | |
4246 c1 = -c1; | |
4247 dy = -1; | |
4248 } | |
4249 err = c1 - dx; c2 = err - dx; | |
4250 x = x1; y = y1; | |
4251 while (x <= x2) | |
4252 { | |
4253 scrPoint(swap?y:x,swap?x:y,fCol); | |
4254 x++; | |
4255 if (err < 0) | |
4256 err += c1; | |
4257 else | |
4258 { | |
4259 y += dy; | |
4260 err += c2; | |
4261 } | |
4262 } | |
4263 | |
4264 if (internal) | |
4265 return; | |
4266 } | |
4267 | |
4268 | |
4269 /* | |
4270 +--------------------------------------------------------------------+ | |
4271 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4272 | STATE : code ROUTINE : scrRect | | |
4273 +--------------------------------------------------------------------+ | |
4274 | |
4275 PURPOSE : draw rectangle | |
4276 | |
4277 */ | |
4278 | |
4279 void scrRect (int px, int py, int sx, int sy) | |
4280 { | |
4281 internal = 1; | |
4282 scrLine(px,py,px+sx,py); | |
4283 scrLine(px,py+sy,px+sx,py+sy); | |
4284 scrLine(px,py,px,py+sy); | |
4285 internal = 0; | |
4286 scrLine(px+sx,py,px+sx,py+sy); | |
4287 } | |
4288 | |
4289 | |
4290 | |
4291 | |
4292 /* | |
4293 +--------------------------------------------------------------------+ | |
4294 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4295 | STATE : code ROUTINE : scrFntSelect | | |
4296 +--------------------------------------------------------------------+ | |
4297 | |
4298 PURPOSE : select the current font | |
4299 | |
4300 */ | |
4301 | |
4302 int scrFntSelect (int font) | |
4303 { | |
4304 return 1; /* always OK */ | |
4305 } | |
4306 | |
4307 | |
4308 /* | |
4309 +--------------------------------------------------------------------+ | |
4310 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4311 | STATE : code ROUTINE : scrFntHeight | | |
4312 +--------------------------------------------------------------------+ | |
4313 | |
4314 PURPOSE : get height of current font | |
4315 | |
4316 */ | |
4317 | |
4318 int scrFntHeight (void) | |
4319 { | |
4320 #ifdef LSCREEN | |
4321 return 16; | |
4322 #endif | |
4323 | |
4324 if (dspl_char_type == DSPL_TYPE_ASCII) | |
4325 return 8; | |
4326 else | |
4327 return 12; | |
4328 } | |
4329 | |
4330 | |
4331 | |
4332 //Really get information about | |
4333 // (1) how many chars we can have on a line | |
4334 // (2) how many pixels are in a string | |
4335 //GW SPR#1721 - Include a border in the calculations | |
4336 int scrGetRealLength(char *str, int* totChar, int* totPixel) | |
4337 { | |
4338 int nChar=0; | |
4339 int nPixel=0; | |
4340 int maxChar,maxPixel; | |
4341 t_font_bitmap* bmp; | |
4342 int strEnd; | |
4343 USHORT str16,str1,str2; | |
4344 UBYTE current_display_char_type = dspl_char_type;/*mc SPR 1319*/ | |
4345 int border; | |
4346 | |
4347 //Calculate extra pixels allowed for the border | |
4348 border = dspl_getBorderWidth(); | |
4349 | |
4350 if (*totChar<=0) //assume full str required. | |
4351 maxChar = 256; //stop after 256 chars | |
4352 else | |
4353 maxChar = *totChar; //stop after 256 chars | |
4354 if (*totPixel<=0)// assume no limit to len - limit at 2x screen | |
4355 maxPixel = 2*scrX; | |
4356 else | |
4357 maxPixel = *totPixel; | |
4358 strEnd = FALSE; | |
4359 /*MC SPR 1319, char type is unicode if unicode tag*/ | |
4360 if(str[0] == 0x80) | |
4361 { current_display_char_type = DSPL_TYPE_UNICODE; | |
4362 str+=2; /*ignore first char SPR 1442*/ | |
4363 nChar+=2;/*MC*/ | |
4364 } | |
4365 else /*SPR 1526, assume if no unicode tag, we're in ASCII*/ | |
4366 current_display_char_type = DSPL_TYPE_ASCII; | |
4367 /*MC 1526, end*/ | |
4368 while (!strEnd) | |
4369 { | |
4370 if (current_display_char_type == DSPL_TYPE_ASCII) | |
4371 { | |
4372 str16 = *str; | |
4373 str++; | |
4374 } | |
4375 else | |
4376 { | |
4377 str1 = *str; | |
4378 str++; | |
4379 str2 = *str; | |
4380 str++; | |
4381 str16 = ((str1 << 8) & 0xFF00) + (str2 & 0x00FF);/*MC, fixed bitmask 1319*/ | |
4382 | |
4383 } | |
4384 if (str16 == 0) | |
4385 { //reached end of string. | |
4386 strEnd = TRUE; | |
4387 bmp = NULL; | |
4388 } | |
4389 else | |
4390 bmp = get_bitmap(str16); | |
4391 if (bmp!= NULL) | |
4392 { | |
4393 if (nPixel +bmp->width < maxPixel) | |
4394 { | |
4395 nPixel = nPixel + bmp->width+border; | |
4396 if (current_display_char_type == DSPL_TYPE_ASCII) | |
4397 nChar++; | |
4398 else | |
4399 nChar+=2; | |
4400 if (nChar >= maxChar) | |
4401 strEnd = TRUE; | |
4402 } | |
4403 else | |
4404 strEnd=TRUE; | |
4405 } | |
4406 } | |
4407 *totChar = nChar; | |
4408 *totPixel = nPixel; | |
4409 | |
4410 return (nPixel); | |
4411 } | |
4412 | |
4413 | |
4414 | |
4415 | |
4416 /* | |
4417 +--------------------------------------------------------------------+ | |
4418 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4419 | STATE : code ROUTINE : scrFntGetFit | | |
4420 +--------------------------------------------------------------------+ | |
4421 | |
4422 PURPOSE : number of string chars that fit into the line | |
4423 | |
4424 */ | |
4425 | |
4426 | |
4427 int scrFntGetFit (char *tp, int lineWidth) | |
4428 { | |
4429 int totChar = 0; | |
4430 | |
4431 // scrGetRealLength(tp, &totChar, &lineWidth); | |
4432 // return (totChar); | |
4433 | |
4434 | |
4435 if (dspl_char_type == DSPL_TYPE_ASCII) | |
4436 return (lineWidth /6); | |
4437 else | |
4438 return (lineWidth / 12); | |
4439 } | |
4440 | |
4441 | |
4442 /* | |
4443 +--------------------------------------------------------------------+ | |
4444 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4445 | STATE : code ROUTINE : scrFntGetLen | | |
4446 +--------------------------------------------------------------------+ | |
4447 | |
4448 PURPOSE : number of pixel used by first n string chars | |
4449 | |
4450 */ | |
4451 | |
4452 | |
4453 | |
4454 | |
4455 int scrFntGetLen(char *tp, int nChars) | |
4456 { | |
4457 int lineWidth = 0; | |
4458 | |
4459 | |
4460 int count=0; | |
4461 | |
4462 if (dspl_char_type == DSPL_TYPE_ASCII) | |
4463 return (nChars * 6); | |
4464 else | |
4465 { | |
4466 USHORT* temp = (USHORT*)tp; | |
4467 | |
4468 while (*temp) | |
4469 { | |
4470 UBYTE first_byte = (UBYTE)(*temp); | |
4471 if (first_byte) | |
4472 count+=12; | |
4473 else | |
4474 count+=6; | |
4475 temp++; | |
4476 } | |
4477 return count; | |
4478 } | |
4479 } | |
4480 | |
4481 | |
4482 /* | |
4483 +--------------------------------------------------------------------+ | |
4484 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4485 | STATE : code ROUTINE : scrBmpDraw | | |
4486 +--------------------------------------------------------------------+ | |
4487 | |
4488 PURPOSE : draw bitmap | |
4489 | |
4490 */ | |
4491 | |
4492 int scrBmpDraw (int px, int py, int sx, int sy, | |
4493 int ix, char *bm, int mode) | |
4494 { | |
4495 int i, j; | |
4496 unsigned char m; | |
4497 | |
4498 if (px < 0 || px >= scrX || py < 0 || py >= scrY | |
4499 || sx < 0 || sy < 0) | |
4500 return 0; | |
4501 if (px + sx > scrX) | |
4502 sx = scrX - px; | |
4503 if (py + sy > scrY) | |
4504 sy = scrY - py; | |
4505 | |
4506 m = 0x80; | |
4507 bm += (sx * sy * ix) / 8; | |
4508 for (j = 0; j < sy; j++) | |
4509 { | |
4510 for (i = 0; i < sx; i++) | |
4511 { | |
4512 scrPoint(px+i,py+j,*bm & m); | |
4513 m >>= 1; | |
4514 if (!m) | |
4515 { | |
4516 m = 0x80; | |
4517 bm++; | |
4518 } | |
4519 } | |
4520 if (m != 0x80) | |
4521 { | |
4522 m = 0x80; | |
4523 bm++; | |
4524 } | |
4525 } | |
4526 | |
4527 return 0; | |
4528 } | |
4529 | |
4530 | |
4531 /* | |
4532 +--------------------------------------------------------------------+ | |
4533 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4534 | STATE : code ROUTINE : scrCurType | | |
4535 +--------------------------------------------------------------------+ | |
4536 | |
4537 PURPOSE : set cursor type (0 = no cursor) | |
4538 | |
4539 */ | |
4540 | |
4541 void scrCurType (int type) | |
4542 { | |
4543 } | |
4544 | |
4545 | |
4546 /* | |
4547 +--------------------------------------------------------------------+ | |
4548 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4549 | STATE : code ROUTINE : scrCursor | | |
4550 +--------------------------------------------------------------------+ | |
4551 | |
4552 PURPOSE : set cursor at specified position | |
4553 | |
4554 */ | |
4555 | |
4556 void scrCursor (int x, int y) | |
4557 { | |
4558 scrLine(x,y+7,x+5,y+7); | |
4559 } | |
4560 | |
4561 | |
4562 /* | |
4563 +--------------------------------------------------------------------+ | |
4564 | PROJECT : MMI-Framework (8417) MODULE : ti1_scr | | |
4565 | STATE : code ROUTINE : scrPoint | | |
4566 +--------------------------------------------------------------------+ | |
4567 | |
4568 PURPOSE : draw point | |
4569 | |
4570 */ | |
4571 | |
4572 //Return colour of pixel at point (px,py) or zero if not on screen. | |
4573 static int getScrPoint (int px, int py) | |
4574 { | |
4575 #ifdef BSAMPLE | |
4576 unsigned char m = 0x80; | |
4577 #endif //BSAMPLE | |
4578 #ifdef CSAMPLE | |
4579 U32 m2; | |
4580 #endif //CSAMPLE | |
4581 int x1,y1; | |
4582 int lWord; // index for colour word | |
4583 U32 opWord; //olour word | |
4584 U32 op_col; | |
4585 U32 picCol; | |
4586 | |
4587 if (px < 0 || py < 0 || px >= scrX || py >= scrY) | |
4588 return (0); | |
4589 | |
4590 #ifdef BSAMPLE | |
4591 m >>= px & 7; // mask | |
4592 px >>= 3; // x offset | |
4593 if (displayScr[py][px] & m) | |
4594 return (0x00FFFFFF); | |
4595 else | |
4596 return (0x00000000); | |
4597 | |
4598 #endif //BSAMPLE | |
4599 | |
4600 #ifdef CSAMPLE | |
4601 //Display plots data from Right to Left | |
4602 // - reverse x-coordinate | |
4603 //Also display seems to be 16 pixels down the screen - | |
4604 //plot points at y=(y-16) mod 64 | |
4605 x1 = (scrX-1)-px; | |
4606 y1 = (py+48) & 63; //(py-16) ; | |
4607 //Display is in columns for TI drivers | |
4608 m2 = 0x80000000; | |
4609 m2 = m2 >> (y1 & 31); //shift m2 by 0-31 | |
4610 y1 = y1 >> 5; // 32bits/word | |
4611 return (picture_bw[lWord] & m2); | |
4612 #endif //CSAMPLE | |
4613 | |
4614 #ifdef DSAMPLE_COLOUR | |
4615 //i/p colour is 32 bit - reduce to 16 | |
4616 x1 = px; | |
4617 y1 = py; | |
4618 lWord = y1*LCD_ROW_NUM_LWORDS + x1; | |
4619 //GW invert pic bits | |
4620 opWord = ~picture_col[lWord]; | |
4621 | |
4622 //Change from 16(8) bits to 32(24) bits | |
4623 #ifdef DSAMPLE_COLOUR32 | |
4624 opWord = opWord & 0x0000FFFF; | |
4625 #endif //DSAMPLE_COLOUR32 | |
4626 #ifdef DSAMPLE_COLOUR16 | |
4627 #ifdef PIXEL_0_IN_LSW | |
4628 if (lWord & 0x01) | |
4629 opWord = ((opWord >>16) & 0x0000FFFF); | |
4630 else | |
4631 opWord = ((opWord ) & 0x0000FFFF); | |
4632 #else | |
4633 if (lWord & 0x01) | |
4634 opWord = ((opWord ) & 0x0000FFFF); | |
4635 else | |
4636 opWord = ((opWord >>16) & 0x0000FFFF); | |
4637 #endif | |
4638 #endif //DSAMPLE_COLOUR16 | |
4639 return(DSPL_GET_PIXELCOLOUR(opWord)); | |
4640 #endif //DSAMPLE_COLOUR | |
4641 | |
4642 #ifdef DSAMPLE_LITE | |
4643 //i/p colour is 32 bit - reduce to 16 | |
4644 { | |
4645 int xmask; | |
4646 x1 = px; | |
4647 y1 = py; | |
4648 lWord = DSPL_GET_LWORD(x1,y1); //y1*LCD_ROW_NUM_LWORDS + x1 >> 5; | |
4649 xmask = 0x01 << (x1 & 0x1F); | |
4650 //GW invert pic bits | |
4651 if (picture_bw[lWord] & xmask) | |
4652 opWord = 0x00FFFFFF; | |
4653 else | |
4654 opWord = 0x00000000; | |
4655 //Change from 16(8) bits to 32(24) bits | |
4656 } | |
4657 return (opWord); | |
4658 #endif //DSAMPLE_LITE | |
4659 | |
4660 } | |
4661 | |
4662 | |
4663 static int checkPixelColour(int px, int py, U32 col) | |
4664 { | |
4665 U32 currCol; | |
4666 | |
4667 currCol = getScrPoint (px, py); | |
4668 if ((currCol & 0x00F8FCF8) == (col & 0x00F8FCF8))//16bit colour | |
4669 return (1); //colours match | |
4670 else | |
4671 return (0); //colours are different | |
4672 } | |
4673 | |
4674 unsigned int translucence(unsigned int ipCol,unsigned int picCol) | |
4675 { | |
4676 int trans1,trans2; | |
4677 U32 col_red1,col_green1,col_blue1; | |
4678 U32 col_red2,col_green2,col_blue2; | |
4679 U32 rmerge,gmerge,bmerge; | |
4680 U32 opCol; | |
4681 | |
4682 //0xFF=transparent (col=picCol) | |
4683 //0x00=solid (col=ipCol) | |
4684 trans1 = (ipCol >>24) & 0xFF; | |
4685 trans2 = 255-trans1; | |
4686 if (trans1 == 0x00) | |
4687 return (ipCol); | |
4688 else if (trans1 == 0xFF) | |
4689 return (picCol); | |
4690 | |
4691 //Read in colour from 24 bits | |
4692 col_red1 = (ipCol & 0x00FF0000) >> 8; | |
4693 col_green1 = (ipCol & 0x0000FF00) >> 8; | |
4694 col_blue1 = (ipCol & 0x000000FF); | |
4695 | |
4696 //Read in colour from 8 bits | |
4697 col_red2 = (picCol & 0x00FF0000) >> 8; | |
4698 col_green2 = (picCol & 0x0000FF00) >> 8; | |
4699 col_blue2 = (picCol & 0x000000FF); | |
4700 //red = 0x0000xx00, green = 0x000000xx, blue = 0x000000xx (256x higher than it should be) | |
4701 | |
4702 //Round values up | |
4703 // rmerge = (col_red1 *trans1+col_red2 *trans2+0x0FFFF) & 0x00FF0000; | |
4704 // gmerge = (col_green1*trans1+col_green2*trans2+0x000FF) & 0x0000FF00; | |
4705 // bmerge =((col_blue1 *trans1+col_blue2 *trans2+0x000FF) >> 8)& 0x000000FF; | |
4706 rmerge = (col_red1 *trans2+col_red2 *trans1+0x1F0000) & 0x00FF0000; | |
4707 gmerge = (col_green1*trans2+col_green2*trans1+0x001000) & 0x0000FF00; | |
4708 bmerge =((col_blue1 *trans2+col_blue2 *trans1+0x001000) >> 8)& 0x000000FF; | |
4709 | |
4710 opCol = rmerge|gmerge|bmerge; | |
4711 return (opCol); | |
4712 } | |
4713 | |
4714 | |
4715 #ifdef BSAMPLE | |
4716 static void scrPoint (int px, int py, int col) | |
4717 { | |
4718 unsigned char m = 0x80; | |
4719 | |
4720 //GW Do not plot if outside of the defined window | |
4721 if (px < win_x1 || py < win_y1 || px >= win_x2 || py >= win_y2) | |
4722 return; | |
4723 | |
4724 m >>= px & 7; // mask | |
4725 px >>= 3; // x offset | |
4726 | |
4727 if (col) | |
4728 displayScr[py][px] |= m; | |
4729 else | |
4730 displayScr[py][px] &= (UBYTE) ~m; | |
4731 } | |
4732 #endif //BSAMPLE | |
4733 | |
4734 #ifdef CSAMPLE | |
4735 static void scrPoint (int px, int py, int col) | |
4736 { | |
4737 U32 m2; | |
4738 int x1,y1; | |
4739 int lWord; // index for colour word | |
4740 if (px < win_x1 || py < win_y1 || px >= win_x2 || py >= win_y2) | |
4741 return; | |
4742 //Display plots data from Right to Left | |
4743 // - reverse x-coordinate | |
4744 //Also display seems to be 16 pixels down the screen - | |
4745 //plot points at y=(y-16) mod 64 | |
4746 x1 = (scrX-1)-px; | |
4747 y1 = (py+48) & 63; //(py-16) ; | |
4748 //Display is in columns for TI drivers | |
4749 m2 = 0x80000000; | |
4750 m2 = m2 >> (y1 & 31); //shift m2 by 0-31 | |
4751 y1 = y1 >> 5; // 32bits/word | |
4752 lWord = x1*LCD_COL_NUM_LWORDS+y1; | |
4753 if (col) | |
4754 picture_bw[lWord] |= m2; | |
4755 else | |
4756 picture_bw[lWord] &= (U32)(~m2); | |
4757 } | |
4758 #endif //CSAMPLE | |
4759 | |
4760 #ifdef DSAMPLE_COLOUR | |
4761 void scrPoint (int px, int py, int col) | |
4762 { | |
4763 int lWord; // index for colour word | |
4764 U32 bitCol; | |
4765 //i/p colour is 32 bit | |
4766 if (px < win_x1 || py < win_y1 || px >= win_x2 || py >= win_y2) | |
4767 return; | |
4768 lWord = DSPL_GET_LWORD(px,py); | |
4769 bitCol = DSPL_GET_BITCOLOUR(col); | |
4770 | |
4771 DSPL_SET_BITCOLOUR(px,lWord,bitCol,"plot"); | |
4772 } | |
4773 #endif //DSAMPLE_COLOUR | |
4774 | |
4775 #ifdef DSAMPLE_LITE | |
4776 void scrPoint (int px, int py, int col) | |
4777 { | |
4778 int m_px; | |
4779 int word ; | |
4780 //i/p colour is 32 bit | |
4781 if (px < win_x1 || py < win_y1 || px >= win_x2 || py >= win_y2) | |
4782 return; | |
4783 | |
4784 m_px = 1 << (px & 0x1F); | |
4785 word = DSPL_GET_LWORD(px,py); | |
4786 if (col) | |
4787 picture_bw[word] = picture_bw[word] | m_px; | |
4788 else | |
4789 picture_bw[word] = picture_bw[word] & (~m_px); | |
4790 } | |
4791 #endif //DSAMPLE_LITE | |
4792 | |
4793 | |
4794 | |
4795 /******************************************************************* | |
4796 * * | |
4797 * PART III: LCD Simulation for Windows * | |
4798 * * | |
4799 *******************************************************************/ | |
4800 #if defined (WIN32) | |
4801 | |
4802 #define LCDE_COL 20 | |
4803 #define LCDE_ROW 4 | |
4804 static int screensize_x = 16; | |
4805 static int screensize_y = 4; | |
4806 | |
4807 #define NULL_TERM '\0' /* string termination */ | |
4808 | |
4809 static CHAR lcd_screen [LCDE_ROW+2][LCDE_COL+3]; | |
4810 static CHAR cursor_line[LCDE_COL+3]; | |
4811 | |
4812 static int lcd_cursX, lcd_cursY, lcd_enabled = FALSE; | |
4813 | |
4814 LOCAL void LCD_Refresh (void) | |
4815 { | |
4816 int i; | |
4817 CHAR buf[100]; | |
4818 | |
4819 for (i=0; i<screensize_y+2; i++) | |
4820 { | |
4821 sprintf (buf, "~LCD~%s", &lcd_screen[i][0]); | |
4822 #if defined NEW_FRAME | |
4823 vsi_o_ttrace (0, 0xffff, buf); | |
4824 #else | |
4825 #endif | |
4826 if (lcd_cursY+1 EQ i) | |
4827 { | |
4828 cursor_line[lcd_cursX+1] = '^'; | |
4829 sprintf (buf, "~LCD~%s", cursor_line); | |
4830 #if defined NEW_FRAME | |
4831 vsi_o_ttrace (0, 0xffff, buf); | |
4832 #else | |
4833 #endif | |
4834 cursor_line[lcd_cursX+1] = ' '; | |
4835 } | |
4836 else | |
4837 { | |
4838 if (i < screensize_y+1) | |
4839 { | |
4840 sprintf (buf, "~LCD~%s", cursor_line); | |
4841 #if defined NEW_FRAME | |
4842 vsi_o_ttrace (0, 0xffff, buf); | |
4843 #else | |
4844 #endif | |
4845 } | |
4846 } | |
4847 } | |
4848 } | |
4849 | |
4850 GLOBAL void LCD_Enable (int on) | |
4851 { | |
4852 lcd_enabled = (on EQ 1); | |
4853 } | |
4854 | |
4855 GLOBAL void LCD_Clear (void) | |
4856 { | |
4857 int r, c; | |
4858 | |
4859 if (lcd_enabled) | |
4860 { | |
4861 lcd_cursX = lcd_cursY = 0; | |
4862 | |
4863 for (r=1; r<screensize_y+1; r++) | |
4864 for (c=1; c<screensize_x+1; c++) | |
4865 lcd_screen[r][c] = ' '; | |
4866 | |
4867 LCD_Refresh (); | |
4868 } | |
4869 } | |
4870 | |
4871 GLOBAL void LCD_Reset (void) | |
4872 { | |
4873 int r, c, i; | |
4874 | |
4875 memset (cursor_line, ' ', screensize_x+3); | |
4876 cursor_line[0] = cursor_line[screensize_x+1] = '|'; | |
4877 cursor_line[screensize_x+2] = NULL_TERM; | |
4878 | |
4879 for (r=1; r < screensize_y+1; r++) | |
4880 { | |
4881 lcd_screen[r][0] = '|'; | |
4882 lcd_screen[r][screensize_x+1] = '|'; | |
4883 } | |
4884 for (c=1; c < screensize_x+1; c++) | |
4885 { | |
4886 lcd_screen[0][c] = '-'; | |
4887 lcd_screen[screensize_y+1][c] = '-'; | |
4888 } | |
4889 | |
4890 lcd_screen[0][0] = '+'; | |
4891 lcd_screen[screensize_y+1][0] = '+'; | |
4892 lcd_screen[0][screensize_x+1] = '+'; | |
4893 lcd_screen[screensize_y+1][screensize_x+1] = '+'; | |
4894 | |
4895 for (i=0; i<screensize_y+2; i++) | |
4896 lcd_screen [i][screensize_x+2] = NULL_TERM; | |
4897 | |
4898 lcd_enabled = TRUE; | |
4899 | |
4900 LCD_Clear (); | |
4901 | |
4902 lcd_enabled = FALSE; | |
4903 } | |
4904 | |
4905 GLOBAL void LCD_WriteString (int row, int col, CHAR *s) | |
4906 { | |
4907 if (s == NULL) | |
4908 { | |
4909 TRACE_EVENT("LCD_WriteString got NULL Pointer as Text"); | |
4910 return; | |
4911 } | |
4912 if (lcd_enabled) | |
4913 { | |
4914 int len = strlen (s); | |
4915 | |
4916 if (row < screensize_y AND col < screensize_x) | |
4917 { | |
4918 if ((col + len) > screensize_x) | |
4919 { | |
4920 /* clip the string */ | |
4921 s[(len = screensize_x-col)] = NULL_TERM; | |
4922 } | |
4923 memcpy (&lcd_screen[row+1][col+1], s, len); | |
4924 LCD_Refresh (); | |
4925 } | |
4926 } | |
4927 } | |
4928 | |
4929 GLOBAL void LCD_Cursor (int row, int col) | |
4930 { | |
4931 if (lcd_enabled) | |
4932 { | |
4933 if (row < screensize_y AND col < screensize_x) | |
4934 { | |
4935 lcd_cursY = row; | |
4936 lcd_cursX = col; | |
4937 LCD_Refresh (); | |
4938 } | |
4939 } | |
4940 } | |
4941 | |
4942 GLOBAL void LCD_SetPower (void) | |
4943 { | |
4944 } | |
4945 | |
4946 GLOBAL void LCD_PixBlt (int x, int y, int w, int h, char *bmp) | |
4947 { | |
4948 } | |
4949 | |
4950 /* | |
4951 * Stimulation of the lcd driver | |
4952 */ | |
4953 GLOBAL void lcd_test (UBYTE mode) | |
4954 { | |
4955 TRACE_EVENT ("Display Redirection activated"); | |
4956 mtkEnabled = mode; | |
4957 scrInit(); | |
4958 if (mtkEnabled EQ 2) | |
4959 { | |
4960 scrY = 64; | |
4961 } | |
4962 } | |
4963 #endif /* WIN32 */ | |
4964 | |
4965 | |
4966 #endif /* MMI != 0 */ |