[Scummvm-git-logs] scummvm master -> 86dc65250e8cbaea91480aee85d55f98f5ed32af

aquadran noreply at scummvm.org
Sat Dec 4 13:27:40 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:
86dc65250e TINYGL: Cleanup code


Commit: 86dc65250e8cbaea91480aee85d55f98f5ed32af
    https://github.com/scummvm/scummvm/commit/86dc65250e8cbaea91480aee85d55f98f5ed32af
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-04T14:27:35+01:00

Commit Message:
TINYGL: Cleanup code

Changed paths:
    graphics/tinygl/init.cpp
    graphics/tinygl/texture.cpp
    graphics/tinygl/zgl.h


diff --git a/graphics/tinygl/init.cpp b/graphics/tinygl/init.cpp
index e391840c9e..b08270fb01 100644
--- a/graphics/tinygl/init.cpp
+++ b/graphics/tinygl/init.cpp
@@ -45,7 +45,8 @@ void initSharedState(GLContext *c) {
 void endSharedState(GLContext *c) {
 	GLSharedState *s = &c->shared_state;
 
-	free_texture(c, 0);
+	uint h = 0;
+	free_texture(c, h);
 	for (int i = 0; i < MAX_DISPLAY_LISTS; i++) {
 		// TODO
 	}
diff --git a/graphics/tinygl/texture.cpp b/graphics/tinygl/texture.cpp
index 56267d71ea..91052c271b 100644
--- a/graphics/tinygl/texture.cpp
+++ b/graphics/tinygl/texture.cpp
@@ -34,7 +34,7 @@
 
 namespace TinyGL {
 
-static GLTexture *find_texture(GLContext *c, unsigned int h) {
+static GLTexture *find_texture(GLContext *c, uint h) {
 	GLTexture *t;
 
 	t = c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE];
@@ -43,10 +43,10 @@ static GLTexture *find_texture(GLContext *c, unsigned int h) {
 			return t;
 		t = t->next;
 	}
-	return NULL;
+	return nullptr;
 }
 
-void free_texture(GLContext *c, int h) {
+void free_texture(GLContext *c, uint h) {
 	free_texture(c, find_texture(c, h));
 }
 
@@ -74,7 +74,7 @@ void free_texture(GLContext *c, GLTexture *t) {
 	gl_free(t);
 }
 
-GLTexture *alloc_texture(GLContext *c, int h) {
+GLTexture *alloc_texture(GLContext *c, uint h) {
 	GLTexture *t, **ht;
 
 	t = (GLTexture *)gl_zalloc(sizeof(GLTexture));
@@ -82,7 +82,7 @@ GLTexture *alloc_texture(GLContext *c, int h) {
 	ht = &c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE];
 
 	t->next = *ht;
-	t->prev = NULL;
+	t->prev = nullptr;
 	if (t->next)
 		t->next->prev = t;
 	*ht = t;
@@ -95,13 +95,11 @@ GLTexture *alloc_texture(GLContext *c, int h) {
 }
 
 void glInitTextures(GLContext *c) {
-	// textures
 	c->texture_2d_enabled = 0;
 	c->current_texture = find_texture(c, 0);
 	c->texture_mag_filter = TGL_LINEAR;
 	c->texture_min_filter = TGL_NEAREST_MIPMAP_LINEAR;
 #if defined(SCUMM_LITTLE_ENDIAN)
-	c->colorAssociationList.push_back({Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), TGL_RGBA, TGL_UNSIGNED_BYTE});
 	c->colorAssociationList.push_back({Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), TGL_RGBA, TGL_UNSIGNED_BYTE});
 	c->colorAssociationList.push_back({Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24), TGL_BGRA, TGL_UNSIGNED_BYTE});
 	c->colorAssociationList.push_back({Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0),  TGL_RGB,  TGL_UNSIGNED_BYTE});
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 9a09d593e4..a3c8fac1f4 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -433,8 +433,8 @@ void gl_shade_vertex(GLContext *c, GLVertex *v);
 
 void glInitTextures(GLContext *c);
 void glEndTextures(GLContext *c);
-GLTexture *alloc_texture(GLContext *c, int h);
-void free_texture(GLContext *c, int h);
+GLTexture *alloc_texture(GLContext *c, uint h);
+void free_texture(GLContext *c, uint h);
 void free_texture(GLContext *c, GLTexture *t);
 
 // image_util.c




More information about the Scummvm-git-logs mailing list