[Scummvm-git-logs] scummvm master -> 25c4e89b7a61e4ab6b1b1738fbbdb384e05152c1

aquadran noreply at scummvm.org
Sat Jan 1 11:00:44 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:
25c4e89b7a TINYGL: Janitorial


Commit: 25c4e89b7a61e4ab6b1b1738fbbdb384e05152c1
    https://github.com/scummvm/scummvm/commit/25c4e89b7a61e4ab6b1b1738fbbdb384e05152c1
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-01-01T12:00:38+01:00

Commit Message:
TINYGL: Janitorial

Changed paths:
    graphics/tinygl/init.cpp
    graphics/tinygl/light.cpp
    graphics/tinygl/list.cpp
    graphics/tinygl/matrix.cpp
    graphics/tinygl/pixelbuffer.cpp
    graphics/tinygl/select.cpp
    graphics/tinygl/texture.cpp
    graphics/tinygl/vertex.cpp


diff --git a/graphics/tinygl/init.cpp b/graphics/tinygl/init.cpp
index 1252fddb764..6b6e6c6e87d 100644
--- a/graphics/tinygl/init.cpp
+++ b/graphics/tinygl/init.cpp
@@ -121,10 +121,10 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
 		l->norm_spot_direction = Vector3(0, 0, -1);
 		l->norm_position = Vector3(0, 0, 1);
 		l->enabled = 0;
-		l->next = NULL;
-		l->prev = NULL;
+		l->next = nullptr;
+		l->prev = nullptr;
 	}
-	first_light = NULL;
+	first_light = nullptr;
 	ambient_light_model = Vector4(0.2f, 0.2f, 0.2f, 1);
 	local_light_model = 0;
 	lighting_enabled = 0;
diff --git a/graphics/tinygl/light.cpp b/graphics/tinygl/light.cpp
index d989c129429..6c8001a385d 100644
--- a/graphics/tinygl/light.cpp
+++ b/graphics/tinygl/light.cpp
@@ -184,7 +184,7 @@ void GLContext::gl_enable_disable_light(int light, int v) {
 			if (first_light)
 				first_light->prev = l;
 			first_light = l;
-			l->prev = NULL;
+			l->prev = nullptr;
 		}
 	} else if (!v && l->enabled) {
 		l->enabled = 0;
@@ -215,7 +215,7 @@ void GLContext::gl_shade_vertex(GLVertex *v) {
 	B = m->emission.Z + m->ambient.Z * ambient_light_model.Z;
 	A = clampf(m->diffuse.W, 0, 1);
 
-	for (l = first_light; l != NULL; l = l->next) {
+	for (l = first_light; l != nullptr; l = l->next) {
 		float lR, lB, lG;
 
 		// ambient
@@ -236,7 +236,8 @@ void GLContext::gl_shade_vertex(GLVertex *v) {
 			d.Y = l->position.Y - v->ec.Y;
 			d.Z = l->position.Z - v->ec.Z;
 			dist = sqrt(d.X * d.X + d.Y * d.Y + d.Z * d.Z);
-			att = 1.0f / (l->attenuation[0] + dist * (l->attenuation[1] +
+			att = 1.0f / (l->attenuation[0] +
+			              dist * (l->attenuation[1] +
 			              dist * l->attenuation[2]));
 		}
 		dot = d.X * n.X + d.Y * n.Y + d.Z * n.Z;
@@ -256,8 +257,8 @@ void GLContext::gl_shade_vertex(GLVertex *v) {
 			if (is_spotlight || has_specular) {
 				if (is_spotlight) {
 					dot_spot = -(d.X * l->norm_spot_direction.X +
-								 d.Y * l->norm_spot_direction.Y +
-								 d.Z * l->norm_spot_direction.Z);
+					             d.Y * l->norm_spot_direction.Y +
+					             d.Z * l->norm_spot_direction.Z);
 					if (twoside && dot_spot < 0)
 						dot_spot = -dot_spot;
 					if (dot_spot < l->cos_spot_cutoff) {
diff --git a/graphics/tinygl/list.cpp b/graphics/tinygl/list.cpp
index 0a00ad44732..86b8270fd80 100644
--- a/graphics/tinygl/list.cpp
+++ b/graphics/tinygl/list.cpp
@@ -32,9 +32,8 @@
 namespace TinyGL {
 
 #define ADD_OP(aa, bb, ff) \
-static void glop ## aa (GLContext *c, GLParam *p) \
-{                                                 \
-	c->glop ## aa (p);                            \
+static void glop ## aa (GLContext *c, GLParam *p) { \
+        c->glop ## aa (p);                          \
 }
 #include "graphics/tinygl/opinfo.h"
 
@@ -87,7 +86,7 @@ static GLList *alloc_list(GLContext *c, int list) {
 	l = (GLList *)gl_zalloc(sizeof(GLList));
 	ob = (GLParamBuffer *)gl_zalloc(sizeof(GLParamBuffer));
 
-	ob->next = NULL;
+	ob->next = nullptr;
 	l->first_op_buffer = ob;
 
 	ob->ops[0].op = OP_EndList;
@@ -138,7 +137,7 @@ void GLContext::gl_compile_op(GLParam *p) {
 	if ((index + op_size) > (OP_BUFFER_MAX_SIZE - 2)) {
 
 		ob1 = (GLParamBuffer *)gl_zalloc(sizeof(GLParamBuffer));
-		ob1->next = NULL;
+		ob1->next = nullptr;
 
 		ob->next = ob1;
 		ob->ops[index].op = OP_NextBuffer;
diff --git a/graphics/tinygl/matrix.cpp b/graphics/tinygl/matrix.cpp
index c1f376ab361..578480f8d87 100644
--- a/graphics/tinygl/matrix.cpp
+++ b/graphics/tinygl/matrix.cpp
@@ -141,15 +141,18 @@ void GLContext::glopRotate(GLParam *p) {
 		m.identity();
 		break;
 	case 4:
-		if (u[0] < 0) angle = -angle;
+		if (u[0] < 0)
+			angle = -angle;
 		m.rotation(angle, 0);
 		break;
 	case 2:
-		if (u[1] < 0) angle = -angle;
+		if (u[1] < 0)
+			angle = -angle;
 		m.rotation(angle, 1);
 		break;
 	case 1:
-		if (u[2] < 0) angle = -angle;
+		if (u[2] < 0)
+			angle = -angle;
 		m.rotation(angle, 2);
 		break;
 	default: {
diff --git a/graphics/tinygl/pixelbuffer.cpp b/graphics/tinygl/pixelbuffer.cpp
index 689588244e1..d2965299a4a 100644
--- a/graphics/tinygl/pixelbuffer.cpp
+++ b/graphics/tinygl/pixelbuffer.cpp
@@ -24,13 +24,13 @@
 namespace Graphics {
 
 PixelBuffer::PixelBuffer()
-	: _buffer(NULL),
+	: _buffer(nullptr),
 	  _dispose(DisposeAfterUse::NO) {
 
 }
 
 PixelBuffer::PixelBuffer(const PixelFormat &format, int buffersize, DisposeAfterUse::Flag dispose)
-	: _buffer(NULL),
+	: _buffer(nullptr),
 	_dispose(DisposeAfterUse::NO) {
 	create(format, buffersize, dispose);
 }
@@ -78,7 +78,7 @@ void PixelBuffer::set(const Graphics::PixelFormat &format, byte *buffer) {
 
 void PixelBuffer::free() {
 	delete[] _buffer;
-	_buffer = NULL;
+	_buffer = nullptr;
 }
 
 void PixelBuffer::clear(uint length) {
diff --git a/graphics/tinygl/select.cpp b/graphics/tinygl/select.cpp
index 0d040ee003f..bd2d860feed 100644
--- a/graphics/tinygl/select.cpp
+++ b/graphics/tinygl/select.cpp
@@ -55,11 +55,11 @@ TGLint tglRenderMode(TGLenum mode) {
 		break;
 	case TGL_SELECT:
 		c->render_mode = TGL_SELECT;
-		assert(c->select_buffer != NULL);
+		assert(c->select_buffer != nullptr);
 		c->select_ptr = c->select_buffer;
 		c->select_hits = 0;
 		c->select_overflow = 0;
-		c->select_hit = NULL;
+		c->select_hit = nullptr;
 		break;
 	default:
 		assert(0);
@@ -79,7 +79,7 @@ void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
 void GLContext::glopInitNames(GLParam *) {
 	if (render_mode == TGL_SELECT) {
 		name_stack_size = 0;
-		select_hit = NULL;
+		select_hit = nullptr;
 	}
 }
 
@@ -87,7 +87,7 @@ void GLContext::glopPushName(GLParam *p) {
 	if (render_mode == TGL_SELECT) {
 		assert(name_stack_size < MAX_NAME_STACK_DEPTH);
 		name_stack[name_stack_size++] = p[1].i;
-		select_hit = NULL;
+		select_hit = nullptr;
 	}
 }
 
@@ -95,7 +95,7 @@ void GLContext::glopPopName(GLParam *) {
 	if (render_mode == TGL_SELECT) {
 		assert(name_stack_size > 0);
 		name_stack_size--;
-		select_hit = NULL;
+		select_hit = nullptr;
 	}
 }
 
@@ -103,7 +103,7 @@ void GLContext::glopLoadName(GLParam *p) {
 	if (render_mode == TGL_SELECT) {
 		assert(name_stack_size > 0);
 		name_stack[name_stack_size - 1] = p[1].i;
-		select_hit = NULL;
+		select_hit = nullptr;
 	}
 }
 
diff --git a/graphics/tinygl/texture.cpp b/graphics/tinygl/texture.cpp
index 79272332d6b..9187eb390f9 100644
--- a/graphics/tinygl/texture.cpp
+++ b/graphics/tinygl/texture.cpp
@@ -157,7 +157,7 @@ void GLContext::glopTexImage2D(GLParam *p) {
 		delete im->pixmap;
 		im->pixmap = nullptr;
 	}
-	if (pixels != NULL) {
+	if (pixels) {
 		uint filter;
 		Graphics::PixelFormat pf;
 		bool found = false;
diff --git a/graphics/tinygl/vertex.cpp b/graphics/tinygl/vertex.cpp
index eedd8abb66f..1fae66bfb1c 100644
--- a/graphics/tinygl/vertex.cpp
+++ b/graphics/tinygl/vertex.cpp
@@ -161,7 +161,7 @@ static inline void gl_vertex_transform(GLContext *c, GLVertex *v) {
 		// eye coordinates needed for lighting
 
 		m = c->matrix_stack_ptr[0];
-		m->transform3x4(v->coord,v->ec);
+		m->transform3x4(v->coord, v->ec);
 
 		// projection coordinates
 		m = c->matrix_stack_ptr[1];




More information about the Scummvm-git-logs mailing list