51 int left,
int top,
int width,
int height )
53 U32BIT d_width, d_height;
55 d_width = s_bmp->width;
56 d_height = s_bmp->height;
58 if (s_bmp->y_resolution == 5315)
61 if (mg_ctxt.out_osd_height != 1080)
91 d_width *= mg_ctxt.osd_x.mlt * 3;
92 d_width += (mg_ctxt.osd_x.div << 2);
93 d_width /= (mg_ctxt.osd_x.div << 3);
95 d_height *= mg_ctxt.osd_y.mlt << 3;
96 d_height += (mg_ctxt.osd_y.div * 15) >> 1;
97 d_height /= (mg_ctxt.osd_y.div * 15);
100 else if (s_bmp->y_resolution == 3543)
103 if (mg_ctxt.out_osd_height != 720)
106 d_width *= mg_ctxt.osd_x.mlt * 9;
107 d_width += (mg_ctxt.osd_x.div << 3);
108 d_width /= (mg_ctxt.osd_x.div << 4);
110 d_height *= mg_ctxt.osd_y.mlt << 3;
111 d_height += (mg_ctxt.osd_y.div * 5);
112 d_height /= (mg_ctxt.osd_y.div * 10);
117 if (mg_ctxt.out_osd_height != 576)
128 d_width = HD_X_SCALEUP(left + d_width) - HD_X_SCALEUP(left);
129 d_height = HD_Y_SCALEUP(top + d_height) - HD_Y_SCALEUP(top);
133 d_surf->opaque = s_bmp->opaque;
136 d_surf->width = d_width;
137 d_surf->height = d_height;
138 d_surf->buff_pitch = d_width * BytesPerPixel(mg_ctxt.colour_format);
140 s_bmp, &d_surf->buff_pitch );
144 d_surf->width = (((left + width) * mg_ctxt.osd_x.mlt) / mg_ctxt.osd_x.div) -
145 ((left * mg_ctxt.osd_x.mlt) / mg_ctxt.osd_x.div);
146 if (d_surf->width < d_width)
147 d_surf->width = d_width;
148 d_surf->height = (((top + height) * mg_ctxt.osd_y.mlt) / mg_ctxt.osd_y.div) -
149 ((top * mg_ctxt.osd_y.mlt) / mg_ctxt.osd_y.div);
150 if (d_surf->height < d_height)
151 d_surf->height = d_height;
152 d_surf->opaque = s_bmp->opaque;
153 d_surf->buff_pitch = d_surf->width * BytesPerPixel(mg_ctxt.colour_format);
155 s_bmp, &d_surf->buff_pitch );
161 void MG_DrawPng(
void *data,
int len,
MHEG5Visible *visible )
166 assert( visible->graphic_data == NULL );
168 if (data && len && visible->boxSize[0] != 0 && visible->boxSize[1] != 0)
173 TRACE(TGRAPHICS, (
"decode bmp: w=%d h=%d", bmp->width, bmp->height))
174 b_srf = OSD_MemAlloc( sizeof(
S_SURFACE));
177 IF_COL_DEPTH( COLOUR_FORMAT_PALETTE )
180 U32BIT sz = bmp->width * bmp->height;
182 assert( mg_ctxt.osd_y.mlt == mg_ctxt.osd_y.div );
183 b_srf->col_buff = OSD_MemAlloc( sz );
184 if (b_srf->col_buff == NULL)
186 OSD_MemFree( b_srf );
191 b_srf->width = bmp->width;
192 b_srf->height = bmp->height;
193 b_srf->opaque = bmp->opaque;
194 b_srf->srf_type = SRF_TYPE_PNG;
195 b_srf->buff_pitch = bmp->width;
196 b_srf->hw_handle = NULL;
197 memcpy( b_srf->col_buff, bmp->col_buff, sz );
198 TRACE(TGRAPHICS, (
"copied bmp"))
205 #if defined(OSD_16_BIT) || defined(OSD_31_BIT) || defined(OSD_32_BIT) 206 DrawBmpOnSurface( bmp, b_srf, ((
MHEG5Bitmap *) visible)->tiling,
207 visible->position[0], visible->position[1], visible->boxSize[0], visible->boxSize[1] );
208 if (b_srf->hw_handle == NULL)
210 OSD_MemFree( b_srf );
216 OSD_DbgAddSurf( b_srf );
226 if (data != NULL && len > 0)
228 TRACE(TERROR, (
"DEC_DecodePng returned NULL"))
232 visible->graphic_data = b_srf;
236 void MG_DrawJpg(
void *data,
int len,
MHEG5Visible *visible )
238 S_SURFACE *b_srf = 0;
241 if (data && len && visible->boxSize[0] != 0 && visible->boxSize[1] != 0)
246 b_srf = OSD_MemAlloc(
sizeof(S_SURFACE));
249 IF_COL_DEPTH( COLOUR_FORMAT_PALETTE )
252 U32BIT sz = bmp->width * bmp->height;
254 assert( mg_ctxt.osd_y.mlt == mg_ctxt.osd_y.div );
255 b_srf->col_buff = OSD_MemAlloc( sz );
256 if (b_srf->col_buff == NULL)
258 OSD_MemFree( b_srf );
263 b_srf->width = bmp->width;
264 b_srf->height = bmp->height;
265 b_srf->opaque = bmp->opaque;
266 b_srf->srf_type = SRF_TYPE_JPG;
267 b_srf->buff_pitch = bmp->width;
268 b_srf->hw_handle = NULL;
269 memcpy( b_srf->col_buff, bmp->col_buff, sz );
275 #if defined(OSD_16_BIT) || defined(OSD_31_BIT) || defined(OSD_32_BIT) 276 DrawBmpOnSurface( bmp, b_srf, ((
MHEG5Bitmap *) visible)->tiling,
277 visible->position[0], visible->position[1], visible->boxSize[0], visible->boxSize[1] );
278 if (b_srf->hw_handle == NULL)
280 OSD_MemFree( b_srf );
286 OSD_DbgAddSurf( b_srf );
295 visible->graphic_data = b_srf;
301 int left, top, right, bottom;
304 assert( visible->graphic_data != NULL );
306 surf = (S_SURFACE *)visible->graphic_data;
308 if (surf->width == 1 && surf->height == 1 && ((
MHEG5Bitmap *) visible)->tiling)
313 IF_COL_DEPTH( COLOUR_FORMAT_PALETTE )
316 box_col = mg_palette[*((U8BIT *)surf->col_buff)];
319 ELSE IF_COL_DEPTH( COLOUR_FORMAT_ARGB4444 )
323 box_col = (left & 0xf000) << 16 |
324 (left & 0x0f00) << 12 |
325 (left & 0x00f0) << 8 |
326 (left & 0x000f) << 4;
333 #if defined(OSD_31_BIT) || defined(OSD_32_BIT) 340 visible->boxSize[0], visible->boxSize[1], 0, 0, box_col );
342 else if (surf->width != 0 && surf->height != 0)
344 left = (visible->position[0] * mg_ctxt.osd_x.mlt) / mg_ctxt.osd_x.div;
345 top = (visible->position[1] * mg_ctxt.osd_y.mlt) / mg_ctxt.osd_y.div;
347 TRACE(TGRAPHICS, (
"id=%ld left=%d top=%d", visible->ingredient.root.id, left, top))
353 right = visible->position[0] + visible->boxSize[0];
354 right = (right * mg_ctxt.osd_x.mlt) / mg_ctxt.osd_x.div;
355 bottom = visible->position[1] + visible->boxSize[1];
356 bottom = (bottom * mg_ctxt.osd_y.mlt) / mg_ctxt.osd_y.div;
358 TRACE(TGRAPHICS, (
" width=%d height=%d", surf->width, surf->height))
368 left = (visible->rect.left * mg_ctxt.osd_x.mlt) / mg_ctxt.osd_x.div;
371 while (top < bottom);
void DEC_FreeJpg(S_IMAGE *image)
Free memory allocated for JPEG bitmap.
void DEC_FreePng(S_IMAGE *image)
Free memory allocated for PNG bitmap.
S_IMAGE * DEC_DecodeJpg(U8BIT *data, U32BIT size)
Allocate memory for JPEG and decode bitmap To free "S_IMAGE" memory, DEC_FreeJpg will be called...
void MG_DisplayImage(S_SURFACE *data, S_REGION *overlap, S32BIT x, S32BIT y)
Copy the image to the screen buffer.
Module Description: Implement the MHEG5 Bitmap Class. 32 Bitmap Class Defines the behaviour of a two-...
The functions in this file are OPTIONALLY provided by Receiver Platform *.
S_IMAGE * DEC_DecodePng(U8BIT *data, U32BIT size)
Allocate memory for PNG and decode bitmap To free "S_IMAGE" memory, DEC_FreePng will be called...
void MG_OSDdisplayRectangle(S_REGION *overlap, int x, int y, int width, int height, int lineWidth, OSDColor lineColour, OSDColor fillColour)
Draw rectangle.
void * STB_OSDMhegLockBuffer(void *surface, U32BIT *pPitch)
Converts hardware surface handle returned by STB_OSDMhegCreateSurface() to buffer address that the en...
void * DEC_OSDCreateBmpSurf(U32BIT s_width, U32BIT s_height, U32BIT i_width, U32BIT i_height, S_IMAGE *image, U32BIT *pitch)
This creates a hardware surface of size using STB_OSDMhegCreateSurface() with s_width and s_height...
void STB_OSDMhegUnlockBuffer(void *surface)
This function informs HW that MHEG5 is finished writing to the buffer.