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