]> code.delx.au - refind/blobdiff - libeg/screen.c
New "editor" option to the "hideui" configuration file token.
[refind] / libeg / screen.c
index d2d12db4fc4f20eedb075223e4d7310e48674bc8..222895919b34496def2f04c7a7682836453f6fda 100644 (file)
@@ -133,15 +133,23 @@ BOOLEAN egSetScreenSize(IN OUT UINTN *ScreenWidth, IN OUT UINTN *ScreenHeight) {
       } else { // User specified width & height; must find mode
          // Do a loop through the modes to see if the specified one is available;
          // and if so, switch to it....
-         while ((Status == EFI_SUCCESS) && (!ModeSet)) {
+         do {
             Status = refit_call4_wrapper(GraphicsOutput->QueryMode, GraphicsOutput, ModeNum, &Size, &Info);
             if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info)) &&
                 (Info->HorizontalResolution == *ScreenWidth) && (Info->VerticalResolution == *ScreenHeight)) {
                Status = refit_call2_wrapper(GraphicsOutput->SetMode, GraphicsOutput, ModeNum);
                ModeSet = (Status == EFI_SUCCESS);
             } // if
-            ModeNum++;
-         } // while()
+         } while (((ModeNum++ < 10) || (Status == EFI_SUCCESS)) && !ModeSet);
+//          while ((Status == EFI_SUCCESS) && (!ModeSet)) {
+//             Status = refit_call4_wrapper(GraphicsOutput->QueryMode, GraphicsOutput, ModeNum, &Size, &Info);
+//             if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info)) &&
+//                 (Info->HorizontalResolution == *ScreenWidth) && (Info->VerticalResolution == *ScreenHeight)) {
+//                Status = refit_call2_wrapper(GraphicsOutput->SetMode, GraphicsOutput, ModeNum);
+//                ModeSet = (Status == EFI_SUCCESS);
+//             } // if
+//             ModeNum++;
+//          } // while()
       } // if/else
 
       if (ModeSet) {
@@ -168,6 +176,7 @@ BOOLEAN egSetScreenSize(IN OUT UINTN *ScreenWidth, IN OUT UINTN *ScreenHeight) {
          PauseForKey();
          SwitchToGraphics();
       } // if()
+
    } else if (UgaDraw != NULL) { // UGA mode (EFI 1.x)
       // Try to use current color depth & refresh rate for new mode. Maybe not the best choice
       // in all cases, but I don't know how to probe for alternatives....
@@ -296,9 +305,15 @@ VOID egClearScreen(IN EG_PIXEL *Color)
     if (!egHasGraphics)
         return;
 
-    FillColor.Red   = Color->r;
-    FillColor.Green = Color->g;
-    FillColor.Blue  = Color->b;
+    if (Color != NULL) {
+       FillColor.Red   = Color->r;
+       FillColor.Green = Color->g;
+       FillColor.Blue  = Color->b;
+    } else {
+       FillColor.Red   = 0x0;
+       FillColor.Green = 0x0;
+       FillColor.Blue  = 0x0;
+    }
     FillColor.Reserved = 0;
 
     if (GraphicsOutput != NULL) {
@@ -306,10 +321,9 @@ VOID egClearScreen(IN EG_PIXEL *Color)
         // layout, and the header from TianoCore actually defines them
         // to be the same type.
         refit_call10_wrapper(GraphicsOutput->Blt, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&FillColor, EfiBltVideoFill,
-                            0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
+                             0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
     } else if (UgaDraw != NULL) {
-        refit_call10_wrapper(UgaDraw->Blt, UgaDraw, &FillColor, EfiUgaVideoFill,
-                     0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
+        refit_call10_wrapper(UgaDraw->Blt, UgaDraw, &FillColor, EfiUgaVideoFill, 0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
     }
 }