-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add screenshotPNG command #262
base: main
Are you sure you want to change the base?
Conversation
0d982b0
to
299ba16
Compare
When was FS_GetModDescription added to ioq3? |
FS_GetModDescription was added last October in 755b2f3. |
ri.Cvar_VariableStringBuffer("version", tEXt[numtEXt].text, sizeof (tEXt[numtEXt].text)); | ||
numtEXt++; | ||
Q_strncpyz(tEXt[numtEXt].key, "Author", sizeof (tEXt[numtEXt].key)); | ||
ri.Cvar_VariableStringBuffer("username", tEXt[numtEXt].text, sizeof (tEXt[numtEXt].text)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I don't mind much about my playername (e.g. ^1That^6Guy
) to show up as metadata in screenshots, I'd rather not have my username (e.g. John Doe
) recorded somewhere. Especially since the average user might not know about this somewhat hidden metadata or how to remove/edit it.
I think the screenshot data is linear colorspace but PNG is always sRGB colorspace. The screenshot is not converted so I think the screenshot will be displayed incorrectly in image viewers. Converting 8-bit linear to 8-bit sRGB is lossy and probably not a great idea. (Or I guess use TGA if you want an accurate copy of the screenshot.) (I don't think this is handled when ioquake3 loads PNG images either. I think they will display incorrectly in-game; sRGB colorspace displayed as linear colorspace.) I should remove metadata from screenshots and remove exporting zlib functions for compress to the renderer API. I should split levelshot changes into a separate PR. |
Setting packAlign was removed [1] and later set to 0 [2] and this caused PADP( ..., packAlign ) to return NULL which later gets passed to R_GammaCorrect() and crashed. It seems I left packAlign in my PNG/levelshot changes [3] even though it's not needed in R_LevelShot(). Set packAlign to 1 which is single byte alignment and doesn't allocate additional memory. PADP( ..., 1 ) returns the same address and it doesn't crash later. 1: b514a01 2: 688f4f5 3: ioquake/ioq3#262
Setting packAlign was removed [1] and later set to 0 [2] and this caused PADP( ..., 0 ) to return NULL which later gets passed to R_GammaCorrect() and crashed. It seems I left packAlign in my PNG/levelshot changes [3] even though it's not needed in R_LevelShot(). Set packAlign to 1 which is single byte alignment and doesn't allocate additional memory. PADP( ..., 1 ) returns the same address and it doesn't crash later. 1: b514a01 2: 688f4f5 3: ioquake/ioq3#262
Add screenshotPNG command. Fix "\screenshotJPEG levelshot" to save JPEG image instead of TGA. Allow specifying the size of levelshot using "\screenshot levelshot 256".
Fix using offset for source returned by RB_ReadPixels(). In practice this shouldn't be an issue because Hunk_AllocateTempMemory() should already be aligned to sizeof(intptr_t).
Filling the resample buffer didn't correctly handle offset for packAlign if it didn't match the alignment returned by Hunk_AllocateTempMemory(). There isn't SIMD or something that the code wants a specific alignment. Hunk_AllocateTempMemory() is aligned to sizeof(intptr_t) anyway so there isn't a reason to add a memory alignment here.
I created a pull request in case someone wants to object to this going into ioq3.