Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

VBE Canvas - 1366x768 is "tilted"

Open Szymekk44 opened this issue 1 year ago • 10 comments
trafficstars

Area of Cosmos - What area of Cosmos are we dealing with?

VBE Canvas/Graphics - 1366x768

Expected Behaviour - What do you think that should happen?

It should render normally. (SVGAII 1360x768; 1366 should be supported but its black https://github.com/CosmosOS/Cosmos/blob/8adc6864c20ac616f05e8d85e17b47fd6d986db7/source/Cosmos.System2/Graphics/SVGAIICanvas.cs#L123C1-L123C38) obraz_2024-04-30_201234325

Actual Behaviour - What unexpectedly happens?

obraz_2024-04-30_200529482 yep even rectangles (loading bar) are broken

Reproduction - How did you get this error to appear?

Just create a new 1366x768 VBE Canvas and draw something (a rectangle, bitmap, text, anything)

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

Devkit - latest c6155b9

Szymekk44 avatar Apr 30 '24 18:04 Szymekk44

Also its not vmware, on real hardware it looks the same

Szymekk44 avatar Apr 30 '24 18:04 Szymekk44

I haven't looked into this, but it looks like all implementations of Canvas, while having it defined, aren't completely using the stride information. This isn't a problem with resolutions like 1280x720, where the stride is equal to the width - but a resolution like 1366x768 would normally have some padding on each scanline to account for the alignment.

For e.g. 1280x720, each scanline is 1280 pixels long - meaning that two consecutive scanlines are already aligned on a 4 (or even 8!) byte boundary. For 1366px-wide scan-lines, this is no longer the case, so it's very much likely the stride is different than the width.

This could be fixed by making the formula for getting the position of a single pixel $(y * s) + x$, where $s$ is the stride.

ascpixi avatar May 02 '24 00:05 ascpixi

(y * (Mode.width + Mode.padding)) + x so adding padding data to Mode should fix it

zarlo avatar May 02 '24 07:05 zarlo

i think windows had this kind of problem too

DuperNO-Alt avatar Jul 01 '24 16:07 DuperNO-Alt

Update: its creating a 1368x768 canvas, but displaying 1366x768. Padding won't fix it because if you draw something on bottom two lines it is going to crash.

Here are some examples Square 10x10

on x1356 y0 image

x1358 y0 image

and now on x1359 y0 image

if you add in VBECanvas driver (Cosmos.System2) a new mode 1368x768 and set1366x768x32 in vbe resolution (vmware does not support 1368!) when creating a 1368x768 canvas it works. But with the same issue.

Szymekk44 avatar Jul 14 '24 14:07 Szymekk44

i think windows had this kind of problem too

Yes (at least on Rectify 11)

gamma63 avatar Jul 19 '24 19:07 gamma63

i think windows had this kind of problem too

That's right. Windows is solved by installing VMware tools, but There's no VMware Tools for CosmosOS.

ADev531 avatar Oct 30 '24 10:10 ADev531

my Code Works Fine But Try To Load Images Like This Maybe It Will Help: [ManifestResourceStream(ResourceName = "CorgiOS.Resources.Wallpapers.bliss1.bmp")] public static byte[] BlissRAW; public static Bitmap Bliss = new Bitmap(BlissRAW); [ManifestResourceStream(ResourceName = "CorgiOS.Resources.Art.Logo_256PX.bmp")] public static byte[] LogoRAW; public static Bitmap Logo = new Bitmap(LogoRAW); // Replace All The Resources With Your Paths And Make Them Embedded Resources Make The Format The Same As Your Canvas Say A 32 Bit Canvas Then Make The Format 32Bpp // Also Make Your Canvas Kinda Like This canvas = new SVGAIICanvas(new Mode(Width, Height, ColorDepth.ColorDepth32)); // Replace Width And Hight With Yours And ColorDepth With Your Image Format So 32Bpp Then Make The Canvas 32Bit Color Depth

Or You Can Try Virtual Box Or QEMU Or Reinstall Cosmos Or Try DevKit If You Don't Have It Heres A Video I Used To Get DevKit: https://www.youtube.com/watch?v=NhTb_Ck6Rfk Hope This Helped You :D

ghost avatar Dec 30 '24 16:12 ghost

I Highly Recommend You Use Virtual Box Or QEMU Plus Audio Works Better On Them The Downside Is That You Will Have To Compile It Evey Signal Time You Want To Test It Then It Will Not Open Automatically

ghost avatar Dec 30 '24 16:12 ghost

i think windows had this kind of problem too

Try Virtual Box Or QEMU

ghost avatar Dec 30 '24 16:12 ghost