| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002-2005, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bccwinlib.c $ |
|---|
| 11 | * $brcm_Revision: 3 $ |
|---|
| 12 | * $brcm_Date: 5/17/05 7:50p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/lib/ccgfx/winlib/bccwinlib.c $ |
|---|
| 19 | * |
|---|
| 20 | * 3 5/17/05 7:50p shyam |
|---|
| 21 | * PR 8365 : Making it work at runtime |
|---|
| 22 | * |
|---|
| 23 | * 3 5/17/05 7:48p shyam |
|---|
| 24 | * PR 8365 : Making it work at runtime |
|---|
| 25 | * |
|---|
| 26 | ***************************************************************************/ |
|---|
| 27 | |
|---|
| 28 | #include "bdcc_kernel.h" |
|---|
| 29 | #include "bccwinlib.h" |
|---|
| 30 | #include "bstd.h" |
|---|
| 31 | #include "bapp_eia708.h" |
|---|
| 32 | #include "genericlist.h" |
|---|
| 33 | #include "bdccengine.h" |
|---|
| 34 | #include "bdccpriv.h" |
|---|
| 35 | #include "ministd.h" |
|---|
| 36 | |
|---|
| 37 | BDBG_MODULE(bdcc_winlib); |
|---|
| 38 | |
|---|
| 39 | #define MAX_UNI_LEN 256 |
|---|
| 40 | #define MAX_ZORDER 8 |
|---|
| 41 | #define DEF_LINE_SPACING 4 |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | struct BCCGFX_WINLIB_P_Object |
|---|
| 45 | { |
|---|
| 46 | void *p_app; |
|---|
| 47 | bgfx_surf_t *p_osd_surf; |
|---|
| 48 | bccgfx_update_cb_t update_cb; |
|---|
| 49 | unsigned int uni_str[MAX_UNI_LEN]; |
|---|
| 50 | LIST_T surf_list; /* list of surfaces created */ |
|---|
| 51 | LIST_T free_surf_list; /* list of surfaces created */ |
|---|
| 52 | int alloc_cnt; |
|---|
| 53 | bccgfx_get_wide_aspect_ratio_cb_t wide_aspect_ratio_cb; |
|---|
| 54 | } BCCGFX_WINLIB_P_Object; |
|---|
| 55 | |
|---|
| 56 | struct BCCGFX_WINLIB_P_Window |
|---|
| 57 | { |
|---|
| 58 | LINKS_T links; |
|---|
| 59 | BCCGFX_WINLIB_P_Handle hWinLibHandle; |
|---|
| 60 | bgfx_surf_t surf; |
|---|
| 61 | BCCGFX_WINLIB_P_Font font ; |
|---|
| 62 | uint32_t EdgeColor; |
|---|
| 63 | BDCC_Edge EdgeType; |
|---|
| 64 | uint32_t EdgeWidth; |
|---|
| 65 | uint32_t ForeGroundColor; |
|---|
| 66 | uint32_t BackGroundColor; |
|---|
| 67 | uint32_t PenPositionx ; |
|---|
| 68 | uint32_t PenPositiony ; |
|---|
| 69 | uint16_t x; |
|---|
| 70 | uint16_t y; |
|---|
| 71 | uint16_t width; |
|---|
| 72 | uint16_t height; |
|---|
| 73 | int zorder; |
|---|
| 74 | bool show; |
|---|
| 75 | bool bClippedOut; |
|---|
| 76 | int italics; |
|---|
| 77 | int underline; |
|---|
| 78 | BCCGFX_WINLIB_P_Rect clip_rect; |
|---|
| 79 | int id; |
|---|
| 80 | } BCCGFX_WINLIB_P_Window; |
|---|
| 81 | |
|---|
| 82 | struct BCCGFX_WINLIB_P_FontInfo |
|---|
| 83 | { |
|---|
| 84 | bgfx_font_t *p_font; |
|---|
| 85 | BCCGFX_WINLIB_P_Handle hWinLibHandle; |
|---|
| 86 | uint32_t TextBase; |
|---|
| 87 | } BCCGFX_WINLIB_P_FontInfo; |
|---|
| 88 | |
|---|
| 89 | extern unsigned int c_to_uni_str( |
|---|
| 90 | unsigned char *str_p, /* Null terminated c-string */ |
|---|
| 91 | unsigned int *p_uni_str, /* buffer to use for contructing UNI string */ |
|---|
| 92 | unsigned int max_size); /* maximum buffer size in words */ |
|---|
| 93 | |
|---|
| 94 | static bgfx_palette_t ColorLookup = {{0,128,192,255,0,128,192,255,0,128,192,255,0,128,192,255}} ; |
|---|
| 95 | |
|---|
| 96 | /* |
|---|
| 97 | Summary: |
|---|
| 98 | Remap characters |
|---|
| 99 | */ |
|---|
| 100 | |
|---|
| 101 | static void remap_chars(unsigned int *p_uni_str, int len) |
|---|
| 102 | { |
|---|
| 103 | int i; |
|---|
| 104 | for (i = 0; i < len; ++i) |
|---|
| 105 | { |
|---|
| 106 | switch(p_uni_str[i]) { |
|---|
| 107 | case 0x7F: |
|---|
| 108 | p_uni_str[i] = 0x266A; |
|---|
| 109 | break; |
|---|
| 110 | case 0x82: |
|---|
| 111 | p_uni_str[i] = 0x215B; |
|---|
| 112 | break; |
|---|
| 113 | case 0x83: |
|---|
| 114 | p_uni_str[i] = 0x215C; |
|---|
| 115 | break; |
|---|
| 116 | case 0x84: |
|---|
| 117 | p_uni_str[i] = 0x215D; |
|---|
| 118 | break; |
|---|
| 119 | case 0x85: |
|---|
| 120 | p_uni_str[i] = 0x2026; |
|---|
| 121 | break; |
|---|
| 122 | case 0x86: |
|---|
| 123 | p_uni_str[i] = 0x215E; |
|---|
| 124 | break; |
|---|
| 125 | case 0x87: |
|---|
| 126 | p_uni_str[i] = 0x7C; |
|---|
| 127 | break; |
|---|
| 128 | case 0x88: |
|---|
| 129 | p_uni_str[i] = 0x2510; |
|---|
| 130 | break; |
|---|
| 131 | case 0x89: |
|---|
| 132 | p_uni_str[i] = 0x2514; |
|---|
| 133 | break; |
|---|
| 134 | case 0x8A: |
|---|
| 135 | p_uni_str[i] = 0x160; |
|---|
| 136 | break; |
|---|
| 137 | case 0x8B: |
|---|
| 138 | p_uni_str[i] = 0x2015; |
|---|
| 139 | break; |
|---|
| 140 | case 0x8C: |
|---|
| 141 | p_uni_str[i] = 0x152; |
|---|
| 142 | break; |
|---|
| 143 | case 0x8D: |
|---|
| 144 | p_uni_str[i] = 0x250C; |
|---|
| 145 | break; |
|---|
| 146 | case 0x8F: |
|---|
| 147 | p_uni_str[i] = 0x2518; |
|---|
| 148 | break; |
|---|
| 149 | case 0x90: |
|---|
| 150 | p_uni_str[i] = 0x25A0; |
|---|
| 151 | break; |
|---|
| 152 | case 0x91: |
|---|
| 153 | p_uni_str[i] = 0x2018; |
|---|
| 154 | break; |
|---|
| 155 | case 0x92: |
|---|
| 156 | p_uni_str[i] = 0x2019; |
|---|
| 157 | break; |
|---|
| 158 | case 0x93: |
|---|
| 159 | p_uni_str[i] = 0x201C; |
|---|
| 160 | break; |
|---|
| 161 | case 0x94: |
|---|
| 162 | p_uni_str[i] = 0x201D; |
|---|
| 163 | break; |
|---|
| 164 | case 0x95: |
|---|
| 165 | p_uni_str[i] = 0x2022; |
|---|
| 166 | break; |
|---|
| 167 | case 0x99: |
|---|
| 168 | p_uni_str[i] = 0x2122; |
|---|
| 169 | break; |
|---|
| 170 | case 0x9A: |
|---|
| 171 | p_uni_str[i] = 0x161; |
|---|
| 172 | break; |
|---|
| 173 | case 0x9C: |
|---|
| 174 | p_uni_str[i] = 0x153; |
|---|
| 175 | break; |
|---|
| 176 | case 0x9D: |
|---|
| 177 | p_uni_str[i] = 0x2120; |
|---|
| 178 | break; |
|---|
| 179 | case 0x9F: |
|---|
| 180 | p_uni_str[i] = 0x178; |
|---|
| 181 | break; |
|---|
| 182 | default: |
|---|
| 183 | break; |
|---|
| 184 | } |
|---|
| 185 | } |
|---|
| 186 | } |
|---|
| 187 | /* |
|---|
| 188 | Summary: |
|---|
| 189 | Construct a UNI string in the buffer provided from the cstring. |
|---|
| 190 | */ |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | static BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_AllocWindow( |
|---|
| 194 | BCCGFX_WINLIB_P_Handle hWinLibHandle, |
|---|
| 195 | BCCGFX_WINLIB_P_hWin *pwin, |
|---|
| 196 | uint32_t width, |
|---|
| 197 | uint32_t height) |
|---|
| 198 | { |
|---|
| 199 | *pwin = (BCCGFX_WINLIB_P_hWin)BKNI_Malloc(sizeof(struct BCCGFX_WINLIB_P_Window)); |
|---|
| 200 | if(*pwin == NULL) |
|---|
| 201 | { |
|---|
| 202 | return BERR_TRACE(BCCGFX_WINLIB_P_ERROR_NO_MEMORY) ; |
|---|
| 203 | } |
|---|
| 204 | BKNI_Memset(*pwin,0,sizeof(BCCGFX_WINLIB_P_Window)); |
|---|
| 205 | (*pwin)->hWinLibHandle = hWinLibHandle ; |
|---|
| 206 | |
|---|
| 207 | if ((width == 0) || (height == 0)) |
|---|
| 208 | { |
|---|
| 209 | width = hWinLibHandle->p_osd_surf->surface.width; |
|---|
| 210 | height = hWinLibHandle->p_osd_surf->surface.height; |
|---|
| 211 | } |
|---|
| 212 | #ifdef CONFIG_GFX_ARGB32 |
|---|
| 213 | if (bgfx_create(&((*pwin)->surf),width,height,NULL,0,NULL,BGFX_SURF_BPP(32)|BGFX_SURF_RGB|BGFX_SURF_GRC)!=0) |
|---|
| 214 | #else |
|---|
| 215 | if (bgfx_create(&((*pwin)->surf), width , height,NULL,0,NULL,BGFX_SURF_BPP(4)) != 0) |
|---|
| 216 | #endif |
|---|
| 217 | { |
|---|
| 218 | BDCC_DBG_ERR(("bgfx_create err! \n")); |
|---|
| 219 | return BCCGFX_WINLIB_P_ERROR_NO_MEMORY; |
|---|
| 220 | } |
|---|
| 221 | #ifndef CONFIG_GFX_ARGB32 |
|---|
| 222 | bgfx_set_palette(&((*pwin)->surf),&ColorLookup); |
|---|
| 223 | #endif |
|---|
| 224 | bgfx_fill_rect(&((*pwin)->surf),0,0,width,height,DCCGFX_COLOR_CLEAR); |
|---|
| 225 | |
|---|
| 226 | (*pwin)->width = width; |
|---|
| 227 | (*pwin)->height = height; |
|---|
| 228 | (*pwin)->id = hWinLibHandle->alloc_cnt++; |
|---|
| 229 | |
|---|
| 230 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Init( |
|---|
| 235 | BCCGFX_WINLIB_P_Handle *phWinLibHandle, |
|---|
| 236 | bgfx_surf_t *p_osd_surf, |
|---|
| 237 | bccgfx_update_cb_t update_cb, |
|---|
| 238 | bccgfx_get_wide_aspect_ratio_cb_t wide_aspect_ratio_cb, |
|---|
| 239 | void *p_app |
|---|
| 240 | ) |
|---|
| 241 | { |
|---|
| 242 | BCCGFX_WINLIB_P_Handle hWinLibHandle; |
|---|
| 243 | BCCGFX_WINLIB_P_hWin win; |
|---|
| 244 | int sidx; |
|---|
| 245 | BDCC_DBG_MSG(("BCCGFX_WINLIB_P_Init")); |
|---|
| 246 | *phWinLibHandle = hWinLibHandle = (BCCGFX_WINLIB_P_Handle) BKNI_Malloc(sizeof(BCCGFX_WINLIB_P_Object)); |
|---|
| 247 | if(hWinLibHandle == NULL) |
|---|
| 248 | { |
|---|
| 249 | return BERR_TRACE(BCCGFX_WINLIB_P_ERROR_NO_MEMORY) ; |
|---|
| 250 | } |
|---|
| 251 | memcpy(ColorLookup.clut,g_eia708_palette,16 * sizeof(unsigned int)); |
|---|
| 252 | BKNI_Memset(hWinLibHandle,0,sizeof(BCCGFX_WINLIB_P_Object)); |
|---|
| 253 | hWinLibHandle->p_app = p_app ; |
|---|
| 254 | hWinLibHandle->update_cb = update_cb ; |
|---|
| 255 | hWinLibHandle->p_osd_surf = p_osd_surf; |
|---|
| 256 | hWinLibHandle->wide_aspect_ratio_cb = wide_aspect_ratio_cb; |
|---|
| 257 | initl(&hWinLibHandle->surf_list); |
|---|
| 258 | initl(&hWinLibHandle->free_surf_list); |
|---|
| 259 | /* need to match the one defined in gdccgfx.c, CCGFX_MAX_ROWS_PER_WND */ |
|---|
| 260 | for (sidx = 0; sidx < CCGFX_NUM_WNDS * 15; sidx++) |
|---|
| 261 | { |
|---|
| 262 | if (BCCGFX_WINLIB_P_AllocWindow(hWinLibHandle,&win,hWinLibHandle->p_osd_surf->surface.width,DCCGFX_MAX_CELL_HEIGHT + BDCC_Max_Edge_Width + 1) != BCCGFX_WINLIB_P_SUCCESS) |
|---|
| 263 | { |
|---|
| 264 | BDCC_DBG_WRN(("BCCGFX_WINLIB_P_AllocWindow failed %d\n",win)); |
|---|
| 265 | continue; |
|---|
| 266 | } |
|---|
| 267 | inslt(&(hWinLibHandle->free_surf_list),win); |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | void BCCGFX_WINLIB_Sync(BCCGFX_WINLIB_P_Handle hWinLibHandle) |
|---|
| 274 | { |
|---|
| 275 | BCCGFX_WINLIB_P_hWin p_win; |
|---|
| 276 | //int zorder; |
|---|
| 277 | //for (zorder = 0; zorder < MAX_ZORDER; ++zorder) |
|---|
| 278 | { |
|---|
| 279 | /* copy the list to the build list. */ |
|---|
| 280 | for (p_win = (BCCGFX_WINLIB_P_hWin)LHEAD(&(hWinLibHandle->surf_list)); |
|---|
| 281 | p_win != NULL; p_win = (BCCGFX_WINLIB_P_hWin)LNEXT(p_win)) |
|---|
| 282 | { |
|---|
| 283 | if ((p_win->show) && (!p_win->bClippedOut)) |
|---|
| 284 | { |
|---|
| 285 | BCCGFX_WINLIB_P_Rect srcRect; |
|---|
| 286 | BCCGFX_WINLIB_P_GetRect(p_win,&srcRect); |
|---|
| 287 | //bgfx_blit_rect(&p_win->surf,hWinLibHandle->p_osd_surf,0,0,p_win->x,p_win->y,p_win->width,p_win->height); |
|---|
| 288 | |
|---|
| 289 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d) => (%d,%d,%d,%d)\n",__FUNCTION__,p_win->id,p_win->clip_rect.x,p_win->clip_rect.y, |
|---|
| 290 | p_win->clip_rect.width,p_win->clip_rect.height, |
|---|
| 291 | srcRect.x,srcRect.y,srcRect.width,srcRect.height)); |
|---|
| 292 | |
|---|
| 293 | bgfx_blit_rect(&p_win->surf,hWinLibHandle->p_osd_surf,p_win->clip_rect.x,p_win->clip_rect.y,srcRect.x,srcRect.y,srcRect.width,srcRect.height); |
|---|
| 294 | } |
|---|
| 295 | } |
|---|
| 296 | } |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_OpenWindow( |
|---|
| 300 | BCCGFX_WINLIB_P_Handle hWinLibHandle, |
|---|
| 301 | BCCGFX_WINLIB_P_hWin *pwin, |
|---|
| 302 | uint32_t width, |
|---|
| 303 | uint32_t height) |
|---|
| 304 | { |
|---|
| 305 | BCCGFX_WINLIB_P_hWin win = remlh(&(hWinLibHandle->free_surf_list)); |
|---|
| 306 | BDCC_ASSERT(hWinLibHandle); |
|---|
| 307 | if ((width > hWinLibHandle->p_osd_surf->surface.width) || (height > DCCGFX_MAX_CELL_HEIGHT + BDCC_Max_Edge_Width)) |
|---|
| 308 | { |
|---|
| 309 | BDCC_DBG_ERR(("BCCGFX_WINLIB_P_OpenWindow failed, width = %d, height = %d",width,height)); |
|---|
| 310 | return BERR_TRACE(BCCGFX_WINLIB_P_ERROR_NO_MEMORY) ; |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | if (!win) |
|---|
| 314 | { |
|---|
| 315 | BDCC_DBG_ERR(("BCCGFX_WINLIB_P_OpenWindow failed, no windows in free list")); |
|---|
| 316 | return BERR_TRACE(BCCGFX_WINLIB_P_ERROR_NO_MEMORY) ; |
|---|
| 317 | } |
|---|
| 318 | |
|---|
| 319 | inslt(&(hWinLibHandle->surf_list),win); |
|---|
| 320 | memset(&(win->EdgeColor),0, (unsigned int)&(win->id) - (unsigned int)&(win->EdgeColor)); |
|---|
| 321 | win->width = width; |
|---|
| 322 | win->height = height; |
|---|
| 323 | *pwin = win; |
|---|
| 324 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 325 | } |
|---|
| 326 | |
|---|
| 327 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_CloseWindow(BCCGFX_WINLIB_P_hWin win) |
|---|
| 328 | { |
|---|
| 329 | BDCC_ASSERT(win); |
|---|
| 330 | if (!win || !win->hWinLibHandle) |
|---|
| 331 | return BCCGFX_WINLIB_P_ERROR_NO_MEMORY; |
|---|
| 332 | BDCC_DBG_MSG(("%s(%d)", __FUNCTION__,win->id)); |
|---|
| 333 | |
|---|
| 334 | reml(&win->hWinLibHandle->surf_list,win); |
|---|
| 335 | inslt(&(win->hWinLibHandle->free_surf_list),win); |
|---|
| 336 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetZorder(BCCGFX_WINLIB_P_hWin win, int zorder) |
|---|
| 340 | { |
|---|
| 341 | BDCC_ASSERT(win); |
|---|
| 342 | BDCC_DBG_MSG(("%s(%d,%d)", __FUNCTION__,win->id,zorder)); |
|---|
| 343 | win->zorder = zorder; |
|---|
| 344 | |
|---|
| 345 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Show(BCCGFX_WINLIB_P_hWin win) |
|---|
| 349 | { |
|---|
| 350 | BDCC_ASSERT(win); |
|---|
| 351 | BDCC_DBG_MSG(("%s(%d)", __FUNCTION__,win->id)); |
|---|
| 352 | win->show = true; |
|---|
| 353 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 354 | } |
|---|
| 355 | |
|---|
| 356 | bool BCCGFX_WINLIB_P_IsShown(BCCGFX_WINLIB_P_hWin win) |
|---|
| 357 | { |
|---|
| 358 | BDCC_ASSERT(win); |
|---|
| 359 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 360 | return win->show; |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Hide(BCCGFX_WINLIB_P_hWin win) |
|---|
| 364 | { |
|---|
| 365 | BDCC_ASSERT(win); |
|---|
| 366 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 367 | win->show = false; |
|---|
| 368 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetPenPosition(BCCGFX_WINLIB_P_hWin win, uint32_t *px, uint32_t *py) |
|---|
| 372 | { |
|---|
| 373 | BDCC_ASSERT(px) ; |
|---|
| 374 | BDCC_ASSERT(py) ; |
|---|
| 375 | BDCC_DBG_MSG(("%s x=%d,y=%d", __FUNCTION__,win->PenPositionx,win->PenPositiony)); |
|---|
| 376 | *px = win->PenPositionx ; |
|---|
| 377 | *py = win->PenPositiony ; |
|---|
| 378 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 379 | } |
|---|
| 380 | |
|---|
| 381 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetPenPosition(BCCGFX_WINLIB_P_hWin win, uint32_t x, uint32_t y) |
|---|
| 382 | { |
|---|
| 383 | BDCC_ASSERT(win); |
|---|
| 384 | BDCC_DBG_MSG(("%s %d(%d,%d)", __FUNCTION__,win->id,x,y)); |
|---|
| 385 | win->PenPositionx = x ; |
|---|
| 386 | win->PenPositiony = y ; |
|---|
| 387 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 388 | } |
|---|
| 389 | |
|---|
| 390 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetPosition(BCCGFX_WINLIB_P_hWin win, uint32_t x, uint32_t y) |
|---|
| 391 | { |
|---|
| 392 | BDCC_ASSERT(win); |
|---|
| 393 | BDCC_DBG_MSG(("%s %d(%d,%d)", __FUNCTION__,win->id,x,y)); |
|---|
| 394 | win->x = x; |
|---|
| 395 | win->y = y; |
|---|
| 396 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetViewRect(BCCGFX_WINLIB_P_hWin win, const BCCGFX_WINLIB_P_Rect *pRect) |
|---|
| 400 | { |
|---|
| 401 | |
|---|
| 402 | BDCC_ASSERT(win); |
|---|
| 403 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d)", __FUNCTION__,win->id,pRect->x,pRect->y,pRect->width,pRect->height)); |
|---|
| 404 | memcpy(&(win->clip_rect),pRect,sizeof(BCCGFX_WINLIB_P_Rect)); |
|---|
| 405 | |
|---|
| 406 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 407 | } |
|---|
| 408 | |
|---|
| 409 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetRect(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Rect *pRect) |
|---|
| 410 | { |
|---|
| 411 | BDCC_ASSERT(win); |
|---|
| 412 | pRect->x = win->x ; |
|---|
| 413 | pRect->y = win->y ; |
|---|
| 414 | pRect->width = win->width ; |
|---|
| 415 | pRect->height = win->height ; |
|---|
| 416 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d)", __FUNCTION__,win->id,pRect->x,pRect->y,pRect->width,pRect->height)); |
|---|
| 417 | |
|---|
| 418 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 419 | } |
|---|
| 420 | |
|---|
| 421 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetRect(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Rect *pRect ) |
|---|
| 422 | { |
|---|
| 423 | BDCC_ASSERT(win); |
|---|
| 424 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d)", __FUNCTION__,win->id,pRect->x,pRect->y,pRect->width,pRect->height)); |
|---|
| 425 | win->x = pRect->x; |
|---|
| 426 | win->y = pRect->y; |
|---|
| 427 | win->width = pRect->width; |
|---|
| 428 | win->height = pRect->height; |
|---|
| 429 | |
|---|
| 430 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 431 | } |
|---|
| 432 | |
|---|
| 433 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetForegroundColor(BCCGFX_WINLIB_P_hWin win, uint32_t ForeGroundColor) |
|---|
| 434 | { |
|---|
| 435 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 436 | BDCC_ASSERT(win); |
|---|
| 437 | win->ForeGroundColor = ForeGroundColor ; |
|---|
| 438 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetBackgroundColor(BCCGFX_WINLIB_P_hWin win, uint32_t BackGroundColor) |
|---|
| 442 | { |
|---|
| 443 | BDCC_ASSERT(win); |
|---|
| 444 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 445 | win->BackGroundColor = BackGroundColor ; |
|---|
| 446 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 447 | } |
|---|
| 448 | |
|---|
| 449 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetEdgeColor(BCCGFX_WINLIB_P_hWin win, uint32_t EdgeColor) |
|---|
| 450 | { |
|---|
| 451 | BDCC_ASSERT(win); |
|---|
| 452 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 453 | |
|---|
| 454 | win->EdgeColor = EdgeColor ; |
|---|
| 455 | |
|---|
| 456 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetEdgeType(BCCGFX_WINLIB_P_hWin win, BDCC_Edge EdgeType ) |
|---|
| 460 | { |
|---|
| 461 | BDCC_ASSERT(win); |
|---|
| 462 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 463 | |
|---|
| 464 | win->EdgeType = EdgeType ; |
|---|
| 465 | |
|---|
| 466 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 467 | } |
|---|
| 468 | |
|---|
| 469 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetEdgeWidth(BCCGFX_WINLIB_P_hWin win, uint32_t EdgeWidth ) |
|---|
| 470 | { |
|---|
| 471 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 472 | BDCC_ASSERT(win); |
|---|
| 473 | |
|---|
| 474 | win->EdgeWidth = EdgeWidth ; |
|---|
| 475 | |
|---|
| 476 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 477 | } |
|---|
| 478 | |
|---|
| 479 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_FillRect(BCCGFX_WINLIB_P_hWin win, const BCCGFX_WINLIB_P_Rect *rect, uint32_t color) |
|---|
| 480 | { |
|---|
| 481 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d - %d)", __FUNCTION__,win->id,rect->x,rect->y,rect->width,rect->height,color)); |
|---|
| 482 | BDCC_ASSERT(win); |
|---|
| 483 | |
|---|
| 484 | bgfx_fill_rect(&win->surf,rect->x,rect->y,rect->width,rect->height,color); |
|---|
| 485 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 486 | } |
|---|
| 487 | |
|---|
| 488 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_LoadFont(BCCGFX_WINLIB_P_Handle hWinLibHandle, const char *pFontFile, int iFontSize, BCCGFX_WINLIB_P_Font *phFont) |
|---|
| 489 | { |
|---|
| 490 | BCCGFX_WINLIB_P_Font hFont ; |
|---|
| 491 | |
|---|
| 492 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 493 | |
|---|
| 494 | *phFont = hFont = (BCCGFX_WINLIB_P_Font)BKNI_Malloc(sizeof(BCCGFX_WINLIB_P_FontInfo)); |
|---|
| 495 | if(hFont == NULL) |
|---|
| 496 | { |
|---|
| 497 | return BERR_TRACE(BCCGFX_WINLIB_P_ERROR_NO_MEMORY) ; |
|---|
| 498 | } |
|---|
| 499 | hFont->p_font = (bgfx_font_t*)pFontFile; |
|---|
| 500 | hFont->TextBase = hFont->p_font->ascender; //iFontSize; |
|---|
| 501 | hFont->hWinLibHandle = hWinLibHandle; |
|---|
| 502 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_UnloadFont(BCCGFX_WINLIB_P_Font font) |
|---|
| 506 | { |
|---|
| 507 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 508 | BKNI_Free(font); |
|---|
| 509 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 510 | } |
|---|
| 511 | |
|---|
| 512 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetFont(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Font font, |
|---|
| 513 | int italics, int underline) |
|---|
| 514 | { |
|---|
| 515 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 516 | win->font = font; |
|---|
| 517 | win->italics = italics; |
|---|
| 518 | win->underline = underline; |
|---|
| 519 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 520 | } |
|---|
| 521 | |
|---|
| 522 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_DrawString(BCCGFX_WINLIB_P_hWin win, const char *str) |
|---|
| 523 | { |
|---|
| 524 | int uni_str_len, x = 0, y = 0; |
|---|
| 525 | bgfx_text_style style = eBGFX_NORMAL; |
|---|
| 526 | |
|---|
| 527 | BDCC_ASSERT(win); |
|---|
| 528 | BDCC_ASSERT(win->font); |
|---|
| 529 | |
|---|
| 530 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%s)",__FUNCTION__, win->id,win->PenPositionx, win->PenPositiony, win->ForeGroundColor,str)); |
|---|
| 531 | uni_str_len = c_to_uni_str((unsigned char*)str,win->hWinLibHandle->uni_str,MAX_UNI_LEN); |
|---|
| 532 | remap_chars(win->hWinLibHandle->uni_str,uni_str_len); |
|---|
| 533 | if (win->underline) |
|---|
| 534 | style |= eBGFX_UNDERLINE; |
|---|
| 535 | |
|---|
| 536 | if (win->italics) |
|---|
| 537 | style |= eBGFX_ITALIC; |
|---|
| 538 | |
|---|
| 539 | switch( win->EdgeType ) |
|---|
| 540 | { |
|---|
| 541 | /* |
|---|
| 542 | ** This is arbitrary, but default to "Right Drop Shadow" for "Raised", "Depressed" and "Uniform". |
|---|
| 543 | ** A simple multi-rendering approach doesn't work with these styles. |
|---|
| 544 | */ |
|---|
| 545 | case BDCC_Edge_Style_Raised: |
|---|
| 546 | case BDCC_Edge_Style_Depressed: |
|---|
| 547 | case BDCC_Edge_Style_Uniform: |
|---|
| 548 | case BDCC_Edge_Style_RightDropShadow: |
|---|
| 549 | bgfx_draw_text(&win->surf,win->PenPositionx+win->EdgeWidth, win->PenPositiony+win->EdgeWidth + win->font->TextBase, |
|---|
| 550 | (const unsigned long *)win->hWinLibHandle->uni_str,uni_str_len, |
|---|
| 551 | win->font->p_font,win->EdgeColor,style); |
|---|
| 552 | break; |
|---|
| 553 | case BDCC_Edge_Style_LeftDropShadow: |
|---|
| 554 | if (win->EdgeWidth > 1) |
|---|
| 555 | x = win->EdgeWidth - 1; |
|---|
| 556 | else |
|---|
| 557 | x = 1; |
|---|
| 558 | //x = win->EdgeWidth; |
|---|
| 559 | y = win->EdgeWidth; |
|---|
| 560 | bgfx_draw_text(&win->surf,win->PenPositionx, win->PenPositiony + win->font->TextBase, |
|---|
| 561 | (const unsigned long *)win->hWinLibHandle->uni_str,uni_str_len, |
|---|
| 562 | win->font->p_font,win->EdgeColor,style); |
|---|
| 563 | break; |
|---|
| 564 | case BDCC_Edge_Style_None: |
|---|
| 565 | default: |
|---|
| 566 | break; |
|---|
| 567 | } |
|---|
| 568 | bgfx_draw_text(&win->surf,win->PenPositionx + x, win->PenPositiony + win->font->TextBase - y, |
|---|
| 569 | (const unsigned long *)win->hWinLibHandle->uni_str,uni_str_len, |
|---|
| 570 | win->font->p_font,win->ForeGroundColor,style); |
|---|
| 571 | |
|---|
| 572 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 573 | } |
|---|
| 574 | |
|---|
| 575 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_DrawHLine( |
|---|
| 576 | BCCGFX_WINLIB_P_hWin win, uint32_t x, uint32_t y, uint32_t wide, uint32_t length, uint32_t FgColor) |
|---|
| 577 | { |
|---|
| 578 | BDCC_ASSERT(win) ; |
|---|
| 579 | BDCC_DBG_ERR(("%s %d(%d,%d,%d)",__FUNCTION__, win->id,x, y, FgColor)); |
|---|
| 580 | bgfx_h_draw_line(&win->surf,x,y,length,FgColor); |
|---|
| 581 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 582 | } |
|---|
| 583 | |
|---|
| 584 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetGlyphMetrics( BCCGFX_WINLIB_P_Font hFont, const char ch, int *pWidth, int * pHeight ) |
|---|
| 585 | { |
|---|
| 586 | int uni_str_len ; |
|---|
| 587 | char str[2] ; |
|---|
| 588 | unsigned int uni_str[2] ; |
|---|
| 589 | int height, width ; |
|---|
| 590 | |
|---|
| 591 | BDCC_ASSERT(hFont) ; |
|---|
| 592 | BDCC_ASSERT(pWidth) ; |
|---|
| 593 | |
|---|
| 594 | str[0] = ch; |
|---|
| 595 | str[1] = 0 ; |
|---|
| 596 | uni_str_len = c_to_uni_str((unsigned char*)str,uni_str,1); |
|---|
| 597 | remap_chars(uni_str,uni_str_len); |
|---|
| 598 | |
|---|
| 599 | bgfx_string_info(hFont->p_font,(const unsigned long *)uni_str,uni_str_len,&width,&height); |
|---|
| 600 | |
|---|
| 601 | *pWidth = width; |
|---|
| 602 | *pHeight = height; |
|---|
| 603 | |
|---|
| 604 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 605 | |
|---|
| 606 | } |
|---|
| 607 | |
|---|
| 608 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetFrameBufferSettings( |
|---|
| 609 | BCCGFX_WINLIB_P_Handle hWinLibHandle, |
|---|
| 610 | BCCGFX_WINLIB_P_FrameBufferSettings * pSettings ) |
|---|
| 611 | { |
|---|
| 612 | |
|---|
| 613 | pSettings->iHeight = hWinLibHandle->p_osd_surf->surface.height; |
|---|
| 614 | pSettings->iWidth = hWinLibHandle->p_osd_surf->surface.width; |
|---|
| 615 | |
|---|
| 616 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 617 | |
|---|
| 618 | } /*end of BCCGFX_WINLIB_P_GetFrameBufferSettings() */ |
|---|
| 619 | |
|---|
| 620 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetSurfaceSettings( |
|---|
| 621 | BCCGFX_WINLIB_P_hWin pSurface, |
|---|
| 622 | BCCGFX_WINLIB_P_SurfaceSettings * pSettings ) |
|---|
| 623 | { |
|---|
| 624 | |
|---|
| 625 | pSettings->iHeight = pSurface->surf.surface.height; |
|---|
| 626 | pSettings->iWidth = pSurface->surf.surface.width; |
|---|
| 627 | |
|---|
| 628 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 629 | |
|---|
| 630 | } /*end of BCCGFX_WINLIB_P_GetSurfaceSettings() */ |
|---|
| 631 | |
|---|
| 632 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetClipState(BCCGFX_WINLIB_P_hWin win, bool bClipState ) |
|---|
| 633 | { |
|---|
| 634 | |
|---|
| 635 | BDCC_ASSERT(win); |
|---|
| 636 | |
|---|
| 637 | BDCC_DBG_MSG(("%s %d(%d)", __FUNCTION__,win->id,bClipState)); |
|---|
| 638 | |
|---|
| 639 | /* |
|---|
| 640 | ** TODO: does the following logic work when a flashing surface scrolls onto the screen? |
|---|
| 641 | */ |
|---|
| 642 | |
|---|
| 643 | win->bClippedOut = bClipState; |
|---|
| 644 | |
|---|
| 645 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 646 | |
|---|
| 647 | } |
|---|
| 648 | |
|---|
| 649 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetFontHandle(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Font *pFontHandle ) |
|---|
| 650 | { |
|---|
| 651 | BDCC_ASSERT(win) ; |
|---|
| 652 | BDCC_ASSERT(pFontHandle) ; |
|---|
| 653 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 654 | *pFontHandle = win->font; |
|---|
| 655 | |
|---|
| 656 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 657 | } |
|---|
| 658 | |
|---|
| 659 | bool BCCGFX_WINLIB_P_GetClipState(BCCGFX_WINLIB_P_hWin win ) |
|---|
| 660 | { |
|---|
| 661 | |
|---|
| 662 | BDCC_ASSERT(win); |
|---|
| 663 | BDCC_DBG_MSG(("%s %d", __FUNCTION__,win->id)); |
|---|
| 664 | |
|---|
| 665 | return ( win->bClippedOut ) ; |
|---|
| 666 | } |
|---|
| 667 | |
|---|
| 668 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Copy(BCCGFX_WINLIB_P_hWin src, BCCGFX_WINLIB_P_hWin dst, |
|---|
| 669 | const BCCGFX_WINLIB_P_Rect *pSrcRect, |
|---|
| 670 | const BCCGFX_WINLIB_P_Rect *pDstRect |
|---|
| 671 | ) |
|---|
| 672 | { |
|---|
| 673 | BDCC_ASSERT(src) ; |
|---|
| 674 | BDCC_ASSERT(dst) ; |
|---|
| 675 | BDCC_ASSERT(pSrcRect) ; |
|---|
| 676 | BDCC_ASSERT(pDstRect) ; |
|---|
| 677 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d)=>%d(%d,%d,%d,%d)", __FUNCTION__,src->id,pSrcRect->x,pSrcRect->y, |
|---|
| 678 | pSrcRect->width,pSrcRect->height,dst->id,pDstRect->x,pDstRect->y,pDstRect->width,pDstRect->height)); |
|---|
| 679 | |
|---|
| 680 | bgfx_blit_rect(&src->surf,&dst->surf,pSrcRect->x,pSrcRect->y,pDstRect->x,pDstRect->y,pSrcRect->width,pSrcRect->height); |
|---|
| 681 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 682 | } |
|---|
| 683 | |
|---|
| 684 | |
|---|
| 685 | /* |
|---|
| 686 | ** For use when the CC library is managing the framebuffer direclty. |
|---|
| 687 | ** Look in the routine "BCCGFX_P_RedrawScreen()" to see how this is used. |
|---|
| 688 | */ |
|---|
| 689 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_CopyToFrameBuffer( |
|---|
| 690 | BCCGFX_WINLIB_P_hWin src, |
|---|
| 691 | BCCGFX_WINLIB_P_Handle hWinLibHandle, |
|---|
| 692 | const BCCGFX_WINLIB_P_Rect *pSrcRect, |
|---|
| 693 | const BCCGFX_WINLIB_P_Rect *pDstRect |
|---|
| 694 | ) |
|---|
| 695 | { |
|---|
| 696 | |
|---|
| 697 | BDCC_ASSERT(src) ; |
|---|
| 698 | BDCC_ASSERT(hWinLibHandle) ; |
|---|
| 699 | BDCC_ASSERT(pSrcRect) ; |
|---|
| 700 | BDCC_ASSERT(pDstRect) ; |
|---|
| 701 | BDCC_DBG_MSG(("%s %d(%d,%d,%d,%d)=>(%d,%d,%d,%d)", __FUNCTION__,src->id,pSrcRect->x,pSrcRect->y, |
|---|
| 702 | pSrcRect->width,pSrcRect->height,pDstRect->x,pDstRect->y,pDstRect->width,pDstRect->height)); |
|---|
| 703 | |
|---|
| 704 | bgfx_blit_rect(&src->surf,hWinLibHandle->p_osd_surf,pSrcRect->x,pSrcRect->y,pDstRect->x,pDstRect->y,pSrcRect->width,pSrcRect->height); |
|---|
| 705 | |
|---|
| 706 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 707 | |
|---|
| 708 | } |
|---|
| 709 | |
|---|
| 710 | /* |
|---|
| 711 | ** For use when the CC library is managing the framebuffer direclty. |
|---|
| 712 | ** Look in the routine "BCCGFX_P_RedrawScreen()" to see how this is used. |
|---|
| 713 | */ |
|---|
| 714 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_FillFrameBuffer( |
|---|
| 715 | BCCGFX_WINLIB_P_Handle hWinLibHandle, |
|---|
| 716 | const BCCGFX_WINLIB_P_Rect *rect, |
|---|
| 717 | uint32_t color |
|---|
| 718 | ) |
|---|
| 719 | { |
|---|
| 720 | BDCC_ASSERT(hWinLibHandle); |
|---|
| 721 | BDCC_DBG_MSG(("%s (%d,%d,%d,%d)", __FUNCTION__,rect->x,rect->y,rect->width,rect->height)); |
|---|
| 722 | |
|---|
| 723 | bgfx_fill_rect(hWinLibHandle->p_osd_surf,rect->x,rect->y,rect->width,rect->height,color); |
|---|
| 724 | |
|---|
| 725 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 726 | |
|---|
| 727 | } |
|---|
| 728 | |
|---|
| 729 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_RedrawScreen(BCCGFX_WINLIB_P_Handle hWinLibHandle ) |
|---|
| 730 | { |
|---|
| 731 | BDCC_ASSERT(hWinLibHandle); |
|---|
| 732 | BDCC_DBG_MSG(("%s", __FUNCTION__)); |
|---|
| 733 | |
|---|
| 734 | bgfx_fill_rect(hWinLibHandle->p_osd_surf,0,0,hWinLibHandle->p_osd_surf->surface.width,hWinLibHandle->p_osd_surf->surface.height,0); |
|---|
| 735 | BCCGFX_WINLIB_Sync(hWinLibHandle); |
|---|
| 736 | hWinLibHandle->update_cb(hWinLibHandle->p_app, eGRAPHICS_BOTH); |
|---|
| 737 | |
|---|
| 738 | return BCCGFX_WINLIB_P_SUCCESS; |
|---|
| 739 | } |
|---|
| 740 | |
|---|
| 741 | int BDCC_WINLIB_P_GetActiveWindowSettings(BCCGFX_WINLIB_P_Handle phWinLibHandle, unsigned int *colors, unsigned int *style) |
|---|
| 742 | { |
|---|
| 743 | BCCGFX_WINLIB_P_hWin win, win_parent, win_flash; /* which is pointer of BCCGFX_WINLIB_P_Window */ |
|---|
| 744 | |
|---|
| 745 | win_parent = win_flash = NULL; |
|---|
| 746 | |
|---|
| 747 | for (win = (BCCGFX_WINLIB_P_hWin)LHEAD(&(phWinLibHandle->surf_list)); win != NULL; win = (BCCGFX_WINLIB_P_hWin)LNEXT(win)) |
|---|
| 748 | { |
|---|
| 749 | if(win->zorder == 0) |
|---|
| 750 | { |
|---|
| 751 | if (win->show == false && (win->ForeGroundColor||win->BackGroundColor)) |
|---|
| 752 | { |
|---|
| 753 | if(win_parent == NULL) |
|---|
| 754 | win_parent = win; |
|---|
| 755 | else{ |
|---|
| 756 | win_flash = win; |
|---|
| 757 | break; |
|---|
| 758 | } |
|---|
| 759 | } |
|---|
| 760 | } |
|---|
| 761 | } |
|---|
| 762 | |
|---|
| 763 | if(win_parent && win_flash) |
|---|
| 764 | { |
|---|
| 765 | colors[0] = win_parent->ForeGroundColor; |
|---|
| 766 | colors[1] = win_parent->BackGroundColor; |
|---|
| 767 | colors[2] = win_parent->EdgeColor; |
|---|
| 768 | |
|---|
| 769 | *style = (win_parent->EdgeType<<8); |
|---|
| 770 | if (win_parent->italics) *style |= 0x01; |
|---|
| 771 | else if (win_parent->underline) *style |= 0x02; |
|---|
| 772 | if (win_parent->ForeGroundColor != win_flash->ForeGroundColor) *style |= 0x04; |
|---|
| 773 | if (win_parent->BackGroundColor != win_flash->BackGroundColor) *style |= 0x08; |
|---|
| 774 | return 1; |
|---|
| 775 | } |
|---|
| 776 | return 0; |
|---|
| 777 | } |
|---|
| 778 | |
|---|
| 779 | int BCCGFX_WINLIB_GetWideAspectRatio(BCCGFX_WINLIB_P_Handle hWinLibHandle) |
|---|
| 780 | { |
|---|
| 781 | BDCC_ASSERT(hWinLibHandle); |
|---|
| 782 | |
|---|
| 783 | if (hWinLibHandle->wide_aspect_ratio_cb) |
|---|
| 784 | return hWinLibHandle->wide_aspect_ratio_cb(); |
|---|
| 785 | |
|---|
| 786 | /* default not wide_aspect_ratio */ |
|---|
| 787 | return 0; |
|---|
| 788 | } |
|---|
| 789 | |
|---|