?? gfx_drawcontrol.c.svn-base
字號(hào):
// setup X surface status = SetInputSurface(pRua, mainmode, g_bitmaps[0].pBmpAddr, g_bitmaps[0].bmp.uiWidth, GFX_SURFACE_ID_X); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); // setup Y surface status = SetInputSurface(pRua, mainmode, g_bitmaps[bmpindex].pBmpAddr, g_bitmaps[bmpindex].bmp.uiWidth, GFX_SURFACE_ID_Y); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); blend_param.Src1X = rect->x; // YZ blend_param.Src1Y = rect->y; blend_param.Src2X = x; // X blend_param.Src2Y = y; blend_param.DstX = x; blend_param.DstY = y; blend_param.Width = rect->width; blend_param.Height = rect->height; blend_param.SaturateAlpha = FALSE; status = GFXBlendRectanglesProperty(pRua, &blend_param); return RM_OK;}RMstatus DrawBitmapRecktBlendBack(struct RUA *pRua, RMuint16 x, RMuint16 y, GFXLib_rect *rect, RMuint32 transparentcolor, RMbool usetransparentcolor, RMuint8 bmpindex){ RMstatus status = RM_OK; RMbool hasPalette; struct GFXEngine_MoveReplaceRectangle_type move_param; struct GFXEngine_BlendRectangles_type blend_param; RMuint32 mainmode; RMuint8 alpha = 0xff; if (g_bitmaps[bmpindex].path[0] == 0) { // printf("SKIPPING BACKGROUND!!!!!!!!!!!!!!!!!!!!!!\n"); return RM_ERROR; } hasPalette = (g_bitmaps[bmpindex].bmp.uiNbBitPerPixel <= 8); // setup input Y surface // set transparency g_bitmaps[bmpindex].transparentcolor = transparentcolor; g_bitmaps[bmpindex].usetransparentcolor = usetransparentcolor; // fill the palette if (hasPalette) SetPalette(pRua, alpha, bmpindex, GFX_SURFACE_ID_Y); // color format switch (g_bitmaps[bmpindex].bmp.uiNbBitPerPixel) { case 1: mainmode = EMhwlibColorMode_LUT_1BPP; break; case 2: mainmode = EMhwlibColorMode_LUT_2BPP; break; case 4: mainmode = EMhwlibColorMode_LUT_4BPP; break; case 8: mainmode = EMhwlibColorMode_LUT_8BPP; break; default: mainmode = EMhwlibColorMode_TrueColor; break; } if (bmpindex == 0 || g_bitmaps[0].pBmpAddr == 0 || usetransparentcolor) { RMASSERT(g_bitmaps[bmpindex].pBmpAddr != 0); status = SetInputSurface(pRua, mainmode, g_bitmaps[bmpindex].pBmpAddr, g_bitmaps[bmpindex].bmp.uiWidth, GFX_SURFACE_ID_Y); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); move_param.SrcX = rect->x; move_param.SrcY = rect->y; move_param.AlphaX = 0; move_param.AlphaY = 0; move_param.DstX = x; move_param.DstY = y; move_param.Width = rect->width; move_param.Height = rect->height; move_param.Merge = FALSE; status = GFXReplaceRectangleProperty(pRua, &move_param); return RM_OK; } // setup X surface status = SetInputSurface(pRua, mainmode, gdata.backBuffer.baseAddr, g_bitmaps[0].bmp.uiWidth, GFX_SURFACE_ID_X); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); // setup Y surface status = SetInputSurface(pRua, mainmode, g_bitmaps[bmpindex].pBmpAddr, g_bitmaps[bmpindex].bmp.uiWidth, GFX_SURFACE_ID_Y); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); blend_param.Src1X = rect->x; // YZ blend_param.Src1Y = rect->y; blend_param.Src2X = x; // X blend_param.Src2Y = y; blend_param.DstX = x; blend_param.DstY = y; blend_param.Width = rect->width; blend_param.Height = rect->height; blend_param.SaturateAlpha = FALSE; status = GFXBlendRectanglesProperty(pRua, &blend_param); return RM_OK;}// [RC] should not work correctly with palettized bitmaps because palettes and color modes// are not set correctly on the first blendRMstatus BlendBitmapRect(struct RUA *pRua, RMuint16 x, RMuint16 y, GFXLib_rect *rect, RMuint32 transparentcolor, RMbool usetransparentcolor, RMuint8 bmpindex, RMuint16 x2, RMuint16 y2, RMuint8 bmpindex2){ RMstatus status = RM_OK; RMbool hasPalette; struct GFXEngine_MoveReplaceRectangle_type move_param; struct GFXEngine_BlendRectangles_type blend_param; RMuint8 alpha = 0xff; RMuint32 mainmode; hasPalette = (g_bitmaps[bmpindex].bmp.uiNbBitPerPixel <= 8); // setup input Y surface // set transparency g_bitmaps[bmpindex].transparentcolor = transparentcolor; g_bitmaps[bmpindex].usetransparentcolor = usetransparentcolor; // fill the palette if (hasPalette) SetPalette(pRua, alpha, bmpindex, GFX_SURFACE_ID_Y); // color format switch (g_bitmaps[bmpindex].bmp.uiNbBitPerPixel) { case 1: mainmode = EMhwlibColorMode_LUT_1BPP; break; case 2: mainmode = EMhwlibColorMode_LUT_2BPP; break; case 4: mainmode = EMhwlibColorMode_LUT_4BPP; break; case 8: mainmode = EMhwlibColorMode_LUT_8BPP; break; default: mainmode = EMhwlibColorMode_TrueColor; break; } if (bmpindex == 0 || g_bitmaps[0].pBmpAddr == 0 || usetransparentcolor) { RMASSERT(g_bitmaps[bmpindex].pBmpAddr != 0); status = SetInputSurface(pRua, mainmode, g_bitmaps[bmpindex].pBmpAddr, g_bitmaps[bmpindex].bmp.uiWidth, GFX_SURFACE_ID_Y); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); move_param.SrcX = rect->x; move_param.SrcY = rect->y; move_param.AlphaX = 0; move_param.AlphaY = 0; move_param.DstX = x; move_param.DstY = y; move_param.Width = rect->width; move_param.Height = rect->height; move_param.Merge = FALSE; status = GFXReplaceRectangleProperty(pRua, &move_param); return RM_OK; } // setup X surface status = SetInputSurface(pRua, mainmode, g_bitmaps[bmpindex].pBmpAddr, g_bitmaps[bmpindex].bmp.uiWidth, GFX_SURFACE_ID_X); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); // setup Y surface status = SetInputSurface(pRua, mainmode, g_bitmaps[bmpindex2].pBmpAddr, g_bitmaps[bmpindex2].bmp.uiWidth, GFX_SURFACE_ID_Y); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); // printf("src1x (%d), src1y (%d), src2x (%ld), src2y (%ld), dst.x (%d), dst.y (%d), w (%ld), h (%ld)\n", // x2 , y2 , rect->x, rect->y, x, y, rect->width, rect->height); blend_param.Src1X = x2; // YZ blend_param.Src1Y = y2; blend_param.Src2X = rect->x; // X blend_param.Src2Y = rect->y; blend_param.DstX = x; blend_param.DstY = y; blend_param.Width = rect->width; blend_param.Height = rect->height; blend_param.SaturateAlpha = FALSE; status = GFXBlendRectanglesProperty(pRua, &blend_param); // now blend result with background mainmode = EMhwlibColorMode_TrueColor; // setup X surface status = SetInputSurface(pRua, mainmode, g_bitmaps[0].pBmpAddr, g_bitmaps[0].bmp.uiWidth, GFX_SURFACE_ID_X); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); // setup Y surface status = SetInputSurface(pRua, mainmode, gdata.backBuffer.baseAddr, gdata.osdWidth, GFX_SURFACE_ID_Y); if (RMFAILED(status)) RMDBGLOG((GFXDBG, "Error setting surface parameters\n")); // status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); // printf("src1x (%d), src1y (%d), src2x (%ld), src2y (%ld), dst.x (%d), dst.y (%d), w (%ld), h (%ld)\n", // x2 , y2 , rect->x, rect->y, x, y, rect->width, rect->height); blend_param.Src1X = x; // YZ blend_param.Src1Y = y; blend_param.Src2X = x; // X blend_param.Src2Y = y; blend_param.DstX = x; blend_param.DstY = y; blend_param.Width = rect->width; blend_param.Height = rect->height; blend_param.SaturateAlpha = FALSE; status = GFXBlendRectanglesProperty(pRua, &blend_param); return RM_OK;}RMstatus DrawPageRect(struct RUA *pRua, RMPageObject *obj, GFXLib_rect *rect){ RMstatus status = RM_OK; if (obj != NULL) { status = LoadPageBackground(pRua, obj->file); if (RMFAILED(status)) return status; } return DrawBitmapRect(pRua, rect->x, rect->y, rect, 0, 0, 0);}RMstatus BlankRect(struct RUA *pRua, GFXLib_rect *rect){ return Fill(pRua, rect->x, rect->y, rect->width, rect->height, 0x00FFFFFF);}// images stored at index 0 (beginning of allocated memory)static RMstatus DrawPictureOSDScaled(struct RUA *pRua, GFXLib_scaletype stype){ RMstatus status; RMuint16 x, y; if (g_bitmaps[0].pBmpAddr == 0) return RM_ERROR; status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); if (RMFAILED(status)) return status; if (g_bitmaps[0].bmp.uiWidth > gdata.osdWidth || g_bitmaps[0].bmp.uiHeight > gdata.osdHeight) return RM_ERROR; if (stype == SCALE_NONE) { x = (gdata.osdWidth - g_bitmaps[0].bmp.uiWidth) / 2; y = (gdata.osdHeight - g_bitmaps[0].bmp.uiHeight) / 2; } else { // not scale if smaller than 1/3 of the display if ((g_bitmaps[0].bmp.uiWidth < (gdata.osdWidth / 3)) || (g_bitmaps[0].bmp.uiHeight < (gdata.osdHeight / 3))) { x = (gdata.osdWidth - g_bitmaps[0].bmp.uiWidth) / 2; y = (gdata.osdHeight - g_bitmaps[0].bmp.uiHeight) / 2; } else { // [RC] NEED TO WORK ON KEEPING THE ASPECT RATIO!!!!!!!!!!!!!!!!!!!!!! x = y = 0; if (g_bitmaps[0].bmp.uiWidth != gdata.osdWidth && g_bitmaps[0].bmp.uiHeight != gdata.osdHeight) { DoScaling(pRua, x, y, g_bitmaps[0].bmp.uiWidth, g_bitmaps[0].bmp.uiHeight); } } } DrawBitmap(pRua, x, y, 0, 0, 0xff, 0, FALSE, 0); return BitBlt(pRua);}// images stored at index 0 (beginning of allocated memory)RMstatus DrawPicture(struct RUA *pRua, GFXLib_scaletype stype){ RMstatus status; RMuint32 x, y; RMuint32 width, height; RMuint32 mainmode; struct GFXEngine_MoveReplaceScaleRectangle_type move_param; RMuint16 displayW = gdata.osdWidth - 2 * PICTURE_DISPLAY_OFFSET; RMuint16 displayH = gdata.osdHeight - 2 * PICTURE_DISPLAY_OFFSET; // use OSD scaler to draw -- forced or > 1024 due to gfx scaler limitation if (stype == SCALE_FULLSCREEN_OSD || g_bitmaps[0].bmp.uiWidth > 1024) return DrawPictureOSDScaled(pRua, stype); if (g_bitmaps[0].pBmpAddr == 0) return RM_ERROR; status = SetOutputSurfaceBuffer(pRua, gdata.backBuffer.baseAddr, gdata.osdWidth); if (RMFAILED(status)) return status; if (g_bitmaps[0].bmp.uiWidth > gdata.osdWidth || g_bitmaps[0].bmp.uiHeight > gdata.osdHeight) return RM_ERROR; // default output size to actual size width = gdata.osdWidth; height = gdata.osdHeight; if (stype == SCALE_NONE) { x = (gdata.osdWidth - g_bitmaps[0].bmp.uiWidth) / 2; y = (gdata.osdHeight - g_bitmaps[0].bmp.uiHeight) / 2; } else { if ((g_bitmaps[0].bmp.uiWidth <= (gdata.osdWidth / 3)) && (g_bitmaps[0].bmp.uiHeight <= (gdata.osdHeight / 3))) { // scale to double if smaller than a third of the osd width = g_bitmaps[0].bmp.uiWidth * 2; height = g_bitmaps[0].bmp.uiHeight * 2; x = (gdata.osdWidth - width) / 2; y = (gdata.osdHeight - height) / 2; } else if (g_bitmaps[0].bmp.uiWidth >= g_bitmaps[0].bmp.uiHeight) { // scale width to osdwidth and height accordingly to keep ratio width = displayW; height = (displayW * g_bitmaps[0].bmp.uiHeight) / g_bitmaps[0].bmp.uiWidth; if (height > displayH) height = displayH; x = PICTURE_DISPLAY_OFFSET; y = (gdata.osdHeight - height) / 2; } else { // scale height to osdheight and width accordingly to keep ratio width = (displayH * g_bitmaps[0].bmp.uiWidth) / g_bitmaps[0].bmp.uiHeight; if (width > displayW) width = displayW; height = displayH; x = (gdata.osdWidth - width) / 2; y = PICTURE_DISPLAY_OFFSET; } } // color format & palette switch (g_bitmaps[0].bmp.uiNbBitPerPixel) { case 1: mainmode = EMhwlibColorMode_LUT_1BPP; break; case 2: mainmode = EMhwlibColorMode_LUT_2BPP; break; case 4: mainmode = EMhwlibColorMode_LUT_4BPP; break; case 8: mainmode = EMhwlibColorMode_LUT_8BPP; break; default: mainmode = EMhwlibColorMode_TrueColor; break; } if (g_bitmaps[0].bmp.uiNbBitPerPixel <= 8) { SetPalette(pRua, 0xff, 0, GFX_SURFACE_ID_Z); } status = SetInputSurface(pRua, mainmode, g_bitmaps[0].pBmpAddr, g_bitmaps[0].bmp.uiWidth, GFX_SURFACE_ID_Z); if (RMFAILED(status)) return status; // printf("DrawPicture: source: (%d, %d)\n", g_bitmaps[0].bmp.uiWidth, g_bitmaps[0].bmp.uiHeight); // printf("DrawPicture: destination: (%ld, %ld, %ld, %ld)\n", x, y, width, height); move_param.SrcX = 0; move_param.SrcY = 0; move_param.SrcWidth = g_bitmaps[0].bmp.uiWidth; move_param.SrcHeight = g_bitmaps[0].bmp.uiHeight; move_param.DstX = x; move_param.DstY = y; move_param.DstWidth = width; move_param.DstHeight = height; move_param.AlphaX = 0; move_param.AlphaY = 0; move_param.Merge = FALSE; // printf("painting and scaling rectangle!!!!!!!!!!!!!!!!!!!!\n"); GFXMoveAndScaleRectangleProperty(pRua, &move_param); return BitBlt(pRua);}#define ABS(N) N >= 0 ? (N) : (N) * -1RMstatus ScrolSubList(struct RUA *pRua, RMBitmapObject *bkgnd, RMListObject *obj, RMListItemObject **items, RMuint8 itemcount, RMbool isPage, RMuint16 listitemcount, RMGuiObjectSelectDirection direction){ RMstatus status = RM_OK; RMuint8 /*bmpindex,*/bkgndindex; GFXLib_rect rect, rect2, rctext; Prop prop; RMuint8 itemheight; RMuint16 i; RMuint8 textoffset = 4;// + iconwidth; RMPageObject page; RMuint16 x, y; RMuint8 bmpindex; RMuint8 drawOneMore = 1; RMint16 scrollOffset = 0; RMuint8 step = 8; RMuint64 begin, end; static RMuint64 bigDiff = 0; struct timespec time; prop.trunc = TRUNC_NONE; time.tv_sec = (RMuint32) 0; time.tv_nsec = ((RMuint32) 20000000); if (obj->visible == FA
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -