Quellcode durchsuchen

Use TIGR_FIXED for the microui demo window

TIGR_2X forced a 1600x1200 framebuffer for the 800x600 bitmap; on a display
whose client area is shorter than that, tigr crops the bitmap and the top
rows (the Demo Window title) were cut off - the "eaten top".

Use TIGR_FIXED so tigr computes the largest integer scale that fits the
screen (1X on 1080p, more on larger displays) and never crops the
framebuffer. Document the tigrFillRect interior-only behaviour and the
scaling/cropping pitfall in ANALYSIS.md / MICROUI-PORT.md.
Eric Streit vor 3 Wochen
Ursprung
Commit
5c9cd37de6

+ 8 - 1
modula2/ANALYSIS.md

@@ -344,4 +344,11 @@ The demo is rendered by tigr (not SDL): `COMMAND_RECT` -> `tigrFillRect`,
   which showed up as the top of the window being "eaten" by the title bar.
   which showed up as the top of the window being "eaten" by the title bar.
   The fix is to draw `tigrRect` (1px outline) followed by `tigrFillRect`
   The fix is to draw `tigrRect` (1px outline) followed by `tigrFillRect`
   (interior): together they fill the exact rectangle, with clipping and
   (interior): together they fill the exact rectangle, with clipping and
-  alpha blending, and single-pixel rects still show.
+  alpha blending, and single-pixel rects still show.
+- The demo created its window with `TIGR_2X`, which forces a 2X scale
+  (1600x1200 for the 800x600 bitmap). On a screen whose client area is
+  shorter than that, tigr crops the bitmap, cutting off the top rows of the
+  framebuffer - which is what "ate" the window title. `TIGR_FIXED` is used
+  instead: tigr then picks the largest integer scale that fits the display,
+  so nothing is ever cropped (on a 1080p screen it settles on 1X, on larger
+  screens on 2X or more).

+ 3 - 0
modula2/MICROUI-PORT.md

@@ -58,6 +58,9 @@ was run under X11 and the headless test renders an identical layout to PNG.
   `tigrRect` (1px outline) + `tigrFillRect` (interior). Using `tigrFillRect`
   `tigrRect` (1px outline) + `tigrFillRect` (interior). Using `tigrFillRect`
   alone shrinks every rect by one pixel and makes all 1px borders (window and
   alone shrinks every rect by one pixel and makes all 1px borders (window and
   control outlines) disappear.
   control outlines) disappear.
+- The demo window uses `TIGR_FIXED`, not `TIGR_2X`: forcing a scale larger
+  than the screen makes tigr crop the framebuffer (which cuts the title row).
+  `TIGR_FIXED` lets tigr choose the largest integer scale that fits.
 
 
 ## GNU Modula-2 16.0.1 issues worked around
 ## GNU Modula-2 16.0.1 issues worked around
 
 

BIN
modula2/examples/microui-demo/microui-demo


+ 2 - 2
modula2/examples/microui-demo/microui-demo.mod

@@ -19,7 +19,7 @@ FROM tigr IMPORT TigrPtr, tigrWindow, tigrFree, tigrClosed, tigrClear,
                  tigrKeyDown, tigrKeyHeld, tigrReadChar, tigrTime,
                  tigrKeyDown, tigrKeyHeld, tigrReadChar, tigrTime,
                  tigrEncodeUTF8, tigrClip, tigrError,
                  tigrEncodeUTF8, tigrClip, tigrError,
                  TK_ESCAPE, TK_LSHIFT, TK_RSHIFT, TK_LCONTROL, TK_RCONTROL,
                  TK_ESCAPE, TK_LSHIFT, TK_RSHIFT, TK_LCONTROL, TK_RCONTROL,
-                 TK_LALT, TK_RALT, TK_RETURN, TK_BACKSPACE, TIGR_2X;
+                 TK_LALT, TK_RALT, TK_RETURN, TK_BACKSPACE, TIGR_FIXED;
 FROM helper IMPORT tigrRGB, tigrRGBA;
 FROM helper IMPORT tigrRGB, tigrRGBA;
 FROM microuiHelpers IMPORT BITAND, IntToStr, HexByte;
 FROM microuiHelpers IMPORT BITAND, IntToStr, HexByte;
 IMPORT microui;
 IMPORT microui;
@@ -544,7 +544,7 @@ END LogWindow;
 (*========================================================================*)
 (*========================================================================*)
 
 
 BEGIN
 BEGIN
-    bmp := tigrWindow(WIN_W, WIN_H, "microui + tigr (Modula-2)", TIGR_2X);
+    bmp := tigrWindow(WIN_W, WIN_H, "microui + tigr (Modula-2)", TIGR_FIXED);
     IF bmp = NIL THEN
     IF bmp = NIL THEN
         tigrError(NIL, "Cannot create window")
         tigrError(NIL, "Cannot create window")
     END;
     END;