/********************************************************************* * * _LCDBench */ static void _LCDBench(void) { GUI_POINT Point; float aPixelrateBitmap[5] = {0, 0, 0, 0, 0}; float PixelrateBigFont; float PixelrateF6x8; float FillratePPS; char * s; char ac[80]; int BitsPerPixel; int xSizeString; int ySizeFont; int NumColors; int MirrorX; int MirrorY; int SwapXY; int xSize; int ySize; BitsPerPixel = LCD_GetBitsPerPixelEx(0); xSize = LCD_GetXSizeEx(0); ySize = LCD_GetYSizeEx(0); MirrorX = LCD_GetMirrorXEx(0); MirrorY = LCD_GetMirrorYEx(0); SwapXY = LCD_GetSwapXYEx(0); NumColors = (1 << BitsPerPixel); _InitXbppDDP(); // // Say hi ! // GUI_X_Log("\nLCD driver benchmark. All values are \xb5""s/pixel"); GUI_X_Log("\nLower values are better."); GUI_SetBkColor(GUI_RED); GUI_SetColor(GUI_WHITE); GUI_Clear(); GUI_SetFont(&GUI_FontComic18B_1); GUI_DispStringHCenterAt("LCD driver", xSize / 2, ySize / 3 - 10); GUI_DispStringHCenterAt("Benchmark" , xSize / 2, ySize / 3 + 20); GUI_Delay(1000); GUI_SetBkColor(GUI_BLACK); GUI_Clear(); GUI_SetLBorder(1); // // Log color depth, controller, orientation and cache // sprintf(ac, "\nColor depth: %d", BitsPerPixel); GUI_X_Log(ac); sprintf(ac, "\nOrientation: LCD_MIRROR_X = %d, LCD_MIRROR_Y = %d, LCD_SWAP_XY = %d", MirrorX, MirrorY, SwapXY); GUI_X_Log(ac); // // Measure filling // Point.x = xSize; Point.y = ySize; FillratePPS = _Measure(&_ExecFill, &Point) * (float)(2 * ((U32)xSize - 4) * ((U32)ySize - 4)); sprintf(ac, "\nFill: %f", (float)1E6 / FillratePPS); GUI_X_Log(ac); // // Measure small font // GUI_SetFont(&GUI_Font6x8); s = _acSmall; xSizeString = GUI_GetStringDistX(s); ySizeFont = GUI_GetFontSizeY(); PixelrateF6x8 = _Measure(&_ExecSmallFont, s) * (float)2 * xSizeString * ySizeFont * 8; sprintf(ac, "\nF6x8: %f", (float)1E6 / PixelrateF6x8); GUI_X_Log(ac); // // Measure big font // GUI_SetFont(&GUI_FontComic18B_ASCII); s = _acBig; xSizeString = GUI_GetStringDistX(s); ySizeFont = GUI_GetFontSizeY(); PixelrateBigFont = _Measure(&_ExecBigFont, s) * (float)2 * xSizeString * ySizeFont * 2; sprintf(ac, "\nFBig: %f", (float)1E6 / PixelrateBigFont); GUI_X_Log(ac); // // Measure 1bpp bitmap // aPixelrateBitmap[0] = _Measure(&_Exec1bpp, NULL) * (float)2 * _bm_1bpp_58x8.XSize * 8; sprintf(ac, "\n1bpp: %f", (float)1E6 / aPixelrateBitmap[0]); GUI_X_Log(ac); // // Measure 2bpp bitmap // aPixelrateBitmap[1] = _Measure(&_Exec2bpp, NULL) * (float)2 * _bm_2bpp_32x11.XSize * 11; sprintf(ac, "\n2bpp: %f", (float)1E6 / aPixelrateBitmap[1]); GUI_X_Log(ac); // // Measure 4bpp bitmap // aPixelrateBitmap[2] = _Measure(&_Exec4bpp, NULL) * (float)2 * _bm_4bpp_32x11.XSize * 11; sprintf(ac, "\n4bpp: %f", (float)1E6 / aPixelrateBitmap[2]); GUI_X_Log(ac); // // Measure 8bpp bitmap // aPixelrateBitmap[3] = _Measure(&_Exec8bpp, NULL) * (float)2 * _bm_8bpp_32x11.XSize * 11; sprintf(ac, "\n8bpp: %f", (float)1E6 / aPixelrateBitmap[3]); GUI_X_Log(ac); // // Measure device dependent bitmap // aPixelrateBitmap[4] = _Measure(&_ExecXbppDDP, NULL) * (float)2 * XSIZE_XBPP * YSIZE_XBPP; sprintf(ac, "\nXDDP: %f", (float)1E6 / aPixelrateBitmap[4]); GUI_X_Log(ac); // // Show results on display // GUI_Clear(); if (xSize < 320) { GUI_SetFont(&GUI_Font6x8); } else { GUI_SetFont(&GUI_Font8x16); } GUI_GotoXY(0, 0); GUI_DispDecMin(BitsPerPixel); GUI_DispString(" bpp, "); GUI_DispDecMin(NumColors); GUI_DispString(" colors\n\nMIRROR_X "); GUI_DispDecMin(MirrorX); GUI_DispString(", MIRROR_Y "); GUI_DispDecMin(MirrorY); GUI_DispString(", SWAPXY "); GUI_DispDecMin(SwapXY); GUI_SetLBorder(1); GUI_SetFont(&GUI_Font6x8); GUI_DispChar('\n'); _DispFillrate("\nFill: ", FillratePPS, " Fill"); _DispFillrate("\nF6x8: ", PixelrateF6x8, " F6x8"); _DispFillrate("\nFBig: ", PixelrateBigFont, " FComic18"); _DispFillrate("\n1bpp: ", aPixelrateBitmap[0], " Bitmap 1bpp"); _DispFillrate("\n2bpp: ", aPixelrateBitmap[1], " Bitmap 2bpp"); _DispFillrate("\n4bpp: ", aPixelrateBitmap[2], " Bitmap 4bpp"); _DispFillrate("\n8bpp: ", aPixelrateBitmap[3], " Bitmap 8bpp"); _DispFillrate("\nXDDP: ", aPixelrateBitmap[4], " 8/16bppDDP"); }
/********************************************************************* * * LCDSIM_SaveSBMP */ int LCDSIM_SaveSBMP(const char * sFileName) { return LCDSIM_SaveSBMPEx(sFileName, 0, 0, LCD_GetXSizeEx(GUI_Context.SelLayer), LCD_GetYSizeEx(GUI_Context.SelLayer)); }