[Scummvm-git-logs] scummvm master -> 2f5f71983ccd45ec44df274333f1f3b4f34f5ce6

sev- noreply at scummvm.org
Thu Aug 3 08:34:06 UTC 2023


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
02937a75a4 GRAPHICS: Allow creating thumbnails from a ManagedSurface
a23de7e6b9 GRAPHICS: Take into account palette when creating thumbnail
2f5f71983c GRAPHICS: Use forward declaration of ManagedSurface


Commit: 02937a75a4ac3cb36f5d958a9f3c72d962295dc9
    https://github.com/scummvm/scummvm/commit/02937a75a4ac3cb36f5d958a9f3c72d962295dc9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-03T10:34:00+02:00

Commit Message:
GRAPHICS: Allow creating thumbnails from a ManagedSurface

Changed paths:
    graphics/scaler.h
    graphics/scaler/thumbnail_intern.cpp


diff --git a/graphics/scaler.h b/graphics/scaler.h
index b460d48df9c..1c3b6459972 100644
--- a/graphics/scaler.h
+++ b/graphics/scaler.h
@@ -23,6 +23,7 @@
 #define GRAPHICS_SCALER_H
 
 #include "common/scummsys.h"
+#include "graphics/managed_surface.h"
 #include "graphics/surface.h"
 
 // creates a 160x100 thumbnail for 320x200 games
@@ -53,4 +54,12 @@ extern bool createThumbnailFromScreen(Graphics::Surface *surf);
  */
 extern bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette);
 
+/**
+ * Creates a thumbnail from a ManagedSurface.
+ *
+ * @param surf	destination surface (will always have 16 bpp after this for now)
+ * @param in	source surface to create thumbnail from
+ */
+extern bool createThumbnail(Graphics::Surface *surf, Graphics::ManagedSurface *in);
+
 #endif
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index 66ee7fab333..261652fed58 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -27,6 +27,7 @@
 #include "graphics/scaler.h"
 #include "graphics/scaler/intern.h"
 #include "graphics/palette.h"
+#include "graphics/managed_surface.h"
 
 template<typename ColorMask>
 uint16 quadBlockInterpolate(const uint8 *src, uint32 srcPitch) {
@@ -259,6 +260,15 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h,
 	return createThumbnail(*surf, screen);
 }
 
+bool createThumbnail(Graphics::Surface *surf, Graphics::ManagedSurface *in) {
+	assert(surf);
+
+	Graphics::Surface screen;
+	screen.convertFrom(in->rawSurface(), Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+
+	return createThumbnail(*surf, screen);
+}
+
 // this is somewhat awkward, but createScreenShot should logically be in graphics,
 // but moving other functions in this file into that namespace breaks several engines
 namespace Graphics {


Commit: a23de7e6b9138d1119b9dd154884cd22a88973f5
    https://github.com/scummvm/scummvm/commit/a23de7e6b9138d1119b9dd154884cd22a88973f5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-03T10:34:00+02:00

Commit Message:
GRAPHICS: Take into account palette when creating thumbnail

Changed paths:
    graphics/scaler/thumbnail_intern.cpp


diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index 261652fed58..173bc8ec900 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -264,9 +264,15 @@ bool createThumbnail(Graphics::Surface *surf, Graphics::ManagedSurface *in) {
 	assert(surf);
 
 	Graphics::Surface screen;
-	screen.convertFrom(in->rawSurface(), Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 
-	return createThumbnail(*surf, screen);
+	if (in->hasPalette()) {
+		uint8 palette[3 * 256];
+		in->grabPalette(palette, 0, 256);
+		return createThumbnail(surf, (const uint8 *)in->getPixels(), in->w, in->h, palette);
+	} else {
+		screen.convertFrom(in->rawSurface(), Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+		return createThumbnail(*surf, screen);
+	}
 }
 
 // this is somewhat awkward, but createScreenShot should logically be in graphics,


Commit: 2f5f71983ccd45ec44df274333f1f3b4f34f5ce6
    https://github.com/scummvm/scummvm/commit/2f5f71983ccd45ec44df274333f1f3b4f34f5ce6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-03T10:34:00+02:00

Commit Message:
GRAPHICS: Use forward declaration of ManagedSurface

Changed paths:
    graphics/scaler.h


diff --git a/graphics/scaler.h b/graphics/scaler.h
index 1c3b6459972..4c6e297e101 100644
--- a/graphics/scaler.h
+++ b/graphics/scaler.h
@@ -23,9 +23,12 @@
 #define GRAPHICS_SCALER_H
 
 #include "common/scummsys.h"
-#include "graphics/managed_surface.h"
 #include "graphics/surface.h"
 
+namespace Graphics {
+class ManagedSurface;
+}
+
 // creates a 160x100 thumbnail for 320x200 games
 // and 160x120 thumbnail for 320x240 and 640x480 games
 // only 565 mode




More information about the Scummvm-git-logs mailing list