[Scummvm-git-logs] scummvm master -> e7c405f93395817cc74f937392e8c227b0ac5146

ccawley2011 noreply at scummvm.org
Thu Feb 2 18:54:19 UTC 2023


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:
e7c405f933 TINYGL: Remove unused code


Commit: e7c405f93395817cc74f937392e8c227b0ac5146
    https://github.com/scummvm/scummvm/commit/e7c405f93395817cc74f937392e8c227b0ac5146
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-02-02T18:54:14Z

Commit Message:
TINYGL: Remove unused code

Changed paths:
  R graphics/tinygl/image_util.cpp
    graphics/module.mk
    graphics/tinygl/zgl.h


diff --git a/graphics/module.mk b/graphics/module.mk
index a70118797bb..6c8b021c81b 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -64,7 +64,6 @@ MODULE_OBJS += \
 	tinygl/clip.o \
 	tinygl/fog.o \
 	tinygl/get.o \
-	tinygl/image_util.o \
 	tinygl/init.o \
 	tinygl/light.o \
 	tinygl/list.o \
diff --git a/graphics/tinygl/image_util.cpp b/graphics/tinygl/image_util.cpp
deleted file mode 100644
index 502693b9192..00000000000
--- a/graphics/tinygl/image_util.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This file is based on, or a modified version of code from TinyGL (C) 1997-2022 Fabrice Bellard,
- * which is licensed under the MIT license (see LICENSE).
- * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
- */
-
-#include "graphics/tinygl/zgl.h"
-
-namespace TinyGL {
-
-// linear interpolation with xf, yf normalized to 2^16
-
-#define INTERP_NORM_BITS  16
-#define INTERP_NORM       (1 << INTERP_NORM_BITS)
-
-static inline int interpolate(int v00, int v01, int v10, int xf, int yf) {
-	return v00 + (((v01 - v00) * xf + (v10 - v00) * yf) >> INTERP_NORM_BITS);
-}
-
-// TODO: more accurate resampling
-
-void GLContext::gl_resizeImage(Graphics::PixelBuffer &dest, int xsize_dest, int ysize_dest,
-	                       const Graphics::PixelBuffer &src, int xsize_src, int ysize_src) {
-	int point1_offset, point2_offset, point3_offset, dest_offset = 0;
-	int point_y_offset, point_offset;
-	float x1, y1, x1inc, y1inc;
-	int xi, yi, xf, yf, curr_yf;
-	bool space_below, space_right;
-	uint8 r00, g00, b00, a00;
-	uint8 r01, g01, b01, a01;
-	uint8 r10, g10, b10, a10;
-
-	x1inc = (float)(xsize_src - 1) / (float)(xsize_dest - 1);
-	y1inc = (float)(ysize_src - 1) / (float)(ysize_dest - 1);
-
-	y1 = 0;
-	for (int y = 0; y < ysize_dest; y++) {
-		x1 = 0;
-		yi = (int)floorf(y1);
-		yf = (int)((y1 - yi) * INTERP_NORM);
-		point_y_offset = yi * xsize_src;
-		space_below = (yi + 1) < ysize_src;
-		for (int x = 0; x < xsize_dest; x++) {
-			xi = (int)floorf(x1);
-			xf = (int)((x1 - xi) * INTERP_NORM);
-			point1_offset = point_offset = point_y_offset + xi;
-			space_right = (xi + 1) < xsize_src;
-			if ((xf + yf) <= INTERP_NORM) {
-				curr_yf = yf;
-				if (space_right)
-					point2_offset = point_offset + 1;
-				else
-					point2_offset = point_offset;
-				if (space_below)
-					point3_offset = point_offset + xsize_src;
-				else
-					point3_offset = point_offset;
-			} else {
-				xf = INTERP_NORM - xf;
-				curr_yf = INTERP_NORM - yf;
-				if (space_right) {
-					point1_offset += 1;
-					point3_offset = point_offset + 1;
-				} else
-					point3_offset = point_offset;
-				if (space_below) {
-					point1_offset += xsize_src;
-					point2_offset = point_offset + xsize_src;
-				} else
-					point2_offset = point_offset;
-			}
-			src.getARGBAt(point1_offset, a00, r00, g00, b00);
-			src.getARGBAt(point2_offset, a01, r01, g01, b01);
-			src.getARGBAt(point3_offset, a10, r10, g10, b10);
-			dest.setPixelAt(
-				dest_offset++,
-				interpolate(a00, a01, a10, xf, curr_yf),
-				interpolate(r00, r01, r10, xf, curr_yf),
-				interpolate(g00, g01, g10, xf, curr_yf),
-				interpolate(b00, b01, b10, xf, curr_yf)
-			);
-			x1 += x1inc;
-		}
-		y1 += y1inc;
-	}
-}
-
-#define FRAC_BITS 16
-
-// resizing with no interlating nor nearest pixel
-void GLContext::gl_resizeImageNoInterpolate(Graphics::PixelBuffer &dest, int xsize_dest, int ysize_dest,
-	                                    const Graphics::PixelBuffer &src, int xsize_src, int ysize_src) {
-	int dest_offset = 0;
-	int x1, y1, x1inc, y1inc;
-	int yi;
-	uint8 r, g, b, a;
-
-	x1inc = (int)((float)((xsize_src) << FRAC_BITS) / (float)(xsize_dest));
-	y1inc = (int)((float)((ysize_src) << FRAC_BITS) / (float)(ysize_dest));
-
-	y1 = 0;
-	for (int y = 0; y < ysize_dest; y++) {
-		yi = (y1 >> FRAC_BITS) * xsize_src;
-		x1 = 0;
-		for (int x = 0; x < xsize_dest; x++) {
-			src.getARGBAt(yi + (x1 >> FRAC_BITS), a, r, g, b);
-			dest.setPixelAt(dest_offset++, a, r, g, b);
-			x1 += x1inc;
-		}
-		y1 += y1inc;
-	}
-}
-
-} // end of namespace TinyGL
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 753f692370e..27013a70e4d 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -482,10 +482,6 @@ public:
 	void gl_GenTextures(TGLsizei n, TGLuint *textures);
 	void gl_DeleteTextures(TGLsizei n, const TGLuint *textures);
 
-	void gl_resizeImage(Graphics::PixelBuffer &dest, int xsize_dest, int ysize_dest,
-	                    const Graphics::PixelBuffer &src, int xsize_src, int ysize_src);
-	void gl_resizeImageNoInterpolate(Graphics::PixelBuffer &dest, int xsize_dest, int ysize_dest, const Graphics::PixelBuffer &src, int xsize_src, int ysize_src);
-
 	void issueDrawCall(DrawCall *drawCall);
 	void disposeResources();
 	void disposeDrawCallLists();




More information about the Scummvm-git-logs mailing list