MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / ClearScreen

Method ClearScreen

rEFIt_UEFI/libeg/XTheme.cpp:329–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void XTheme::ClearScreen() //and restore background and banner
330{
331 if ( UGAWidth == 0 || UGAHeight == 0 ) {
332 // jief : I had the case where no graphic protocol were availbale. So UGAWidth == 0 && UGAHeight == 0 which panic because Background would be empty.
333 // Background.GetPixelPtr(0, 0) panic on an empty image because there is no pixel at x=0 y=0
334 // test could be "if ( UGAWidth == 0 && UGAHeight == 0 )" (&& instead of ||), but I feel like if one of the dimension is 0, we have a graphic problem.
335 // also, should we implement the case if we are in text mode ?
336 return;
337 }
338 EFI_GRAPHICS_OUTPUT_BLT_PIXEL FirstBannerPixel = MenuBackgroundPixel;
339 if (BanHeight < 2) {
340 BanHeight = ((UGAHeight - (int)(LayoutHeight * Scale)) >> 1);
341 }
342 if (!(HideUIFlags & HIDEUI_FLAG_BANNER)) {
343 //Banner image prepared before
344 if (!Banner.isEmpty()) {
345 FirstBannerPixel = Banner.GetPixel(0,0);
346
347 BannerPlace.Width = Banner.GetWidth();
348 BannerPlace.Height = (BanHeight >= Banner.GetHeight()) ? Banner.GetHeight() : BanHeight;
349 BannerPlace.XPos = BannerPosX;
350 BannerPlace.YPos = BannerPosY;
351 if (!TypeSVG) {
352 // Check if new style placement value was used for banner in theme.plist
353
354 if ((BannerPosX >=0 && BannerPosX <=1000) && (BannerPosY >=0 && BannerPosY <=1000)) {
355 // Check if screen size being used is different from theme origination size.
356 // If yes, then recalculate the placement % value.
357 // This is necessary because screen can be a different size, but banner is not scaled.
358 BannerPlace.XPos = HybridRepositioning(BannerEdgeHorizontal, BannerPosX, BannerPlace.Width, UGAWidth, ThemeDesignWidth );
359 BannerPlace.YPos = HybridRepositioning(BannerEdgeVertical, BannerPosY, BannerPlace.Height, UGAHeight, ThemeDesignHeight);
360 // Check if banner is required to be nudged.
361 BannerPlace.XPos = CalculateNudgePosition(BannerPlace.XPos, BannerNudgeX, Banner.GetWidth(), UGAWidth);
362 BannerPlace.YPos = CalculateNudgePosition(BannerPlace.YPos, BannerNudgeY, Banner.GetHeight(), UGAHeight);
363 // DBG("banner position new style\n");
364 } else {
365 // Use rEFIt default (no placement values speicifed)
366 BannerPlace.XPos = (UGAWidth >= Banner.GetWidth() ) ? (UGAWidth - Banner.GetWidth() ) >> 1 : 0;
367 BannerPlace.YPos = (BanHeight >= Banner.GetHeight()) ? (BanHeight - Banner.GetHeight()) : 0;
368 // DBG("banner position old style\n");
369 }
370 }
371 }
372 }
373 DBG("BannerPlace at Clear Screen [%lld,%lld]\n", BannerPlace.XPos, BannerPlace.YPos);
374 //Then prepare Background from BigBack
375 if (Background.GetWidth() != UGAWidth || Background.GetHeight() != UGAHeight) { // should we type UGAWidth and UGAHeight as UINTN to avoid cast ?
376 // Resolution changed or empty background
377 Background = XImage(UGAWidth, UGAHeight);
378 }
379// now we are sure Background has UGA sizes
380 float BigScale;
381 float BigScaleY;
382 if (!BigBack.isEmpty()) {
383 switch (BackgroundScale) {
384 case imScale:
385 BigScale = (float)UGAWidth/BigBack.GetWidth();
386 BigScaleY = (float)UGAHeight/BigBack.GetHeight();

Callers 15

BootThisFileFunction · 0.80
RefitMainFunction · 0.80
TerminateScreenFunction · 0.80
InitBootScreenFunction · 0.80
QuerySecureBootUserFunction · 0.80
UefiMainFunction · 0.80
ConsoleLoggerStopHistoryFunction · 0.80
ConsoleLoggerSetModeFunction · 0.80
ConsoleLoggerClearScreenFunction · 0.80

Calls 13

HybridRepositioningFunction · 0.85
CalculateNudgePositionFunction · 0.85
EG_RECTClass · 0.85
GetWidthMethod · 0.80
GetHeightMethod · 0.80
CopyScaledMethod · 0.80
CopyRectMethod · 0.80
GetPixelPtrMethod · 0.80
FillMethod · 0.80
ComposeMethod · 0.80
DrawWithoutComposeMethod · 0.80
XImageClass · 0.70

Tested by

no test coverage detected