| 1 | |
|---|
| 2 | #include "DHL_OSAL.h" |
|---|
| 3 | |
|---|
| 4 | #include "cc_config.h" |
|---|
| 5 | #include "cc_type.h" |
|---|
| 6 | #include "cc_def.h" |
|---|
| 7 | #include "cc_private.h" |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | #define MAX_NUM_PIC_UD_Q 32 |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #define IS_FONT_JUNGLE (FONT_ID==FONT_JUNGLE) |
|---|
| 14 | #define IS_FONT_MLF (FONT_ID==FONT_MLF) |
|---|
| 15 | |
|---|
| 16 | static tDCC_PicUDRaw p_ud_buf[MAX_NUM_PIC_UD_Q]; |
|---|
| 17 | |
|---|
| 18 | static tDCCDDI_MSGQ p_ud_msgq; |
|---|
| 19 | static int p_ud_buf_wr_idx=0; |
|---|
| 20 | static tDCC_UserCallback p_ud_callback; |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | //driver |
|---|
| 24 | #include "dst_config.h" |
|---|
| 25 | |
|---|
| 26 | #include "api_gfxosd.h" |
|---|
| 27 | #include "vdec_usrd.h" |
|---|
| 28 | #include "vdp_isr.h" |
|---|
| 29 | |
|---|
| 30 | #include "GRP_Service.h" |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | extern UINT32 GetHdrVH6(); |
|---|
| 34 | extern UINT32 GetHdrVH7(); |
|---|
| 35 | extern void vdp_InsertLine21Data(UINT8 data1, UINT8 data2, UINT8 field); |
|---|
| 36 | extern void VDP_RegisterNotify(VDP_NOTIFY_SRC notifySrc, VDP_NOTIFY_FN_T *pNotifyFn); |
|---|
| 37 | extern void VDP_SetNotify(VDP_NOTIFY_SRC notifySrc, UINT32 onOff); |
|---|
| 38 | |
|---|
| 39 | #if IS_FONT_JUNGLE |
|---|
| 40 | #include "utfAPI.h" |
|---|
| 41 | #elif IS_FONT_MLF |
|---|
| 42 | #include "MLSupport.h" |
|---|
| 43 | #endif |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | #if 0 |
|---|
| 49 | __Local_Func__() {} |
|---|
| 50 | #endif |
|---|
| 51 | |
|---|
| 52 | static UINT16 p_remap_char(UINT16 ch) |
|---|
| 53 | { |
|---|
| 54 | UINT16 ret; |
|---|
| 55 | |
|---|
| 56 | switch(ch) { |
|---|
| 57 | case 0x121: |
|---|
| 58 | case 0x120: |
|---|
| 59 | ret=0x120; break; |
|---|
| 60 | |
|---|
| 61 | case 0x125: |
|---|
| 62 | case 0x12a: |
|---|
| 63 | case 0x12c: |
|---|
| 64 | case 0x130: |
|---|
| 65 | case 0x131: |
|---|
| 66 | case 0x132: |
|---|
| 67 | case 0x133: |
|---|
| 68 | case 0x134: |
|---|
| 69 | case 0x135: |
|---|
| 70 | case 0x139: |
|---|
| 71 | case 0x13a: |
|---|
| 72 | case 0x13c: |
|---|
| 73 | case 0x13d: |
|---|
| 74 | case 0x13f: |
|---|
| 75 | case 0x176: |
|---|
| 76 | case 0x177: |
|---|
| 77 | case 0x178: |
|---|
| 78 | case 0x179: |
|---|
| 79 | case 0x17a: |
|---|
| 80 | case 0x17b: |
|---|
| 81 | case 0x17c: |
|---|
| 82 | case 0x17d: |
|---|
| 83 | case 0x17e: |
|---|
| 84 | case 0x17f: |
|---|
| 85 | case 0x1a0: |
|---|
| 86 | ret=ch; break; |
|---|
| 87 | |
|---|
| 88 | default: |
|---|
| 89 | ret=0x20; |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | return ret; |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | #if 0 |
|---|
| 97 | __Common__() {} |
|---|
| 98 | #endif |
|---|
| 99 | |
|---|
| 100 | #define OS_TICK2MS(tick) (tick*(1000/OS_GetTicksPerSecond())) |
|---|
| 101 | #define OS_MS2TICK(ms) (ms*OS_GetTicksPerSecond()/1000) |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | void *DCCDDI_Malloc(int size) |
|---|
| 105 | { |
|---|
| 106 | return malloc(size); |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | void DCCDDI_Printf(const char *fmt, ...) |
|---|
| 111 | { |
|---|
| 112 | char buf[512]; |
|---|
| 113 | va_list v; |
|---|
| 114 | |
|---|
| 115 | va_start(v, fmt); |
|---|
| 116 | |
|---|
| 117 | vsnprintf(buf, 512, fmt, v); |
|---|
| 118 | |
|---|
| 119 | va_end(v); |
|---|
| 120 | |
|---|
| 121 | printf("%s", buf); |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | void DCCDDI_SpawnTask(void *func) |
|---|
| 125 | { |
|---|
| 126 | OS_SpawnTask((OS_TASKFUNCTION)func, "CC", TASK_PRI_DCC_DMX, 16384, 0); |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | tDCCDDI_MSGQ DCCDDI_CreateMessageQueue(char *pname, UINT32 num_msgq, UINT32 size_msgq) |
|---|
| 131 | { |
|---|
| 132 | return (tDCCDDI_MSGQ)OS_CreateMessageQueue(pname, 0, num_msgq, size_msgq); |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | tDCCDDI_SEM DCCDDI_CreateMutexSemaphore(char *pname) |
|---|
| 137 | { |
|---|
| 138 | return (tDCCDDI_SEM)OS_CreateMutexSemaphore(pname); |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | tDCCDDI_SEM DCCDDI_CreateBinarySemaphore(char *pname) |
|---|
| 143 | { |
|---|
| 144 | return (tDCCDDI_SEM)OS_CreateBinarySemaphore(pname, 0, 0); |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | void DCCDDI_SendMessage(tDCCDDI_MSGQ id, void *buf, UINT32 len) |
|---|
| 149 | { |
|---|
| 150 | OS_SendMessage((OS_MESSAGEQUEUE_ID)id, buf, len); |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | int DCCDDI_ReceiveMessage(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len) |
|---|
| 155 | { |
|---|
| 156 | return OS_ReceiveMessage((OS_MESSAGEQUEUE_ID)id, buf, max_len, rcv_len); |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | int DCCDDI_ReceiveMessage_Wait(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len, UINT32 msec) |
|---|
| 161 | { |
|---|
| 162 | return OS_ReceiveMessage_Wait((OS_MESSAGEQUEUE_ID)id, buf, max_len, rcv_len, OS_MS2TICK(msec)); |
|---|
| 163 | } |
|---|
| 164 | |
|---|
| 165 | int DCCDDI_ReceiveMessage_NoWait(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len) |
|---|
| 166 | { |
|---|
| 167 | return OS_ReceiveMessage_NoWait((OS_MESSAGEQUEUE_ID)id, buf, max_len, rcv_len); |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | void DCCDDI_TakeSemaphore(tDCCDDI_SEM id) |
|---|
| 172 | { |
|---|
| 173 | OS_TakeSemaphore((DHL_OS_SEMA_ID)id); |
|---|
| 174 | } |
|---|
| 175 | |
|---|
| 176 | void DCCDDI_GiveSemaphore(tDCCDDI_SEM id) |
|---|
| 177 | { |
|---|
| 178 | OS_GiveSemaphore((DHL_OS_SEMA_ID)id); |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | void DCCDDI_Delay(UINT32 msec) |
|---|
| 182 | { |
|---|
| 183 | OS_Delay(OS_MS2TICK(msec)); |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | UINT32 DCCDDI_GetCurMs() |
|---|
| 187 | { |
|---|
| 188 | return OS_TICK2MS(OS_GetTickCount()); |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | #if 0 |
|---|
| 193 | __Picture_User_Data__() {} |
|---|
| 194 | #endif |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | void DCCDDI_SetUserCallback(tDCC_UserCallback func) |
|---|
| 198 | { |
|---|
| 199 | p_ud_callback=func; |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | tDCC_PicUDRaw *DCCDDI_GetUserData() |
|---|
| 204 | { |
|---|
| 205 | int err; |
|---|
| 206 | int rcv_len; |
|---|
| 207 | int idx; |
|---|
| 208 | |
|---|
| 209 | err=DCCDDI_ReceiveMessage_Wait(p_ud_msgq, &idx, sizeof(idx), &rcv_len, 10); |
|---|
| 210 | |
|---|
| 211 | if(err) return NULL; |
|---|
| 212 | |
|---|
| 213 | return &p_ud_buf[idx]; |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | static void p_user_data(UINT8 *pdata, UINT8 size, void *ct) |
|---|
| 218 | { |
|---|
| 219 | UINT32 VH6; |
|---|
| 220 | |
|---|
| 221 | if(size<11) return;//ÃÖ´ë 11byteº¸´Ù Å©°Å³ª °°¾Æ¾ß Àǹ̰¡ ÀÖÀ½. |
|---|
| 222 | |
|---|
| 223 | memcpy(p_ud_buf[p_ud_buf_wr_idx].data, pdata, size); |
|---|
| 224 | p_ud_buf[p_ud_buf_wr_idx].size=size; |
|---|
| 225 | |
|---|
| 226 | VH6 = GetHdrVH6(); |
|---|
| 227 | p_ud_buf[p_ud_buf_wr_idx].pic_type=VH6&0x3; |
|---|
| 228 | |
|---|
| 229 | if(p_ud_callback) p_ud_callback(&p_ud_buf[p_ud_buf_wr_idx]); |
|---|
| 230 | |
|---|
| 231 | if(++p_ud_buf_wr_idx>=MAX_NUM_PIC_UD_Q) p_ud_buf_wr_idx=0; |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | #if 0 |
|---|
| 237 | __608_feeding__() {} |
|---|
| 238 | #endif |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | int DCCDDI_Feeding608(BOOL is_even, UINT8 data1, UINT8 data2) |
|---|
| 244 | { |
|---|
| 245 | |
|---|
| 246 | return 0; |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | #if 0 |
|---|
| 250 | __Graphic__() {} |
|---|
| 251 | #endif |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | void DCCDDI_GraphicStart(UINT8 resolution) |
|---|
| 256 | { |
|---|
| 257 | API_GFXOSD_ChangeResolution(FALSE); |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| 260 | void DCCDDI_GraphicStop() |
|---|
| 261 | { |
|---|
| 262 | API_GFXOSD_ChangeResolution(TRUE); |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | void DCCDDI_DrawBox(int x, int y, int w, int h, int color) |
|---|
| 266 | { |
|---|
| 267 | CCPRINT("ddi", "DCCDDI_DrawBox(%d,%d,%d,%d,%d)\n", x, y, w, h, color); |
|---|
| 268 | |
|---|
| 269 | if(w<=0 || h<=0) return; |
|---|
| 270 | |
|---|
| 271 | API_GFXOSD_FillRect(0, 0, x, y, w, h, color); |
|---|
| 272 | } |
|---|
| 273 | |
|---|
| 274 | //height°¡ -À̸é up, +À̸é down |
|---|
| 275 | void DCCDDI_BLT(int x, int y, int w, int h, int height) |
|---|
| 276 | { |
|---|
| 277 | CCPRINT("ddi", "DCCDDI_BLT(%d,%d,%d,%d,%d)\n", x, y, w, h, height); |
|---|
| 278 | |
|---|
| 279 | if(height==0 || h==0) return; |
|---|
| 280 | |
|---|
| 281 | if(height<0) |
|---|
| 282 | API_GFXOSD_OSDBlit(0, 0, 0, x, y, x, y+height, w, h, 0); |
|---|
| 283 | else { |
|---|
| 284 | API_GFXOSD_OSDBlit(0, 0, 1, x, y, x, y+height, w, h, 0); |
|---|
| 285 | API_GFXOSD_OSDBlit(0, 1, 0, x, y+height, x, y+height, w, h, 0); |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | void DCCDDI_DrawHLine(int x, int y, int w, int color) |
|---|
| 291 | { |
|---|
| 292 | if(w<=0) return; |
|---|
| 293 | |
|---|
| 294 | API_GFXOSD_DrawHLine(0, 0, x, y, w, color); |
|---|
| 295 | |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | void DCCDDI_Refresh() |
|---|
| 300 | { |
|---|
| 301 | |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | |
|---|
| 305 | #if 0 |
|---|
| 306 | __Font__() {} |
|---|
| 307 | #endif |
|---|
| 308 | |
|---|
| 309 | #define USE_MARGINE 0 |
|---|
| 310 | |
|---|
| 311 | #if IS_FONT_JUNGLE |
|---|
| 312 | static UT_FC p_reg_fc; |
|---|
| 313 | #elif IS_FONT_MLF |
|---|
| 314 | static RML_FC p_reg_fc; |
|---|
| 315 | #endif |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | static struct { |
|---|
| 319 | int size; |
|---|
| 320 | BOOL is_italic; |
|---|
| 321 | BOOL is_underline; |
|---|
| 322 | BOOL is_unicode; //2byte. ÇѱÛÀÎ °æ¿ì unicode/¿Ï¼ºÇü Áß ¾î´À °ÍÀÎÁö.. |
|---|
| 323 | BOOL is_p16; |
|---|
| 324 | int font_style; |
|---|
| 325 | int edge_type; |
|---|
| 326 | } p_font_attr; |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | #define USE_FONT_CACHE 0 |
|---|
| 330 | //font cache¸¦ »ç¿ëÇÔ. |
|---|
| 331 | |
|---|
| 332 | #define CH_BLANK 0x20 |
|---|
| 333 | #define MAX_CH_W (p_font_attr.size*8/10) |
|---|
| 334 | //neverdai analog cc¿¡¸¸ »ç¿ëÇÔ. |
|---|
| 335 | |
|---|
| 336 | #if IS_FONT_JUNGLE |
|---|
| 337 | |
|---|
| 338 | |
|---|
| 339 | #if USE_FONT_CACHE |
|---|
| 340 | |
|---|
| 341 | #define IMG_CACHE_SIZE 128 |
|---|
| 342 | |
|---|
| 343 | static struct { |
|---|
| 344 | UINT16 ch; |
|---|
| 345 | |
|---|
| 346 | SINT8 x; |
|---|
| 347 | SINT8 y; |
|---|
| 348 | SINT8 w; |
|---|
| 349 | SINT8 h; |
|---|
| 350 | SINT8 pitch; |
|---|
| 351 | |
|---|
| 352 | UINT8 buf[512]; //ÃÖ´ë 45»çÀÌÁî ±ÛÀÚ±îÁö ÀúÀåÇÒ ¼ö ÀÖÀ½. |
|---|
| 353 | } p_ut_img_cache[IMG_CACHE_SIZE];//¾à 6.5K Á¤µµ |
|---|
| 354 | |
|---|
| 355 | static int p_cache_idx; |
|---|
| 356 | |
|---|
| 357 | #endif // USE_FONT_CACHE |
|---|
| 358 | |
|---|
| 359 | #endif /* IS_FONT_JUNGLE */ |
|---|
| 360 | |
|---|
| 361 | |
|---|
| 362 | |
|---|
| 363 | |
|---|
| 364 | //widthÀÇ °ªÀÌ 0À̸é --> prop, 0º¸´Ù Å©¸é --> mono |
|---|
| 365 | int DCCDDI_PrintCh(int x, int y, UINT16 ch, int c_font, int c_edge) |
|---|
| 366 | { |
|---|
| 367 | int x_margin; |
|---|
| 368 | |
|---|
| 369 | CCPRINT("ddi_ch", "DCCDDI_PrintCh(0x%x:%c)\n", ch, ch); |
|---|
| 370 | |
|---|
| 371 | #if IS_FONT_JUNGLE |
|---|
| 372 | |
|---|
| 373 | #if USE_FONT_CACHE |
|---|
| 374 | for(i=0; i<IMG_CACHE_SIZE; i++) { |
|---|
| 375 | if(p_ut_img_cache[i].ch==ch) { |
|---|
| 376 | |
|---|
| 377 | x_margin=MAX_CH_W*1/10; //sizeÀÇ 1/10ÀÌ margingÀÌ µÊ |
|---|
| 378 | |
|---|
| 379 | if(p_ut_img_cache[i].pitch>0 && p_ut_img_cache[i].h>0) { |
|---|
| 380 | API_GFXOSD_Text2BPP(0, 0, |
|---|
| 381 | x+p_ut_img_cache[i].x+x_margin, y+p_font_attr.size-p_ut_img_cache[i].y-p_ut_img_cache[i].h, |
|---|
| 382 | p_ut_img_cache[i].pitch*4, p_ut_img_cache[i].h, p_ut_img_cache[i].buf, c_font, 0, c_edge, c_edge); |
|---|
| 383 | } |
|---|
| 384 | |
|---|
| 385 | return p_ut_img_cache[i].x+p_ut_img_cache[i].w+x_margin*2; |
|---|
| 386 | } |
|---|
| 387 | } |
|---|
| 388 | #endif /* USE_FONT_CACHE */ |
|---|
| 389 | |
|---|
| 390 | #endif /* IS_FONT_JUNGLE */ |
|---|
| 391 | |
|---|
| 392 | if(1) { |
|---|
| 393 | int i, j; |
|---|
| 394 | int pitch; |
|---|
| 395 | UINT8 tempBuf[512]; |
|---|
| 396 | UINT8 *p; |
|---|
| 397 | #if IS_FONT_JUNGLE |
|---|
| 398 | UT_IMAGE image; |
|---|
| 399 | #elif IS_FONT_MLF |
|---|
| 400 | RML_IMAGE image; |
|---|
| 401 | #endif |
|---|
| 402 | |
|---|
| 403 | if(!p_font_attr.is_unicode) { |
|---|
| 404 | //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ. |
|---|
| 405 | ch=DCCUtil_Ksx1001toUnicode(ch); |
|---|
| 406 | CCPRINT("ddi_ch2", "convert to ksx1001(0x%x)\n", ch); |
|---|
| 407 | } |
|---|
| 408 | |
|---|
| 409 | //ch=p_remap_char(ch); |
|---|
| 410 | |
|---|
| 411 | #if IS_FONT_JUNGLE |
|---|
| 412 | ut_GetCharImage(&p_reg_fc, ch, &image); |
|---|
| 413 | if(image.type == _UT_IMAGE_TYPE_NULL_GLYPH) |
|---|
| 414 | ut_GetCharImage(&p_reg_fc, CH_BLANK, &image); |
|---|
| 415 | #elif IS_FONT_MLF |
|---|
| 416 | RML_GetCharImage(&p_reg_fc, ch, &image); |
|---|
| 417 | if(image.type == RML_IMAGE_TYPE_NULL_GLYPH) |
|---|
| 418 | RML_GetCharImage(&p_reg_fc, CH_BLANK, &image); |
|---|
| 419 | #endif |
|---|
| 420 | memset(tempBuf, 0, sizeof(tempBuf)); |
|---|
| 421 | |
|---|
| 422 | pitch=image.bSize/4; |
|---|
| 423 | if(image.bSize%4) pitch++; |
|---|
| 424 | |
|---|
| 425 | for(j=0, p=image.data; j<image.bbox.sy; j++, p+=image.bSize) { |
|---|
| 426 | for(i=0; i<image.bbox.sx; i++) { |
|---|
| 427 | if(p[i]==64 || p[i]==1) tempBuf[(image.bbox.sy-1-j)*pitch+i/4] |= (0x3<<(6-(i%4)*2)); |
|---|
| 428 | else if(p[i]) tempBuf[(image.bbox.sy-1-j)*pitch+i/4] |= (0x1<<(6-(i%4)*2)); |
|---|
| 429 | } |
|---|
| 430 | } |
|---|
| 431 | |
|---|
| 432 | #if USE_MARGINE |
|---|
| 433 | x_margin=MAX_CH_W*1/10; //sizeÀÇ 1/10ÀÌ margingÀÌ µÊ |
|---|
| 434 | #else |
|---|
| 435 | x_margin=0; |
|---|
| 436 | #endif |
|---|
| 437 | |
|---|
| 438 | if(image.bbox.sx>0 && image.bbox.sy>0) { |
|---|
| 439 | API_GFXOSD_Text2BPP(0, 0, |
|---|
| 440 | x+image.bbox.ox+x_margin, y+p_font_attr.size-image.bbox.oy-image.bbox.sy, |
|---|
| 441 | pitch*4, image.bbox.sy, tempBuf, c_font, 0, c_edge, c_edge); |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | #if IS_FONT_JUNGLE |
|---|
| 446 | #if USE_FONT_CACHE |
|---|
| 447 | //backup. |
|---|
| 448 | p_ut_img_cache[p_cache_idx].ch=ch; |
|---|
| 449 | p_ut_img_cache[p_cache_idx].x=image.bbox.ox; |
|---|
| 450 | p_ut_img_cache[p_cache_idx].y=image.bbox.oy; |
|---|
| 451 | p_ut_img_cache[p_cache_idx].w=image.width; |
|---|
| 452 | p_ut_img_cache[p_cache_idx].h=image.bbox.sy; |
|---|
| 453 | p_ut_img_cache[p_cache_idx].pitch=pitch; |
|---|
| 454 | memcpy(p_ut_img_cache[p_cache_idx].buf, tempBuf, 512); |
|---|
| 455 | |
|---|
| 456 | if(++p_cache_idx>=IMG_CACHE_SIZE) p_cache_idx=0; |
|---|
| 457 | #endif |
|---|
| 458 | #endif /* USE_FONT_JUNGLE */ |
|---|
| 459 | |
|---|
| 460 | return image.bbox.ox+image.width+x_margin*2; |
|---|
| 461 | } |
|---|
| 462 | return 0; |
|---|
| 463 | } |
|---|
| 464 | |
|---|
| 465 | int DCCDDI_GetChWidth(UINT16 ch) |
|---|
| 466 | { |
|---|
| 467 | #if IS_FONT_JUNGLE |
|---|
| 468 | UT_IMAGE image; |
|---|
| 469 | #elif IS_FONT_MLF |
|---|
| 470 | RML_IMAGE image; |
|---|
| 471 | #endif |
|---|
| 472 | |
|---|
| 473 | if(!p_font_attr.is_unicode) { |
|---|
| 474 | //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ. |
|---|
| 475 | ch=DCCUtil_Ksx1001toUnicode(ch); |
|---|
| 476 | CCPRINT("ddi_ch2", "convert to ksx1001(0x%x)\n", ch); |
|---|
| 477 | } |
|---|
| 478 | |
|---|
| 479 | #if IS_FONT_JUNGLE |
|---|
| 480 | ut_GetCharImage(&p_reg_fc, ch, &image); |
|---|
| 481 | if(image.type == _UT_IMAGE_TYPE_NULL_GLYPH) |
|---|
| 482 | ut_GetCharImage(&p_reg_fc, CH_BLANK, &image); |
|---|
| 483 | #elif IS_FONT_MLF |
|---|
| 484 | RML_GetCharImage(&p_reg_fc, ch, &image); |
|---|
| 485 | if(image.type == RML_IMAGE_TYPE_NULL_GLYPH) |
|---|
| 486 | RML_GetCharImage(&p_reg_fc, CH_BLANK, &image); |
|---|
| 487 | #endif |
|---|
| 488 | |
|---|
| 489 | #if USE_MARGINE |
|---|
| 490 | return image.bbox.ox+image.width+(MAX_CH_W*1/10)*2; |
|---|
| 491 | #else |
|---|
| 492 | return image.bbox.ox+image.width; |
|---|
| 493 | #endif |
|---|
| 494 | } |
|---|
| 495 | |
|---|
| 496 | |
|---|
| 497 | int DCCDDI_GetChHeight(UINT16 ch) |
|---|
| 498 | { |
|---|
| 499 | #if IS_FONT_JUNGLE |
|---|
| 500 | UT_IMAGE image; |
|---|
| 501 | #elif IS_FONT_MLF |
|---|
| 502 | RML_IMAGE image; |
|---|
| 503 | #endif |
|---|
| 504 | |
|---|
| 505 | if(!p_font_attr.is_unicode) { |
|---|
| 506 | //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ. |
|---|
| 507 | ch=DCCUtil_Ksx1001toUnicode(ch); |
|---|
| 508 | CCPRINT("ddi_ch2", "%s : convert to ksx1001(0x%x)\n", __FUNCTION__, ch); |
|---|
| 509 | } |
|---|
| 510 | |
|---|
| 511 | #if IS_FONT_JUNGLE |
|---|
| 512 | ut_GetCharImage(&p_reg_fc, ch, &image); |
|---|
| 513 | if(image.type == _UT_IMAGE_TYPE_NULL_GLYPH) |
|---|
| 514 | ut_GetCharImage(&p_reg_fc, CH_BLANK, &image); |
|---|
| 515 | #elif IS_FONT_MLF |
|---|
| 516 | RML_GetCharImage(&p_reg_fc, ch, &image); |
|---|
| 517 | if(image.type == RML_IMAGE_TYPE_NULL_GLYPH) |
|---|
| 518 | RML_GetCharImage(&p_reg_fc, CH_BLANK, &image); |
|---|
| 519 | #endif |
|---|
| 520 | |
|---|
| 521 | return image.height*12/10; //¾à 1.2¹è¸¦ Ű¿î Å©±â |
|---|
| 522 | } |
|---|
| 523 | |
|---|
| 524 | |
|---|
| 525 | |
|---|
| 526 | void DCCDDI_SetFontAttr(int size, BOOL is_italic, BOOL is_underline, UINT8 font_style, |
|---|
| 527 | UINT8 edge_type, BOOL is_p16) |
|---|
| 528 | { |
|---|
| 529 | //¸ðµç °ªÀÌ µ¿ÀÏÇÏ¸é ¹Ù·Î ¸®ÅÏÇÔ. |
|---|
| 530 | if((p_font_attr.size==size) && (p_font_attr.is_italic==is_italic) && |
|---|
| 531 | (p_font_attr.is_underline==is_underline) && |
|---|
| 532 | (p_font_attr.font_style==font_style) && (p_font_attr.edge_type==edge_type) && |
|---|
| 533 | (p_font_attr.is_p16==is_p16)) return; |
|---|
| 534 | |
|---|
| 535 | CCPRINT("ddi", "DCCDDI_SetFontAttr: s(%d), i(%d), u(%d), fs(%d), et(%d), p16(%d)\n", |
|---|
| 536 | size, is_italic, is_underline, font_style, edge_type, is_p16); |
|---|
| 537 | |
|---|
| 538 | #if IS_FONT_JUNGLE |
|---|
| 539 | |
|---|
| 540 | #if USE_FONT_CACHE |
|---|
| 541 | memset(p_ut_img_cache, 0, sizeof(p_ut_img_cache)); |
|---|
| 542 | #endif |
|---|
| 543 | |
|---|
| 544 | p_font_attr.size=size; |
|---|
| 545 | p_font_attr.is_italic=is_italic; |
|---|
| 546 | p_font_attr.is_underline=is_underline; |
|---|
| 547 | p_font_attr.font_style=font_style; |
|---|
| 548 | |
|---|
| 549 | p_font_attr.edge_type=edge_type; |
|---|
| 550 | //edge type modify ÇÊ¿äÇÔ. |
|---|
| 551 | p_font_attr.is_p16=is_p16; |
|---|
| 552 | |
|---|
| 553 | ut_SetSize(&p_reg_fc, size, size); |
|---|
| 554 | ut_SetItalic(&p_reg_fc, is_italic?1:0); |
|---|
| 555 | |
|---|
| 556 | if(font_style==0) font_style=3; //default |
|---|
| 557 | |
|---|
| 558 | if(is_p16) ut_SetFont(&p_reg_fc, eDCC_FS_KOREAN); |
|---|
| 559 | else ut_SetFont(&p_reg_fc, font_style); |
|---|
| 560 | |
|---|
| 561 | ut_SetEdgeType(&p_reg_fc, edge_type); |
|---|
| 562 | |
|---|
| 563 | #elif IS_FONT_MLF |
|---|
| 564 | |
|---|
| 565 | /* ½ÇÁ¦ ¼³Á¤µÈ ±ÛÀÚº¸´Ù 2»çÀÌÁî ÀÛÀº ÆùÆ®¸¦ »ç¿ëÇÑ´Ù. |
|---|
| 566 | ¼øÀüÈ÷ °æÇèÀûÀ¸·Î ¾ò¾îÁø °á·ÐÀÓ |
|---|
| 567 | */ |
|---|
| 568 | p_font_attr.size=size; |
|---|
| 569 | p_font_attr.is_italic=is_italic; |
|---|
| 570 | p_font_attr.is_underline=is_underline; |
|---|
| 571 | p_font_attr.font_style=font_style; |
|---|
| 572 | |
|---|
| 573 | p_font_attr.edge_type=edge_type; |
|---|
| 574 | //edge type modify ÇÊ¿äÇÔ. |
|---|
| 575 | p_font_attr.is_p16=is_p16; |
|---|
| 576 | |
|---|
| 577 | RML_SetSize(&p_reg_fc, size, size); |
|---|
| 578 | RML_SetItalic(&p_reg_fc, is_italic?1:0); |
|---|
| 579 | |
|---|
| 580 | if(font_style==0) font_style=3; //default |
|---|
| 581 | |
|---|
| 582 | if(is_p16) RML_SetFont(&p_reg_fc, eDCC_FS_KOREAN); |
|---|
| 583 | else RML_SetFont(&p_reg_fc, font_style); |
|---|
| 584 | |
|---|
| 585 | RML_SetEdgeType(&p_reg_fc, edge_type); |
|---|
| 586 | |
|---|
| 587 | #endif |
|---|
| 588 | } |
|---|
| 589 | |
|---|
| 590 | |
|---|
| 591 | #if 0 |
|---|
| 592 | __Init__() {} |
|---|
| 593 | #endif |
|---|
| 594 | |
|---|
| 595 | |
|---|
| 596 | |
|---|
| 597 | void DCCDDI_Init() |
|---|
| 598 | { |
|---|
| 599 | p_ud_msgq=DCCDDI_CreateMessageQueue("udmsgq", MAX_NUM_PIC_UD_Q, sizeof(int)); |
|---|
| 600 | |
|---|
| 601 | #if IS_FONT_JUNGLE |
|---|
| 602 | ut_InitFontContext(&p_reg_fc, 0, 0); |
|---|
| 603 | #elif IS_FONT_MLF |
|---|
| 604 | RML_InitFontContext(&p_reg_fc, 0, 0); |
|---|
| 605 | #endif |
|---|
| 606 | |
|---|
| 607 | VDEC_SetUserFunc((void *)p_user_data); |
|---|
| 608 | VDEC_StartCaption(0); |
|---|
| 609 | } |
|---|
| 610 | |
|---|
| 611 | void DCCDDI_SetKoreanMode(BOOL is_unicode) |
|---|
| 612 | { |
|---|
| 613 | //unicode¸¦ ¾µ °ÍÀÎÁö. |
|---|
| 614 | p_font_attr.is_unicode=is_unicode; |
|---|
| 615 | } |
|---|
| 616 | |
|---|
| 617 | |
|---|
| 618 | #if 0 |
|---|
| 619 | ___Debug___() |
|---|
| 620 | #endif |
|---|
| 621 | |
|---|
| 622 | void cc_ddi_info() |
|---|
| 623 | { |
|---|
| 624 | printf("size : %d\n", p_font_attr.size); |
|---|
| 625 | printf("italic : %d\n", p_font_attr.is_italic); |
|---|
| 626 | printf("underline : %d\n", p_font_attr.is_underline); |
|---|
| 627 | printf("unicode : %d\n", p_font_attr.is_unicode); |
|---|
| 628 | printf("p16 : %d\n", p_font_attr.is_p16); |
|---|
| 629 | printf("font_style : %d\n", p_font_attr.font_style); |
|---|
| 630 | printf("edge_type : %d\n", p_font_attr.edge_type); |
|---|
| 631 | |
|---|
| 632 | } |
|---|