Replace custom Image buffers with QImage

Texture decoding and generated atlases previously used a custom packed-pixel
container alongside QImage, duplicating storage and image-processing code.
Use QImage throughout texture preparation and upload, remove Image and its
pixel-format enum, and store font and string masks in Alpha8 atlases.

Preserve power-of-two dimensions with smooth scaling and keep the existing
OpenGL formats, shaders, and CPU mipmap filtering. Handle padded scanlines,
restore the caller's unpack alignment on every upload return, and centralize
binding cleanup so failed uploads do not leave stale texture caches.

Validation: full application build and diff checks passed. OpenGL readback
checks covered RGB/RGBA/alpha data, padded and custom strides, generated and
supplied mipmaps, unpack-state restoration, and failure cleanup. All nine
grid mip levels matched the previous generator. Visual rendering was checked
by the user.
This commit is contained in:
Leonardo Zide committed 2026-10-12 19:24:44 -07:00
1 parent 05ba97dd88
commit b69db29428
19 files changed
+204 -353

No files matched your search

+10 -1
View File
@@ -122,7 +122,7 @@ Library unload drains loader work, destroys meshes that release texture referenc
clears the texture manager, then closes archives. Workers must be drained before
the manager is cleared or archive indexes are replaced.
`Image::FileLoad(lcFile&)` decodes disk files through their existing `QFile` and
`lcTextureManager::DecodeTextureData(lcFile&)` decodes disk files through their existing `QFile` and
memory files through `QImage::loadFromData()`, without an additional device adapter
or disk-to-memory copy. Disk cursor restoration runs on success and failure;
memory decoding leaves the cursor unchanged and validates the remaining buffer
@@ -131,6 +131,15 @@ private to each request, not shared between workers. Texture readiness waits use
the same loader worker path; unused direct texture-loading overloads and their
synchronous library/manager forwarding chain have been removed.
Decoded worker results hold a `QImage`, normalized to RGB888 or RGBA8888 and
scaled with Qt's smooth transformation to the existing power-of-two dimensions.
Textures retain the decoded `QImage` through upload without a second pixel buffer.
Uploads honor Qt's scanline alignment, packing unusual row strides only when
needed. CPU mipmap generation copies pixel rows without padding into its existing
working buffer; its filtering, OpenGL formats, and shaders remain unchanged.
Each transfer sets its required unpack alignment, and texture upload restores
the caller's unpack alignment on every exit. Pack alignment is left unchanged.
`lcTexture::SetFailed()` assigns readiness and failure diagnostics together,
clearing stale details when none are supplied. Decoding and upload failures use
the same setter. It retains decoded pixels for bounded upload