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

mgerhardy martin.gerhardy at gmail.com
Mon Sep 6 18:06:13 UTC 2021


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

Summary:
af8aa09bbe TWINE: renamed variable
dd73daacf5 TWINE: fixed potential buffer underflow in renderPolygonsGouraud


Commit: af8aa09bbe53ac3ddc680fecf172ed1d7479091d
    https://github.com/scummvm/scummvm/commit/af8aa09bbe53ac3ddc680fecf172ed1d7479091d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-09-06T20:05:30+02:00

Commit Message:
TWINE: renamed variable

Changed paths:
    engines/twine/renderer/renderer.cpp
    engines/twine/renderer/renderer.h


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 84c70c17df..27e6aac894 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -48,13 +48,13 @@ Renderer::Renderer(TwinEEngine *engine) : _engine(engine) {
 
 Renderer::~Renderer() {
 	free(_polyTab);
-	free(_polyTab2);
+	free(_colorProgressionBuffer);
 }
 
 void Renderer::init(int32 w, int32 h) {
 	_polyTabSize = _engine->height() * 6;
 	_polyTab = (int16 *)malloc(_polyTabSize * sizeof(int16));
-	_polyTab2 = (int16 *)malloc(_polyTabSize * sizeof(int16));
+	_colorProgressionBuffer = (int16 *)malloc(_polyTabSize * sizeof(int16));
 	_holomap_polytab_1_1 = &_polyTab[_engine->height() * 0];
 	_holomap_polytab_1_2 = &_polyTab[_engine->height() * 2];
 	_holomap_polytab_1_3 = &_polyTab[_engine->height() * 3];
@@ -391,8 +391,8 @@ void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
 	int16 currentVertexY = vertices[numVertices - 1].y;
 	const int16 *polyTabBegin = _polyTab;
 	const int16 *polyTabEnd = &_polyTab[_polyTabSize - 1];
-	const int16 *polyTab2Begin = _polyTab2;
-	const int16 *polyTab2End = &_polyTab2[_polyTabSize - 1];
+	const int16 *polyTab2Begin = _colorProgressionBuffer;
+	const int16 *polyTab2End = &_colorProgressionBuffer[_polyTabSize - 1];
 	const int screenHeight = _engine->height();
 
 	for (int32 nVertex = 0; nVertex < numVertices; nVertex++) {
@@ -448,7 +448,7 @@ void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
 		}
 
 		if (polyRenderType >= POLYGONTYPE_GOURAUD) { // we must compute the color progression
-			int16 *outPtr2 = &_polyTab2[polyTabIndex];
+			int16 *outPtr2 = &_colorProgressionBuffer[polyTabIndex];
 
 			for (int16 i = 0; i < vsize + 2; i++) {
 				if (outPtr2 >= polyTab2Begin && outPtr2 <= polyTab2End) {
@@ -774,7 +774,7 @@ void Renderer::renderPolygonsTrame(int vtop, int32 vsize, uint8 color) const {
 void Renderer::renderPolygonsGouraud(int vtop, int32 vsize) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
-	const int16 *ptr2 = &_polyTab2[vtop]; // color progression
+	const int16 *ptr2 = &_colorProgressionBuffer[vtop];
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
 	int32 renderLoop = vsize;
@@ -858,7 +858,7 @@ void Renderer::renderPolygonsGouraud(int vtop, int32 vsize) const {
 void Renderer::renderPolygonsDither(int vtop, int32 vsize) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
-	const int16 *ptr2 = &_polyTab2[vtop]; // color progression
+	const int16 *ptr2 = &_colorProgressionBuffer[vtop];
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
 
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index ade786b16f..0f660bdb11 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -173,7 +173,7 @@ private:
 
 	int32 _polyTabSize = 0;
 	int16 *_polyTab = nullptr;
-	int16 *_polyTab2 = nullptr;
+	int16 *_colorProgressionBuffer = nullptr;
 	int16* _holomap_polytab_1_1 = nullptr;
 	int16* _holomap_polytab_1_2 = nullptr;
 	int16* _holomap_polytab_1_3 = nullptr;


Commit: dd73daacf59c84bbdf9a0743b517b96afe3aa84e
    https://github.com/scummvm/scummvm/commit/dd73daacf59c84bbdf9a0743b517b96afe3aa84e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-09-06T20:05:49+02:00

Commit Message:
TWINE: fixed potential buffer underflow in renderPolygonsGouraud

Changed paths:
    engines/twine/renderer/renderer.cpp


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 27e6aac894..680d468fdf 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -805,7 +805,7 @@ void Renderer::renderPolygonsGouraud(int vtop, int32 vsize) const {
 				*out2 = ((startColor + stopColor) / 2) / 256; // average of the 2 colors
 			}
 		} else if (hsize == 1) {
-			if (start >= -1 && start < screenWidth - 1) {
+			if (start >= 1 && start < screenWidth - 1) {
 				*(out2 + 1) = stopColor / 256;
 			}
 
@@ -813,11 +813,11 @@ void Renderer::renderPolygonsGouraud(int vtop, int32 vsize) const {
 				*out2 = startColor / 256;
 			}
 		} else if (hsize == 2) {
-			if (start >= -2 && start < screenWidth - 2) {
+			if (start >= 2 && start < screenWidth - 2) {
 				*(out2 + 2) = stopColor / 256;
 			}
 
-			if (start >= -1 && start < screenWidth - 1) {
+			if (start >= 1 && start < screenWidth - 1) {
 				*(out2 + 1) = ((startColor + stopColor) / 2) / 256; // average of the 2 colors
 			}
 




More information about the Scummvm-git-logs mailing list