[Scummvm-git-logs] scummvm master -> 57d0df273e6a43cdf8dd91a1fee52d3e1fc45c31

SupSuper noreply at scummvm.org
Tue Feb 22 17:46:33 UTC 2022


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

Summary:
57d0df273e GUI: Scale grid widget icons with filtering


Commit: 57d0df273e6a43cdf8dd91a1fee52d3e1fc45c31
    https://github.com/scummvm/scummvm/commit/57d0df273e6a43cdf8dd91a1fee52d3e1fc45c31
Author: SupSuper (supsuper at gmail.com)
Date: 2022-02-22T17:46:21Z

Commit Message:
GUI: Scale grid widget icons with filtering

Changed paths:
    gui/widget.cpp
    gui/widget.h
    gui/widgets/grid.cpp
    gui/widgets/grid.h


diff --git a/gui/widget.cpp b/gui/widget.cpp
index 651ac1d9e38..1c43dd15850 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -543,7 +543,7 @@ void DropdownButtonWidget::drawWidget() {
 
 #pragma mark -
 
-const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, int w, int h) {
+const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, int w, int h, bool filtering) {
 	int nw = w, nh = h;
 
 	// Maintain aspect ratio
@@ -563,7 +563,7 @@ const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, in
 
 	Graphics::ManagedSurface tmp(*gfx);
 
-	const Graphics::ManagedSurface *tmp2 = new Graphics::ManagedSurface(tmp.surfacePtr()->scale(w, h, false));
+	const Graphics::ManagedSurface *tmp2 = new Graphics::ManagedSurface(tmp.surfacePtr()->scale(w, h, filtering));
 	tmp.free();
 
 	return tmp2;
diff --git a/gui/widget.h b/gui/widget.h
index 08bbde6f0be..048c2de2312 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -529,7 +529,7 @@ private:
 };
 
 ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x=0, int y=0, int w=0, int h=0);
-const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, int w, int h);
+const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, int w, int h, bool filtering = false);
 
 } // End of namespace GUI
 
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 07f0c6b4a81..c8ba3605e7a 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -582,7 +582,7 @@ void GridWidget::reloadThumbnails() {
 		if (!_loadedSurfaces.contains(entry->thumbPath)) {
 			surf = loadSurfaceFromFile(entry->thumbPath);
 			if (surf) {
-				const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, 512));
+				const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, 512, true));
 				_loadedSurfaces[entry->thumbPath] = scSurf;
 				surf->free();
 				delete surf;
@@ -612,7 +612,7 @@ void GridWidget::loadPlatformIcons() {
 		Common::String path = Common::String::format("icons/platforms/%s.png", l->code);
 		Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path);
 		if (gfx) {
-			const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, _platformIconWidth, _platformIconHeight);
+			const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, _platformIconWidth, _platformIconHeight, true);
 			_platformIcons[l->id] = scGfx;
 			gfx->free();
 			delete gfx;
diff --git a/gui/widgets/grid.h b/gui/widgets/grid.h
index a054f268e61..ba9da46a212 100644
--- a/gui/widgets/grid.h
+++ b/gui/widgets/grid.h
@@ -36,9 +36,6 @@ class ScrollBarWidget;
 class GridItemWidget;
 class GridWidget;
 
-const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, int w, int h);
-Graphics::ManagedSurface *loadSurfaceFromFile(const Common::String &name, int renderWidth, int renderHeight);
-
 enum {
 	kPlayButtonCmd = 'PLAY',
 	kEditButtonCmd = 'EDIT',




More information about the Scummvm-git-logs mailing list