| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002-2006, 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.h $ |
|---|
| 11 | * $brcm_Revision: 9 $ |
|---|
| 12 | * $brcm_Date: 9/15/06 12:06p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/lib/ccgfx/winlib/bccwinlib.h $ |
|---|
| 19 | * |
|---|
| 20 | * 9 9/15/06 12:06p btosi |
|---|
| 21 | * PR22275: added support for font edges |
|---|
| 22 | * |
|---|
| 23 | * 8 9/12/06 10:15a btosi |
|---|
| 24 | * PR22275: added support for clipping the CC window to the framebuffer |
|---|
| 25 | * |
|---|
| 26 | * 7 8/17/06 1:12p btosi |
|---|
| 27 | * PR22275: modifications to support dynamically loading/unloading fonts |
|---|
| 28 | * |
|---|
| 29 | * 6 7/27/06 9:41a btosi |
|---|
| 30 | * PR22275: cleaned up scrolling logic, added support for managing the |
|---|
| 31 | * framebuffer directly |
|---|
| 32 | * |
|---|
| 33 | * 5 7/7/06 12:32p btosi |
|---|
| 34 | * PR22275: added logic to redraw the framebuffer less frequently |
|---|
| 35 | * |
|---|
| 36 | * 4 5/24/06 6:45p shyam |
|---|
| 37 | * PR 8365 : Reorganized calls depending on the gfx sub-system (removed |
|---|
| 38 | * init) |
|---|
| 39 | * |
|---|
| 40 | * 3 5/17/05 7:49p shyam |
|---|
| 41 | * PR 8365 : Making it work at runtime |
|---|
| 42 | * |
|---|
| 43 | ***************************************************************************/ |
|---|
| 44 | |
|---|
| 45 | #ifndef BCCWINLIB_H |
|---|
| 46 | #define BCCWINLIB_H |
|---|
| 47 | |
|---|
| 48 | #include "bsettop.h" |
|---|
| 49 | #include "bdcc.h" |
|---|
| 50 | #include "bdcc_kernel.h" |
|---|
| 51 | |
|---|
| 52 | #ifdef CONFIG_GFX_ARGB32 |
|---|
| 53 | /* data is from g_eia708_palette */ |
|---|
| 54 | #define DCCGFX_COLOR_CLEAR 0x00000000 |
|---|
| 55 | #define DCCGFX_COLOR_BLACK 0xff000000 |
|---|
| 56 | #define DCCGFX_COLOR_WHITE 0xff7e7e7e |
|---|
| 57 | #define DCCGFX_COLOR_RED 0xff7d00ff |
|---|
| 58 | #define DCCGFX_COLOR_GREEN 0xff007f00 |
|---|
| 59 | #define DCCGFX_COLOR_BLUE 0xffff007c |
|---|
| 60 | #define DCCGFX_COLOR_YELLOW 0xff7e7eff |
|---|
| 61 | #define DCCGFX_COLOR_MAGENTA 0xff7d007d |
|---|
| 62 | #define DCCGFX_COLOR_CYAN 0xff007e7c |
|---|
| 63 | #define DCCGFX_COLOR_TL_BLACK 0x5f000000 |
|---|
| 64 | #define DCCGFX_COLOR_TL_WHITE 0x5f7e7e7e |
|---|
| 65 | #define DCCGFX_COLOR_TL_RED 0x5f7d00ff |
|---|
| 66 | #define DCCGFX_COLOR_TL_GREEN 0x5f007f00 |
|---|
| 67 | #define DCCGFX_COLOR_TL_BLUE 0x5fff007c |
|---|
| 68 | #define DCCGFX_COLOR_TL_YELLOW 0x5f7e7eff |
|---|
| 69 | #define DCCGFX_COLOR_TL_MAGENTA 0x5f7d007d |
|---|
| 70 | #else |
|---|
| 71 | #define DCCGFX_COLOR_CLEAR 0 |
|---|
| 72 | #define DCCGFX_COLOR_BLACK 1 |
|---|
| 73 | #define DCCGFX_COLOR_WHITE 2 |
|---|
| 74 | #define DCCGFX_COLOR_RED 3 |
|---|
| 75 | #define DCCGFX_COLOR_GREEN 4 |
|---|
| 76 | #define DCCGFX_COLOR_BLUE 5 |
|---|
| 77 | #define DCCGFX_COLOR_YELLOW 6 |
|---|
| 78 | #define DCCGFX_COLOR_MAGENTA 7 |
|---|
| 79 | #define DCCGFX_COLOR_CYAN 8 |
|---|
| 80 | #define DCCGFX_COLOR_TL_BLACK 9 |
|---|
| 81 | #define DCCGFX_COLOR_TL_WHITE 10 |
|---|
| 82 | #define DCCGFX_COLOR_TL_RED 11 |
|---|
| 83 | #define DCCGFX_COLOR_TL_GREEN 12 |
|---|
| 84 | #define DCCGFX_COLOR_TL_BLUE 13 |
|---|
| 85 | #define DCCGFX_COLOR_TL_YELLOW 14 |
|---|
| 86 | #define DCCGFX_COLOR_TL_MAGENTA 15 |
|---|
| 87 | #endif |
|---|
| 88 | |
|---|
| 89 | /* For 4:3 display */ |
|---|
| 90 | #define DCCGFX_MAX_CELL_WIDTH 20 |
|---|
| 91 | #define DCCGFX_MAX_CELL_HEIGHT 28 |
|---|
| 92 | #define BDCC_Max_Edge_Width 5 |
|---|
| 93 | |
|---|
| 94 | #define CCGFX_NUM_WNDS 8 |
|---|
| 95 | |
|---|
| 96 | #ifdef __cplusplus |
|---|
| 97 | extern "C" { |
|---|
| 98 | #endif |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | typedef void (*bccgfx_update_cb_t)(void * data, int param); |
|---|
| 102 | |
|---|
| 103 | /* get wide_aspect_ratio so that we can decide anchor point based on wide_aspect_ratio from Closed Caption descriptor */ |
|---|
| 104 | typedef int (*bccgfx_get_wide_aspect_ratio_cb_t)(void); |
|---|
| 105 | |
|---|
| 106 | /*************************************************************************** |
|---|
| 107 | Summary: |
|---|
| 108 | The CCGfx handle to the CCGfx object |
|---|
| 109 | |
|---|
| 110 | Description: |
|---|
| 111 | The CCGfx handle to the CCGfx object |
|---|
| 112 | |
|---|
| 113 | See Also: |
|---|
| 114 | |
|---|
| 115 | ****************************************************************************/ |
|---|
| 116 | typedef struct BCCGFX_WINLIB_P_Object *BCCGFX_WINLIB_P_Handle; |
|---|
| 117 | |
|---|
| 118 | /*************************************************************************** |
|---|
| 119 | Summary: |
|---|
| 120 | The CCGfx handle to the CCGfx window |
|---|
| 121 | |
|---|
| 122 | Description: |
|---|
| 123 | The CCGfx handle to the CCGfx window |
|---|
| 124 | |
|---|
| 125 | See Also: |
|---|
| 126 | |
|---|
| 127 | ****************************************************************************/ |
|---|
| 128 | typedef struct BCCGFX_WINLIB_P_Window *BCCGFX_WINLIB_P_hWin; |
|---|
| 129 | |
|---|
| 130 | /*************************************************************************** |
|---|
| 131 | Summary: |
|---|
| 132 | The CCGfx handle to the CCGfx window font |
|---|
| 133 | |
|---|
| 134 | Description: |
|---|
| 135 | The CCGfx handle to the CCGfx window font |
|---|
| 136 | |
|---|
| 137 | See Also: |
|---|
| 138 | |
|---|
| 139 | ****************************************************************************/ |
|---|
| 140 | typedef struct BCCGFX_WINLIB_P_FontInfo *BCCGFX_WINLIB_P_Font; |
|---|
| 141 | |
|---|
| 142 | /*************************************************************************** |
|---|
| 143 | Summary: |
|---|
| 144 | The CCGfx Errors |
|---|
| 145 | |
|---|
| 146 | Description: |
|---|
| 147 | The CCGfx Errors |
|---|
| 148 | |
|---|
| 149 | See Also: |
|---|
| 150 | |
|---|
| 151 | ****************************************************************************/ |
|---|
| 152 | typedef enum BCCGFX_WINLIB_P_ErrCode |
|---|
| 153 | { |
|---|
| 154 | BCCGFX_WINLIB_P_SUCCESS, |
|---|
| 155 | BCCGFX_WINLIB_P_ERROR_NO_MEMORY |
|---|
| 156 | } BCCGFX_WINLIB_P_ErrCode; |
|---|
| 157 | |
|---|
| 158 | /*************************************************************************** |
|---|
| 159 | Summary: |
|---|
| 160 | The CCGfx rectangle |
|---|
| 161 | |
|---|
| 162 | Description: |
|---|
| 163 | The CCGfx rectangle |
|---|
| 164 | |
|---|
| 165 | See Also: |
|---|
| 166 | |
|---|
| 167 | ****************************************************************************/ |
|---|
| 168 | typedef struct BCCGFX_WINLIB_P_Rect |
|---|
| 169 | { |
|---|
| 170 | int x; /* can be < 0 */ |
|---|
| 171 | int y; /* can be < 0 */ |
|---|
| 172 | int width; |
|---|
| 173 | int height; |
|---|
| 174 | } BCCGFX_WINLIB_P_Rect; |
|---|
| 175 | |
|---|
| 176 | typedef struct BCCGFX_WINLIB_P_FrameBufferSettings |
|---|
| 177 | { |
|---|
| 178 | int iWidth; |
|---|
| 179 | int iHeight; |
|---|
| 180 | |
|---|
| 181 | } BCCGFX_WINLIB_P_FrameBufferSettings; |
|---|
| 182 | |
|---|
| 183 | typedef struct BCCGFX_WINLIB_P_SurfaceSettings |
|---|
| 184 | { |
|---|
| 185 | int iWidth; |
|---|
| 186 | int iHeight; |
|---|
| 187 | |
|---|
| 188 | } BCCGFX_WINLIB_P_SurfaceSettings; |
|---|
| 189 | |
|---|
| 190 | /* Removed Init call and put it in bccwinlib_plat.h as it uses settopapi |
|---|
| 191 | * handles, other platforms may have their own handles and implementation */ |
|---|
| 192 | |
|---|
| 193 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_OpenWindow(BCCGFX_WINLIB_P_Handle hWinLibHandle, |
|---|
| 194 | BCCGFX_WINLIB_P_hWin *win, |
|---|
| 195 | uint32_t width, uint32_t height); |
|---|
| 196 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_CloseWindow(BCCGFX_WINLIB_P_hWin win); |
|---|
| 197 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetZorder(BCCGFX_WINLIB_P_hWin win, int zorder); |
|---|
| 198 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Show(BCCGFX_WINLIB_P_hWin win); |
|---|
| 199 | bool BCCGFX_WINLIB_P_IsShown(BCCGFX_WINLIB_P_hWin win); |
|---|
| 200 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Hide(BCCGFX_WINLIB_P_hWin win); |
|---|
| 201 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetPosition(BCCGFX_WINLIB_P_hWin win, uint32_t x, uint32_t y); |
|---|
| 202 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetPenPosition(BCCGFX_WINLIB_P_hWin win, uint32_t *px, uint32_t *py); |
|---|
| 203 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetPenPosition(BCCGFX_WINLIB_P_hWin win, uint32_t x, uint32_t y); |
|---|
| 204 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetForegroundColor(BCCGFX_WINLIB_P_hWin win, uint32_t ForeGroundColor); |
|---|
| 205 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetBackgroundColor(BCCGFX_WINLIB_P_hWin win, uint32_t BackGroundColor); |
|---|
| 206 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetEdgeColor(BCCGFX_WINLIB_P_hWin win, uint32_t EdgeColor); |
|---|
| 207 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetEdgeType(BCCGFX_WINLIB_P_hWin win, BDCC_Edge EdgeType ); |
|---|
| 208 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetEdgeWidth(BCCGFX_WINLIB_P_hWin win, uint32_t EdgeWidth ); |
|---|
| 209 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_FillRect(BCCGFX_WINLIB_P_hWin win, const BCCGFX_WINLIB_P_Rect *rect, uint32_t color); |
|---|
| 210 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetViewRect(BCCGFX_WINLIB_P_hWin win, const BCCGFX_WINLIB_P_Rect *pRect); |
|---|
| 211 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetRect(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Rect *pRect); |
|---|
| 212 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_LoadFont(BCCGFX_WINLIB_P_Handle hWinLibHandle, const char *pFontFile, int iFontSize, BCCGFX_WINLIB_P_Font *phFont); |
|---|
| 213 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetFont(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Font hFont, |
|---|
| 214 | int italics, int underline); |
|---|
| 215 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetFontHandle(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Font *pFontHandle ); |
|---|
| 216 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_DrawString(BCCGFX_WINLIB_P_hWin win, const char *str); |
|---|
| 217 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_Copy(BCCGFX_WINLIB_P_hWin src, BCCGFX_WINLIB_P_hWin dst, |
|---|
| 218 | const BCCGFX_WINLIB_P_Rect *pSrcRect, |
|---|
| 219 | const BCCGFX_WINLIB_P_Rect *pDstRect |
|---|
| 220 | ); |
|---|
| 221 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_DrawHLine( |
|---|
| 222 | BCCGFX_WINLIB_P_hWin win, uint32_t x, uint32_t y, uint32_t wide, uint32_t length, uint32_t FgColor); |
|---|
| 223 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetGlyphMetrics( BCCGFX_WINLIB_P_Font hFont, const char ch, int *pWidth, int * pHeight ); |
|---|
| 224 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_UnloadFont(BCCGFX_WINLIB_P_Font font); |
|---|
| 225 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_RedrawScreen(BCCGFX_WINLIB_P_Handle win); |
|---|
| 226 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_FillFrameBuffer(BCCGFX_WINLIB_P_Handle hWinLibHandle, const BCCGFX_WINLIB_P_Rect *rect, uint32_t color ); |
|---|
| 227 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_CopyToFrameBuffer( BCCGFX_WINLIB_P_hWin src, BCCGFX_WINLIB_P_Handle hWinLibHandle, const BCCGFX_WINLIB_P_Rect *pSrcRect, const BCCGFX_WINLIB_P_Rect *pDstRect ); |
|---|
| 228 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetRect(BCCGFX_WINLIB_P_hWin win, BCCGFX_WINLIB_P_Rect *pRect ); |
|---|
| 229 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetFrameBufferSettings(BCCGFX_WINLIB_P_Handle hWinLibHandle, BCCGFX_WINLIB_P_FrameBufferSettings * pSettings ); |
|---|
| 230 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_GetSurfaceSettings( BCCGFX_WINLIB_P_hWin pSurface, BCCGFX_WINLIB_P_SurfaceSettings * pSettings ); |
|---|
| 231 | BCCGFX_WINLIB_P_ErrCode BCCGFX_WINLIB_P_SetClipState(BCCGFX_WINLIB_P_hWin win, bool bClipState ); |
|---|
| 232 | bool BCCGFX_WINLIB_P_GetClipState(BCCGFX_WINLIB_P_hWin win ); |
|---|
| 233 | int BDCC_WINLIB_P_GetActiveWindowSettings(BCCGFX_WINLIB_P_Handle phWinLibHandle, unsigned int *colors, unsigned int *style); |
|---|
| 234 | |
|---|
| 235 | int BCCGFX_WINLIB_GetWideAspectRatio(BCCGFX_WINLIB_P_Handle hWinLibHandle); |
|---|
| 236 | |
|---|
| 237 | #ifdef __cplusplus |
|---|
| 238 | } |
|---|
| 239 | #endif |
|---|
| 240 | |
|---|
| 241 | #endif /* BCCWINLIB_H */ |
|---|
| 242 | |
|---|