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

aquadran noreply at scummvm.org
Sat Jan 1 16:21:46 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:
a70168e416 TINYGL: Split/move functions to API and internal implementation.


Commit: a70168e41611b796367729bd166bffa5353d9df1
    https://github.com/scummvm/scummvm/commit/a70168e41611b796367729bd166bffa5353d9df1
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-01-01T17:21:42+01:00

Commit Message:
TINYGL: Split/move functions to API and internal implementation.

Changed paths:
    graphics/tinygl/api.cpp
    graphics/tinygl/select.cpp
    graphics/tinygl/zgl.h


diff --git a/graphics/tinygl/api.cpp b/graphics/tinygl/api.cpp
index 54334962321..355b0d92c0a 100644
--- a/graphics/tinygl/api.cpp
+++ b/graphics/tinygl/api.cpp
@@ -632,6 +632,17 @@ void tglClearStencil(TGLint s) {
 	c->gl_add_op(p);
 }
 
+void tglPolygonOffset(TGLfloat factor, TGLfloat units) {
+	TinyGL::GLContext *c = TinyGL::gl_get_context();
+	TinyGL::GLParam p[3];
+
+	p[0].op = TinyGL::OP_PolygonOffset;
+	p[1].f = factor;
+	p[2].f = units;
+
+	c->gl_add_op(p);
+}
+
 void tglFlush() {
 	// nothing to do
 }
@@ -774,15 +785,16 @@ void tglLoadName(TGLuint name) {
 	c->gl_add_op(p);
 }
 
-void tglPolygonOffset(TGLfloat factor, TGLfloat units) {
+TGLint tglRenderMode(TGLenum mode) {
 	TinyGL::GLContext *c = TinyGL::gl_get_context();
-	TinyGL::GLParam p[3];
 
-	p[0].op = TinyGL::OP_PolygonOffset;
-	p[1].f = factor;
-	p[2].f = units;
+	return c->gl_RenderMode(mode);
+}
 
-	c->gl_add_op(p);
+void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
+	TinyGL::GLContext *c = TinyGL::gl_get_context();
+
+	c->gl_SelectBuffer(size, buffer);
 }
 
 // lists
diff --git a/graphics/tinygl/select.cpp b/graphics/tinygl/select.cpp
index bd2d860feed..5863ea5d344 100644
--- a/graphics/tinygl/select.cpp
+++ b/graphics/tinygl/select.cpp
@@ -29,37 +29,36 @@
 
 namespace TinyGL {
 
-TGLint tglRenderMode(TGLenum mode) {
-	GLContext *c = gl_get_context();
+TGLint GLContext::gl_RenderMode(TGLenum mode) {
 	int result = 0;
 
-	switch (c->render_mode) {
+	switch (render_mode) {
 	case TGL_RENDER:
 		break;
 	case TGL_SELECT:
-		if (c->select_overflow) {
-			result = -c->select_hits;
+		if (select_overflow) {
+			result = -select_hits;
 		} else {
-			result = c->select_hits;
+			result = select_hits;
 		}
-		c->select_overflow = 0;
-		c->select_ptr = c->select_buffer;
-		c->name_stack_size = 0;
+		select_overflow = 0;
+		select_ptr = select_buffer;
+		name_stack_size = 0;
 		break;
 	default:
 		assert(0);
 	}
 	switch (mode) {
 	case TGL_RENDER:
-		c->render_mode = TGL_RENDER;
+		render_mode = TGL_RENDER;
 		break;
 	case TGL_SELECT:
-		c->render_mode = TGL_SELECT;
-		assert(c->select_buffer != nullptr);
-		c->select_ptr = c->select_buffer;
-		c->select_hits = 0;
-		c->select_overflow = 0;
-		c->select_hit = nullptr;
+		render_mode = TGL_SELECT;
+		assert(select_buffer != nullptr);
+		select_ptr = select_buffer;
+		select_hits = 0;
+		select_overflow = 0;
+		select_hit = nullptr;
 		break;
 	default:
 		assert(0);
@@ -67,13 +66,11 @@ TGLint tglRenderMode(TGLenum mode) {
 	return result;
 }
 
-void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
-	GLContext *c = gl_get_context();
-
-	assert(c->render_mode != TGL_SELECT);
+void GLContext::gl_SelectBuffer(TGLsizei size, TGLuint *buffer) {
+	assert(render_mode != TGL_SELECT);
 
-	c->select_buffer = buffer;
-	c->select_size = size;
+	select_buffer = buffer;
+	select_size = size;
 }
 
 void GLContext::glopInitNames(GLParam *) {
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 74c168eb53e..493fa86e6e5 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -485,6 +485,9 @@ public:
 	GLSpecBuf *specbuf_get_buffer(const int shininess_i, const float shininess);
 	void specbuf_cleanup();
 
+	TGLint gl_RenderMode(TGLenum mode);
+	void gl_SelectBuffer(TGLsizei size, TGLuint *buffer);
+
 	GLList *alloc_list(int list);
 	GLList *find_list(uint list);
 	void delete_list(int list);




More information about the Scummvm-git-logs mailing list