X-Git-Url: https://code.delx.au/refind/blobdiff_plain/4f05f12b4a34cfbef8deb341168a212edb225ad4..463d49c9646ad30a500cc9a6305676b790871945:/refind/screen.c diff --git a/refind/screen.c b/refind/screen.c index 335dc93..655057f 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -34,7 +34,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * Modifications copyright (c) 2012 Roderick W. Smith + * Modifications copyright (c) 2012-2014 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public * License (GPL) version 3 (GPLv3), a copy of which must be distributed @@ -119,7 +119,7 @@ VOID InitScreen(VOID) PrepareBlankLine(); // show the banner if in text mode - if (GlobalConfig.TextOnly) + if (GlobalConfig.TextOnly && (GlobalConfig.ScreensaverTime != -1)) DrawScreenHeader(L"Initializing..."); } @@ -168,7 +168,11 @@ VOID SetupScreen(VOID) // clear screen and show banner // (now we know we'll stay in graphics mode) SwitchToGraphics(); - BltClearScreen(TRUE); + if (GlobalConfig.ScreensaverTime != -1) { + BltClearScreen(TRUE); + } else { // start with screen blanked + GraphicsScreenDirty = TRUE; + } } } // VOID SetupScreen() @@ -429,52 +433,64 @@ VOID SwitchToGraphicsAndClear(VOID) BltClearScreen(TRUE); } -VOID BltClearScreen(IN BOOLEAN ShowBanner) +VOID BltClearScreen(BOOLEAN ShowBanner) { - static EG_IMAGE *Banner = NULL, *CroppedBanner; + static EG_IMAGE *Banner = NULL; + EG_IMAGE *NewBanner = NULL; INTN BannerPosX, BannerPosY; + EG_PIXEL Black = { 0x0, 0x0, 0x0, 0 }; if (ShowBanner && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_BANNER)) { // load banner on first call if (Banner == NULL) { - if (GlobalConfig.BannerFileName == NULL) { - Banner = egPrepareEmbeddedImage(&egemb_refind_banner, FALSE); - } else { + if (GlobalConfig.BannerFileName) Banner = egLoadImage(SelfDir, GlobalConfig.BannerFileName, FALSE); - if (Banner && ((Banner->Width > UGAWidth) || (Banner->Height > UGAHeight))) { - CroppedBanner = egCropImage(Banner, 0, 0, (Banner->Width > UGAWidth) ? UGAWidth : Banner->Width, - (Banner->Height > UGAHeight) ? UGAHeight : Banner->Height); - MyFreePool(Banner); - Banner = CroppedBanner; - } // if image too big - if (Banner == NULL) { - Banner = egPrepareEmbeddedImage(&egemb_refind_banner, FALSE); - } // if unusable image - } - if (Banner != NULL) - MenuBackgroundPixel = Banner->PixelData[0]; + if (Banner == NULL) + Banner = egPrepareEmbeddedImage(&egemb_refind_banner, FALSE); } + if (Banner) { + if (GlobalConfig.BannerScale == BANNER_FILLSCREEN) { + if ((Banner->Height != UGAHeight) || (Banner->Width != UGAWidth)) { + NewBanner = egScaleImage(Banner, UGAWidth, UGAHeight); + } // if + } else if ((Banner->Width > UGAWidth) || (Banner->Height > UGAHeight)) { + NewBanner = egCropImage(Banner, 0, 0, (Banner->Width > UGAWidth) ? UGAWidth : Banner->Width, + (Banner->Height > UGAHeight) ? UGAHeight : Banner->Height); + } // if/elseif + if (NewBanner) { + MyFreePool(Banner); + Banner = NewBanner; + } + MenuBackgroundPixel = Banner->PixelData[0]; + } // if Banner exists + // clear and draw banner - egClearScreen(&MenuBackgroundPixel); + if (GlobalConfig.ScreensaverTime != -1) + egClearScreen(&MenuBackgroundPixel); + else + egClearScreen(&Black); + if (Banner != NULL) { BannerPosX = (Banner->Width < UGAWidth) ? ((UGAWidth - Banner->Width) / 2) : 0; BannerPosY = (INTN) (ComputeRow0PosY() / 2) - (INTN) Banner->Height; if (BannerPosY < 0) BannerPosY = 0; GlobalConfig.BannerBottomEdge = BannerPosY + Banner->Height; - BltImage(Banner, (UINTN) BannerPosX, (UINTN) BannerPosY); + if (GlobalConfig.ScreensaverTime != -1) + BltImage(Banner, (UINTN) BannerPosX, (UINTN) BannerPosY); } - } else { - // clear to standard background color - egClearScreen(&StdBackgroundPixel); + } else { // not showing banner + // clear to menu background color + egClearScreen(&MenuBackgroundPixel); } GraphicsScreenDirty = FALSE; egFreeImage(GlobalConfig.ScreenBackground); GlobalConfig.ScreenBackground = egCopyScreen(); -} /* VOID BltClearScreen() */ +} // VOID BltClearScreen() + VOID BltImage(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos) {