[Scummvm-git-logs] scummvm master -> 4e34da374694388a5584de01092f916d27f6cac9

aquadran noreply at scummvm.org
Tue Dec 7 08:54:24 UTC 2021


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:
4e34da3746 TINYGL: Eliminate passing context


Commit: 4e34da374694388a5584de01092f916d27f6cac9
    https://github.com/scummvm/scummvm/commit/4e34da374694388a5584de01092f916d27f6cac9
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-07T09:54:19+01:00

Commit Message:
TINYGL: Eliminate passing context

Changed paths:
    graphics/tinygl/arrays.cpp
    graphics/tinygl/clear.cpp
    graphics/tinygl/light.cpp
    graphics/tinygl/list.cpp
    graphics/tinygl/matrix.cpp
    graphics/tinygl/misc.cpp
    graphics/tinygl/select.cpp
    graphics/tinygl/texture.cpp
    graphics/tinygl/vertex.cpp
    graphics/tinygl/zdirtyrect.cpp
    graphics/tinygl/zgl.h


diff --git a/graphics/tinygl/arrays.cpp b/graphics/tinygl/arrays.cpp
index e11b4fb98c..d0c1bb54af 100644
--- a/graphics/tinygl/arrays.cpp
+++ b/graphics/tinygl/arrays.cpp
@@ -35,7 +35,7 @@
 
 namespace TinyGL {
 
-void GLContext::glopArrayElement(GLContext *c, GLParam *param) {
+void GLContext::glopArrayElement(GLParam *param) {
 	int offset;
 	int states = client_states;
 	int idx = param[1].i;
@@ -91,7 +91,7 @@ void GLContext::glopArrayElement(GLContext *c, GLParam *param) {
 		default:
 			assert(0);
 		}
-		glopColor(c, p);
+		glopColor(p);
 	}
 	if (states & NORMAL_ARRAY) {
 		offset = idx * normal_array_stride;
@@ -132,7 +132,7 @@ void GLContext::glopArrayElement(GLContext *c, GLParam *param) {
 	if (states & TEXCOORD_ARRAY) {
 		int size = texcoord_array_size;
 		offset = idx * texcoord_array_stride;
-		switch (c->texcoord_array_type) {
+		switch (texcoord_array_type) {
 		case TGL_FLOAT: {
 				TGLfloat *array = (TGLfloat *)((TGLbyte *)texcoord_array + offset);
 				current_tex_coord.X = array[0];
@@ -209,24 +209,24 @@ void GLContext::glopArrayElement(GLContext *c, GLParam *param) {
 		default:
 			assert(0);
 		}
-		glopVertex(c, p);
+		glopVertex(p);
 	}
 }
 
-void GLContext::glopDrawArrays(GLContext *c, GLParam *p) {
+void GLContext::glopDrawArrays(GLParam *p) {
 	GLParam array_element[2];
 	GLParam begin[2];
 
 	begin[1].i = p[1].i;
-	glopBegin(c, begin);
+	glopBegin(begin);
 	for (int i = 0; i < p[3].i; i++) {
 		array_element[1].i = p[2].i + i;
-		glopArrayElement(c, array_element);
+		glopArrayElement(array_element);
 	}
-	glopEnd(c, NULL);
+	glopEnd(nullptr);
 }
 
-void GLContext::glopDrawElements(GLContext *c, GLParam *p) {
+void GLContext::glopDrawElements(GLParam *p) {
 	GLParam array_element[2];
 	void *indices;
 	GLParam begin[2];
@@ -234,7 +234,7 @@ void GLContext::glopDrawElements(GLContext *c, GLParam *p) {
 	indices = (char *)p[4].p;
 	begin[1].i = p[1].i;
 
-	glopBegin(c, begin);
+	glopBegin(begin);
 	for (int i = 0; i < p[2].i; i++) {
 		switch (p[3].i) {
 		case TGL_UNSIGNED_BYTE:
@@ -250,20 +250,20 @@ void GLContext::glopDrawElements(GLContext *c, GLParam *p) {
 			assert(0);
 			break;
 		}
-		glopArrayElement(c, array_element);
+		glopArrayElement(array_element);
 	}
-	glopEnd(c, NULL);
+	glopEnd(nullptr);
 }
 
-void GLContext::glopEnableClientState(GLContext *c, GLParam *p) {
+void GLContext::glopEnableClientState(GLParam *p) {
 	client_states |= p[1].i;
 }
 
-void GLContext::glopDisableClientState(GLContext *c, GLParam *p) {
+void GLContext::glopDisableClientState(GLParam *p) {
 	client_states &= p[1].i;
 }
 
-void GLContext::glopVertexPointer(GLContext *c, GLParam *p) {
+void GLContext::glopVertexPointer(GLParam *p) {
 	vertex_array_size = p[1].i;
 	vertex_array_type = p[2].i;
 	vertex_array = p[4].p;
@@ -286,7 +286,7 @@ void GLContext::glopVertexPointer(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopColorPointer(GLContext *c, GLParam *p) {
+void GLContext::glopColorPointer(GLParam *p) {
 	color_array_size = p[1].i;
 	color_array_type = p[2].i;
 	color_array = p[4].p;
@@ -315,7 +315,7 @@ void GLContext::glopColorPointer(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopNormalPointer(GLContext *c, GLParam *p) {
+void GLContext::glopNormalPointer(GLParam *p) {
 	normal_array_type = p[1].i;
 	normal_array = p[3].p;
 	switch (p[1].i) {
@@ -337,7 +337,7 @@ void GLContext::glopNormalPointer(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopTexCoordPointer(GLContext *c, GLParam *p) {
+void GLContext::glopTexCoordPointer(GLParam *p) {
 	texcoord_array_size = p[1].i;
 	texcoord_array_type = p[2].i;
 	texcoord_array = p[4].p;
diff --git a/graphics/tinygl/clear.cpp b/graphics/tinygl/clear.cpp
index 56890b9d65..3b91852ed9 100644
--- a/graphics/tinygl/clear.cpp
+++ b/graphics/tinygl/clear.cpp
@@ -31,15 +31,15 @@
 
 namespace TinyGL {
 
-void GLContext::glopClearColor(GLContext *c, GLParam *p) {
+void GLContext::glopClearColor(GLParam *p) {
 	clear_color = Vector4(p[1].f, p[2].f, p[3].f, p[4].f);
 }
 
-void GLContext::glopClearDepth(GLContext *c, GLParam *p) {
+void GLContext::glopClearDepth(GLParam *p) {
 	clear_depth = p[1].f;
 }
 
-void GLContext::glopClear(GLContext *c, GLParam *p) {
+void GLContext::glopClear(GLParam *p) {
 	int mask = p[1].i;
 	int z = (int)(clear_depth * ((1 << ZB_Z_BITS) - 1));
 	int r = (int)(clear_color.X * 255);
diff --git a/graphics/tinygl/light.cpp b/graphics/tinygl/light.cpp
index c18e89f92f..9fb0362183 100644
--- a/graphics/tinygl/light.cpp
+++ b/graphics/tinygl/light.cpp
@@ -30,7 +30,7 @@
 
 namespace TinyGL {
 
-void GLContext::glopMaterial(GLContext *c, GLParam *p) {
+void GLContext::glopMaterial(GLParam *p) {
 	int mode = p[1].i;
 	int type = p[2].i;
 	Vector4 v(p[3].f, p[4].f, p[5].f, p[6].f);
@@ -38,7 +38,7 @@ void GLContext::glopMaterial(GLContext *c, GLParam *p) {
 
 	if (mode == TGL_FRONT_AND_BACK) {
 		p[1].i = TGL_FRONT;
-		glopMaterial(c, p);
+		glopMaterial(p);
 		mode = TGL_BACK;
 	}
 	if (mode == TGL_FRONT)
@@ -73,7 +73,7 @@ void GLContext::glopMaterial(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopColorMaterial(GLContext *c, GLParam *p) {
+void GLContext::glopColorMaterial(GLParam *p) {
 	int mode = p[1].i;
 	int type = p[2].i;
 
@@ -81,7 +81,7 @@ void GLContext::glopColorMaterial(GLContext *c, GLParam *p) {
 	current_color_material_type = type;
 }
 
-void GLContext::glopLight(GLContext *c, GLParam *p) {
+void GLContext::glopLight(GLParam *p) {
 	int light = p[1].i;
 	int type = p[2].i;
 	Vector4 v(p[3].f, p[4].f, p[5].f, p[6].f);
@@ -104,7 +104,7 @@ void GLContext::glopLight(GLContext *c, GLParam *p) {
 		break;
 	case TGL_POSITION: {
 		Vector4 pos;
-		c->matrix_stack_ptr[0]->transform(v, pos);
+		matrix_stack_ptr[0]->transform(v, pos);
 
 		l->position = pos;
 
@@ -148,7 +148,7 @@ void GLContext::glopLight(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopLightModel(GLContext *c, GLParam *p) {
+void GLContext::glopLightModel(GLParam *p) {
 	int pname = p[1].i;
 
 	switch (pname) {
diff --git a/graphics/tinygl/list.cpp b/graphics/tinygl/list.cpp
index 3b698578b7..43abfd5ced 100644
--- a/graphics/tinygl/list.cpp
+++ b/graphics/tinygl/list.cpp
@@ -38,7 +38,7 @@ namespace TinyGL {
 #define ADD_OP(aa, bb, ff) \
 static void glop ## aa (GLContext *c, GLParam *p) \
 {                                                 \
-	c->glop ## aa (c, p);                         \
+	c->glop ## aa (p);                            \
 }
 #include "graphics/tinygl/opinfo.h"
 
@@ -176,21 +176,21 @@ void GLContext::gl_add_op(GLParam *p) {
 }
 
 // this opcode is never called directly
-void GLContext::glopEndList(GLContext *, GLParam *) {
+void GLContext::glopEndList(GLParam *) {
 	assert(0);
 }
 
 // this opcode is never called directly
-void GLContext::glopNextBuffer(GLContext *, GLParam *) {
+void GLContext::glopNextBuffer(GLParam *) {
 	assert(0);
 }
 
-void GLContext::glopCallList(GLContext *c, GLParam *p) {
+void GLContext::glopCallList(GLParam *p) {
 	GLList *l;
 	int list, op;
 
 	list = p[1].ui;
-	l = find_list(c, list);
+	l = find_list(this, list);
 	if (!l)
 		error("list %d not defined", list);
 	p = l->first_op_buffer->ops;
@@ -202,7 +202,7 @@ void GLContext::glopCallList(GLContext *c, GLParam *p) {
 		if (op == OP_NextBuffer) {
 			p = (GLParam *)p[1].p;
 		} else {
-			op_table_func[op](c, p);
+			op_table_func[op](this, p);
 			p += op_table_size[op];
 		}
 	}
diff --git a/graphics/tinygl/matrix.cpp b/graphics/tinygl/matrix.cpp
index 4cfdedd124..0c246b9389 100644
--- a/graphics/tinygl/matrix.cpp
+++ b/graphics/tinygl/matrix.cpp
@@ -43,7 +43,7 @@ static inline void gl_matrix_update(GLContext *c) {
 	c->matrix_model_projection_updated |= (c->matrix_mode <= 1);
 }
 
-void GLContext::glopMatrixMode(GLContext *c, GLParam *p) {
+void GLContext::glopMatrixMode(GLParam *p) {
 	int mode = p[1].i;
 	switch (mode) {
 	case TGL_MODELVIEW:
@@ -60,11 +60,11 @@ void GLContext::glopMatrixMode(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopLoadMatrix(GLContext *c, GLParam *p) {
+void GLContext::glopLoadMatrix(GLParam *p) {
 	Matrix4 *m;
 	GLParam *q;
 
-	m = matrix_stack_ptr[c->matrix_mode];
+	m = matrix_stack_ptr[matrix_mode];
 	q = p + 1;
 
 	for (int i = 0; i < 4; i++) {
@@ -75,15 +75,15 @@ void GLContext::glopLoadMatrix(GLContext *c, GLParam *p) {
 		q += 4;
 	}
 
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopLoadIdentity(GLContext *c, GLParam *) {
+void GLContext::glopLoadIdentity(GLParam *) {
 	matrix_stack_ptr[matrix_mode]->identity();
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopMultMatrix(GLContext *c, GLParam *p) {
+void GLContext::glopMultMatrix(GLParam *p) {
 	Matrix4 m;
 	GLParam *q;
 	q = p + 1;
@@ -98,11 +98,11 @@ void GLContext::glopMultMatrix(GLContext *c, GLParam *p) {
 
 	*matrix_stack_ptr[matrix_mode] *= m;
 
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
 
-void GLContext::glopPushMatrix(GLContext *c, GLParam *) {
+void GLContext::glopPushMatrix(GLParam *) {
 	int n = matrix_mode;
 	Matrix4 *m;
 
@@ -112,18 +112,18 @@ void GLContext::glopPushMatrix(GLContext *c, GLParam *) {
 
 	m[0] = m[-1];
 
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopPopMatrix(GLContext *c, GLParam *) {
+void GLContext::glopPopMatrix(GLParam *) {
 	int n = matrix_mode;
 
 	assert(matrix_stack_ptr[n] > matrix_stack[n]);
 	matrix_stack_ptr[n]--;
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopRotate(GLContext *c, GLParam *p) {
+void GLContext::glopRotate(GLParam *p) {
 	Matrix4 m;
 	float u[3];
 	float angle;
@@ -192,20 +192,20 @@ void GLContext::glopRotate(GLContext *c, GLParam *p) {
 
 	*matrix_stack_ptr[matrix_mode] *= m;
 
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopScale(GLContext *c, GLParam *p) {
+void GLContext::glopScale(GLParam *p) {
 	matrix_stack_ptr[matrix_mode]->scale(p[1].f, p[2].f, p[3].f);
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopTranslate(GLContext *c, GLParam *p) {
+void GLContext::glopTranslate(GLParam *p) {
 	matrix_stack_ptr[matrix_mode]->translate(p[1].f, p[2].f, p[3].f);
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopFrustum(GLContext *c, GLParam *p) {
+void GLContext::glopFrustum(GLParam *p) {
 	float left = p[1].f;
 	float right = p[2].f;
 	float bottom = p[3].f;
@@ -216,10 +216,10 @@ void GLContext::glopFrustum(GLContext *c, GLParam *p) {
 
 	*matrix_stack_ptr[matrix_mode] *= m;
 
-	gl_matrix_update(c);
+	gl_matrix_update(this);
 }
 
-void GLContext::glopOrtho(GLContext *context, GLParam *p) {
+void GLContext::glopOrtho(GLParam *p) {
 	float *r;
 	TinyGL::Matrix4 m;
 	float left = p[1].f;
@@ -243,8 +243,8 @@ void GLContext::glopOrtho(GLContext *context, GLParam *p) {
 	r[8] = 0; r[9] = 0; r[10] = c; r[11] = tz;
 	r[12] = 0; r[13] = 0; r[14] = 0; r[15] = 1;
 
-	*context->matrix_stack_ptr[context->matrix_mode] *= m;
-	gl_matrix_update(context);
+	*matrix_stack_ptr[matrix_mode] *= m;
+	gl_matrix_update(this);
 }
 
 } // end of namespace TinyGL
diff --git a/graphics/tinygl/misc.cpp b/graphics/tinygl/misc.cpp
index 615fe0b243..5c0f98d534 100644
--- a/graphics/tinygl/misc.cpp
+++ b/graphics/tinygl/misc.cpp
@@ -30,7 +30,7 @@
 
 namespace TinyGL {
 
-void GLContext::glopViewport(GLContext *c, GLParam *p) {
+void GLContext::glopViewport(GLParam *p) {
 	int xsize, ysize, xmin, ymin, xsize_req, ysize_req;
 
 	xmin = p[1].i;
@@ -46,7 +46,7 @@ void GLContext::glopViewport(GLContext *c, GLParam *p) {
 		xsize_req = xmin + xsize;
 		ysize_req = ymin + ysize;
 
-		if (gl_resize_viewport && gl_resize_viewport(c, &xsize_req, &ysize_req) != 0) {
+		if (gl_resize_viewport && gl_resize_viewport(&xsize_req, &ysize_req) != 0) {
 			error("glViewport: error while resizing display");
 		}
 
@@ -65,7 +65,7 @@ void GLContext::glopViewport(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopEnableDisable(GLContext *c, GLParam *p) {
+void GLContext::glopEnableDisable(GLParam *p) {
 	int code = p[1].i;
 	int v = p[2].i;
 
@@ -135,39 +135,39 @@ void GLContext::glopEnableDisable(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopBlendFunc(GLContext *c, GLParam *p) {
+void GLContext::glopBlendFunc(GLParam *p) {
 	TGLenum sfactor = p[1].i;
 	TGLenum dfactor = p[2].i;
 	fb->setBlendingFactors(sfactor, dfactor);
 }
 
-void GLContext::glopAlphaFunc(GLContext *c, GLParam *p) {
+void GLContext::glopAlphaFunc(GLParam *p) {
 	TGLenum func = p[1].i;
 	float ref = p[2].f;
 	fb->setAlphaTestFunc(func, (int)(ref * 255));
 }
 
-void GLContext::glopDepthFunc(GLContext *c, GLParam *p) {
+void GLContext::glopDepthFunc(GLParam *p) {
 	TGLenum func = p[1].i;
 	fb->setDepthFunc(func);
 }
 
-void GLContext::glopShadeModel(GLContext *c, GLParam *p) {
+void GLContext::glopShadeModel(GLParam *p) {
 	int code = p[1].i;
 	current_shade_model = code;
 }
 
-void GLContext::glopCullFace(GLContext *c, GLParam *p) {
+void GLContext::glopCullFace(GLParam *p) {
 	int code = p[1].i;
 	current_cull_face = code;
 }
 
-void GLContext::glopFrontFace(GLContext *c, GLParam *p) {
+void GLContext::glopFrontFace(GLParam *p) {
 	int code = p[1].i;
 	current_front_face = code;
 }
 
-void GLContext::glopPolygonMode(GLContext *c, GLParam *p) {
+void GLContext::glopPolygonMode(GLParam *p) {
 	int face = p[1].i;
 	int mode = p[2].i;
 
@@ -187,20 +187,20 @@ void GLContext::glopPolygonMode(GLContext *c, GLParam *p) {
 	}
 }
 
-void GLContext::glopHint(GLContext *, GLParam *) {
+void GLContext::glopHint(GLParam *) {
 	// do nothing
 }
 
-void GLContext::glopPolygonOffset(GLContext *c, GLParam *p) {
+void GLContext::glopPolygonOffset(GLParam *p) {
 	offset_factor = p[1].f;
 	offset_units = p[2].f;
 }
 
-void GLContext::glopColorMask(GLContext *c, TinyGL::GLParam *p) {
+void GLContext::glopColorMask(GLParam *p) {
 	color_mask = p[1].i;
 }
 
-void GLContext::glopDepthMask(GLContext *c, TinyGL::GLParam *p) {
+void GLContext::glopDepthMask(TinyGL::GLParam *p) {
 	fb->enableDepthWrite(p[1].i);
 }
 
diff --git a/graphics/tinygl/select.cpp b/graphics/tinygl/select.cpp
index 19898497c9..cd27b0cca6 100644
--- a/graphics/tinygl/select.cpp
+++ b/graphics/tinygl/select.cpp
@@ -77,22 +77,22 @@ void tglSelectBuffer(int size, unsigned int *buf) {
 	c->select_size = size;
 }
 
-void GLContext::glopInitNames(GLContext *c, GLParam *) {
+void GLContext::glopInitNames(GLParam *) {
 	if (render_mode == TGL_SELECT) {
 		name_stack_size = 0;
 		select_hit = NULL;
 	}
 }
 
-void GLContext::glopPushName(GLContext *c, GLParam *p) {
-	if (c->render_mode == TGL_SELECT) {
-		assert(c->name_stack_size < MAX_NAME_STACK_DEPTH);
-		name_stack[c->name_stack_size++] = p[1].i;
+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;
 	}
 }
 
-void GLContext::glopPopName(GLContext *c, GLParam *) {
+void GLContext::glopPopName(GLParam *) {
 	if (render_mode == TGL_SELECT) {
 		assert(name_stack_size > 0);
 		name_stack_size--;
@@ -100,7 +100,7 @@ void GLContext::glopPopName(GLContext *c, GLParam *) {
 	}
 }
 
-void GLContext::glopLoadName(GLContext *c, GLParam *p) {
+void GLContext::glopLoadName(GLParam *p) {
 	if (render_mode == TGL_SELECT) {
 		assert(name_stack_size > 0);
 		name_stack[name_stack_size - 1] = p[1].i;
diff --git a/graphics/tinygl/texture.cpp b/graphics/tinygl/texture.cpp
index fcf9b04269..bcdafe83e4 100644
--- a/graphics/tinygl/texture.cpp
+++ b/graphics/tinygl/texture.cpp
@@ -112,21 +112,21 @@ void GLContext::glInitTextures() {
 	colorAssociationList.push_back({Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0),  TGL_RGBA, TGL_UNSIGNED_SHORT_4_4_4_4});
 }
 
-void GLContext::glopBindTexture(GLContext *c, GLParam *p) {
+void GLContext::glopBindTexture(GLParam *p) {
 	int target = p[1].i;
 	int texture = p[2].i;
 	GLTexture *t;
 
 	assert(target == TGL_TEXTURE_2D && texture >= 0);
 
-	t = find_texture(c, texture);
+	t = find_texture(this, texture);
 	if (!t) {
 		t = alloc_texture(texture);
 	}
 	current_texture = t;
 }
 
-void GLContext::glopTexImage2D(GLContext *c, GLParam *p) {
+void GLContext::glopTexImage2D(GLParam *p) {
 	int target = p[1].i;
 	int level = p[2].i;
 	int internalformat = p[3].i;
@@ -214,7 +214,7 @@ void GLContext::glopTexImage2D(GLContext *c, GLParam *p) {
 }
 
 // TODO: not all tests are done
-void GLContext::glopTexEnv(GLContext *, GLParam *p) {
+void GLContext::glopTexEnv(GLParam *p) {
 	int target = p[1].i;
 	int pname = p[2].i;
 	int param = p[3].i;
@@ -232,7 +232,7 @@ error:
 }
 
 // TODO: not all tests are done
-void GLContext::glopTexParameter(GLContext *c, GLParam *p) {
+void GLContext::glopTexParameter(GLParam *p) {
 	int target = p[1].i;
 	int pname = p[2].i;
 	int param = p[3].i;
@@ -278,7 +278,7 @@ error:
 	}
 }
 
-void GLContext::glopPixelStore(GLContext *, GLParam *p) {
+void GLContext::glopPixelStore(GLParam *p) {
 	int pname = p[1].i;
 	int param = p[2].i;
 
diff --git a/graphics/tinygl/vertex.cpp b/graphics/tinygl/vertex.cpp
index eecc6f977d..223633bec5 100644
--- a/graphics/tinygl/vertex.cpp
+++ b/graphics/tinygl/vertex.cpp
@@ -31,25 +31,25 @@
 
 namespace TinyGL {
 
-void GLContext::glopNormal(GLContext *c, GLParam *p) {
+void GLContext::glopNormal(GLParam *p) {
 	current_normal.X = p[1].f;
 	current_normal.Y = p[2].f;
 	current_normal.Z = p[3].f;
 	current_normal.W = 0.0f;
 }
 
-void GLContext::glopTexCoord(GLContext *c, GLParam *p) {
+void GLContext::glopTexCoord(GLParam *p) {
 	current_tex_coord.X = p[1].f;
 	current_tex_coord.Y = p[2].f;
 	current_tex_coord.Z = p[3].f;
 	current_tex_coord.W = p[4].f;
 }
 
-void GLContext::glopEdgeFlag(GLContext *c, GLParam *p) {
+void GLContext::glopEdgeFlag(GLParam *p) {
 	current_edge_flag = p[1].i;
 }
 
-void GLContext::glopColor(GLContext *c, GLParam *p) {
+void GLContext::glopColor(GLParam *p) {
 	current_color.X = p[1].f;
 	current_color.Y = p[2].f;
 	current_color.Z = p[3].f;
@@ -64,18 +64,18 @@ void GLContext::glopColor(GLContext *c, GLParam *p) {
 		q[4].f = p[2].f;
 		q[5].f = p[3].f;
 		q[6].f = p[4].f;
-		glopMaterial(c, q);
+		glopMaterial(q);
 	}
 }
 
-static void gl_eval_viewport(GLContext *c) {
+void GLContext::gl_eval_viewport() {
 	GLViewport *v;
 	float zsize = (1 << (ZB_Z_BITS + ZB_POINT_Z_FRAC_BITS));
 
-	v = &c->viewport;
+	v = &viewport;
 
 	// v->ymin needs to be upside down for transformation
-	int ymin = c->fb->ysize - v->ysize - v->ymin;
+	int ymin = fb->ysize - v->ysize - v->ymin;
 	v->trans.X = (float)(((v->xsize - 0.5) / 2.0) + v->xmin);
 	v->trans.Y = (float)(((v->ysize - 0.5) / 2.0) + ymin);
 	v->trans.Z = (float)(((zsize - 0.5) / 2.0) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2);
@@ -86,10 +86,10 @@ static void gl_eval_viewport(GLContext *c) {
 	v->scale.Z = (float)(-((zsize - 0.5) / 2.0));
 }
 
-void GLContext::glopBegin(GLContext *c, GLParam *p) {
+void GLContext::glopBegin(GLParam *p) {
 	int type;
 
-	assert(c->in_begin == 0);
+	assert(in_begin == 0);
 
 	type = p[1].i;
 	begin_type = type;
@@ -119,7 +119,7 @@ void GLContext::glopBegin(GLContext *c, GLParam *p) {
 
 	// viewport
 	if (viewport.updated) {
-		gl_eval_viewport(c);
+		gl_eval_viewport();
 		viewport.updated = 0;
 	}
 	// triangle drawing functions
@@ -139,7 +139,7 @@ void GLContext::glopBegin(GLContext *c, GLParam *p) {
 			break;
 		}
 
-		switch (c->polygon_mode_back) {
+		switch (polygon_mode_back) {
 		case TGL_POINT:
 			draw_triangle_back = gl_draw_triangle_point;
 			break;
@@ -191,7 +191,7 @@ static inline void gl_vertex_transform(GLContext *c, GLVertex *v) {
 	v->clip_code = gl_clipcode(v->pc.X, v->pc.Y, v->pc.Z, v->pc.W);
 }
 
-void GLContext::glopVertex(GLContext *c, GLParam *p) {
+void GLContext::glopVertex(GLParam *p) {
 	GLVertex *v;
 	int n, cnt;
 
@@ -223,7 +223,7 @@ void GLContext::glopVertex(GLContext *c, GLParam *p) {
 	v->coord.Z = p[3].f;
 	v->coord.W = p[4].f;
 
-	gl_vertex_transform(c, v);
+	gl_vertex_transform(this, v);
 
 	// color
 
@@ -253,7 +253,7 @@ void GLContext::glopVertex(GLContext *c, GLParam *p) {
 	vertex_n = n;
 }
 
-void GLContext::glopEnd(GLContext *c, GLParam *) {
+void GLContext::glopEnd(GLParam *) {
 	assert(in_begin == 1);
 
 	if (vertex_cnt > 0) {
diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp
index 9eb95093bf..20f9f4121a 100644
--- a/graphics/tinygl/zdirtyrect.cpp
+++ b/graphics/tinygl/zdirtyrect.cpp
@@ -210,8 +210,8 @@ void GLContext::presentBufferDirtyRects() {
 
 		bool blendingEnabled = fb->isBlendingEnabled();
 		bool alphaTestEnabled = fb->isAlphaTestEnabled();
-		c->fb->enableBlending(false);
-		c->fb->enableAlphaTest(false);
+		fb->enableBlending(false);
+		fb->enableAlphaTest(false);
 
 		for (RectangleIterator it = rectangles.begin(); it != rectangles.end(); ++it) {
 			DebugDrawRectangle((*it).rectangle, (*it).r, (*it).g, (*it).b);
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index cfe744d70e..c332ec48ee 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -389,7 +389,7 @@ struct GLContext {
 	// opaque structure for user's use
 	void *opaque;
 	// resize viewport function
-	int (*gl_resize_viewport)(GLContext *c, int *xsize, int *ysize);
+	int (*gl_resize_viewport)(int *xsize, int *ysize);
 
 	// depth test
 	int depth_test;
@@ -411,12 +411,13 @@ struct GLContext {
 public:
 	// The glob* functions exposed to public, however they are only for internal use.
 	// Calling them from outside of TinyGL is forbidden
-	#define ADD_OP(a, b, d) void glop ## a (GLContext *c, GLParam *p);
+	#define ADD_OP(a, b, d) void glop ## a (GLParam *p);
 	#include "graphics/tinygl/opinfo.h"
 
 	void gl_add_op(GLParam *p);
 	void gl_compile_op(GLParam *p);
 
+	void gl_eval_viewport();
 	void gl_transform_to_viewport(GLVertex *v);
 	void gl_draw_triangle(GLVertex *p0, GLVertex *p1, GLVertex *p2);
 	void gl_draw_line(GLVertex *p0, GLVertex *p1);




More information about the Scummvm-git-logs mailing list