[Scummvm-git-logs] scummvm master -> 8a75fc00da87851a2370adfdb8ca22ef8194df2e
bluegr
noreply at scummvm.org
Sat Jul 5 18:30:37 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
4e7a2d1691 AGS: Fix displaying thumbnails in the ScummVM GUI
8a75fc00da AGS: Use common code for creating .bmp files
Commit: 4e7a2d169193ba6912303dc5d9204d2b2fe91bf7
https://github.com/scummvm/scummvm/commit/4e7a2d169193ba6912303dc5d9204d2b2fe91bf7
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-07-05T21:30:33+03:00
Commit Message:
AGS: Fix displaying thumbnails in the ScummVM GUI
Changed paths:
engines/ags/metaengine.cpp
diff --git a/engines/ags/metaengine.cpp b/engines/ags/metaengine.cpp
index b3e9c8ef7dd..888516f2aab 100644
--- a/engines/ags/metaengine.cpp
+++ b/engines/ags/metaengine.cpp
@@ -126,18 +126,16 @@ SaveStateDescriptor AGSMetaEngine::querySaveMetaInfos(const char *target, int sl
Image::BitmapDecoder decoder;
if (decoder.loadStream(thumbStream)) {
const Graphics::Surface *src = decoder.getSurface();
+ const Graphics::Palette &pal = decoder.getPalette();
Graphics::Surface *dest;
if (src->w == 160 && src->h == 100) {
- dest = new Graphics::Surface();
- dest->copyFrom(*src);
+ dest = src->convertTo(g_system->getOverlayFormat(), pal.data(), pal.size());
} else {
- Graphics::ManagedSurface temp(160, 100, src->format);
- temp.blitFrom(*src, Common::Rect(0, 0, src->w, src->h),
- Common::Rect(0, 0, 160, 100));
-
- dest = new Graphics::Surface();
- dest->copyFrom(temp);
+ Graphics::Surface *temp = src->convertTo(g_system->getOverlayFormat(), pal.data(), pal.size());
+ dest = temp->scale(160, 100);
+ temp->free();
+ delete temp;
}
desc.setThumbnail(dest);
Commit: 8a75fc00da87851a2370adfdb8ca22ef8194df2e
https://github.com/scummvm/scummvm/commit/8a75fc00da87851a2370adfdb8ca22ef8194df2e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-07-05T21:30:33+03:00
Commit Message:
AGS: Use common code for creating .bmp files
Changed paths:
engines/ags/shared/gfx/allegro_bitmap.cpp
engines/ags/shared/gfx/image.cpp
engines/ags/shared/gfx/image.h
diff --git a/engines/ags/shared/gfx/allegro_bitmap.cpp b/engines/ags/shared/gfx/allegro_bitmap.cpp
index ac5f16d98c5..8810a56ca9f 100644
--- a/engines/ags/shared/gfx/allegro_bitmap.cpp
+++ b/engines/ags/shared/gfx/allegro_bitmap.cpp
@@ -146,7 +146,7 @@ bool Bitmap::LoadFromFile(PACKFILE *pf) {
}
bool Bitmap::SaveToFile(Common::WriteStream &out, const void *palette) {
- return save_bitmap(out, _alBitmap, (const RGB *)palette) == 0;
+ return save_bitmap(out, _alBitmap, (const RGB *)palette);
}
bool Bitmap::SaveToFile(const char *filename, const void *palette) {
diff --git a/engines/ags/shared/gfx/image.cpp b/engines/ags/shared/gfx/image.cpp
index 8d1a5f1bf29..dc39160fdb6 100644
--- a/engines/ags/shared/gfx/image.cpp
+++ b/engines/ags/shared/gfx/image.cpp
@@ -132,64 +132,20 @@ BITMAP *load_bitmap(PACKFILE *pf, color *pal) {
error("Unknown image file");
}
-int save_bitmap(Common::WriteStream &out, BITMAP *bmp, const RGB *pal) {
- const Graphics::PixelFormat requiredFormat_3byte = Graphics::PixelFormat::createFormatBGR24();
- Graphics::ManagedSurface surface(bmp->w, bmp->h, requiredFormat_3byte);
-
- Graphics::ManagedSurface &src = bmp->getSurface();
- if (bmp->format.bytesPerPixel == 1) {
- Graphics::ManagedSurface temp;
- temp.copyFrom(src);
- if (pal) {
- byte palette[256 * 3];
- for (int c = 0, i = 0; c < 256; ++c, i += 3) {
- palette[i] = VGA_COLOR_TRANS(pal[c].r);
- palette[i + 1] = VGA_COLOR_TRANS(pal[c].g);
- palette[i + 2] = VGA_COLOR_TRANS(pal[c].b);
- }
- temp.setPalette(palette, 0, 256);
+bool save_bitmap(Common::WriteStream &out, BITMAP *bmp, const RGB *pal) {
+ const Graphics::ManagedSurface &src = bmp->getSurface();
+ if (bmp->format.isCLUT8() && pal) {
+ byte palette[256 * 3];
+ for (int c = 0, i = 0; c < 256; ++c, i += 3) {
+ palette[i] = VGA_COLOR_TRANS(pal[c].r);
+ palette[i + 1] = VGA_COLOR_TRANS(pal[c].g);
+ palette[i + 2] = VGA_COLOR_TRANS(pal[c].b);
}
- surface.rawBlitFrom(temp, Common::Rect(0, 0, src.w, src.h),
- Common::Point(0, 0));
+ return Image::writeBMP(out, src, palette);
} else {
- // Copy from the source surface without alpha transparency
- Graphics::ManagedSurface temp;
- temp.copyFrom(src);
- temp.format.aLoss = 8;
-
- surface.rawBlitFrom(temp, Common::Rect(0, 0, src.w, src.h),
- Common::Point(0, 0));
+ return Image::writeBMP(out, src);
}
-
- // Write out the bitmap
- int dstPitch = surface.w * 3;
- int extraDataLength = (dstPitch % 4) ? 4 - (dstPitch % 4) : 0;
- int padding = 0;
-
- out.writeByte('B');
- out.writeByte('M');
- out.writeUint32LE(surface.h * dstPitch + 54);
- out.writeUint32LE(0);
- out.writeUint32LE(54);
- out.writeUint32LE(40);
- out.writeUint32LE(surface.w);
- out.writeUint32LE(surface.h);
- out.writeUint16LE(1);
- out.writeUint16LE(24);
- out.writeUint32LE(0);
- out.writeUint32LE(0);
- out.writeUint32LE(0);
- out.writeUint32LE(0);
- out.writeUint32LE(0);
- out.writeUint32LE(0);
-
- for (uint y = surface.h; y-- > 0;) {
- out.write((const void *)surface.getBasePtr(0, y), dstPitch);
- out.write(&padding, extraDataLength);
- }
-
- return true;
}
} // namespace AGS
diff --git a/engines/ags/shared/gfx/image.h b/engines/ags/shared/gfx/image.h
index 22aa3c70b48..728ce7a578b 100644
--- a/engines/ags/shared/gfx/image.h
+++ b/engines/ags/shared/gfx/image.h
@@ -35,7 +35,7 @@ extern BITMAP *load_lbm(const char *filename, color *pal);
extern BITMAP *load_pcx(const char *filename, color *pal);
extern BITMAP *load_tga(const char *filename, color *pal);
-extern int save_bitmap(Common::WriteStream &out, BITMAP *bmp, const RGB *pal);
+extern bool save_bitmap(Common::WriteStream &out, BITMAP *bmp, const RGB *pal);
} // namespace AGS3
More information about the Scummvm-git-logs
mailing list