Cosmetics

Rename some arguments, since atlases->atlases is awful.
This commit is contained in:
Matthias Clasen 2019-06-05 12:03:39 +00:00
parent d90143d09c
commit 0dcb71722a

View File

@ -21,37 +21,37 @@ free_atlas (gpointer v)
GskGLTextureAtlases * GskGLTextureAtlases *
gsk_gl_texture_atlases_new (void) gsk_gl_texture_atlases_new (void)
{ {
GskGLTextureAtlases *atlases; GskGLTextureAtlases *self;
atlases = g_new (GskGLTextureAtlases, 1); self = g_new (GskGLTextureAtlases, 1);
atlases->atlases = g_ptr_array_new_with_free_func (free_atlas); self->atlases = g_ptr_array_new_with_free_func (free_atlas);
atlases->ref_count = 1; self->ref_count = 1;
return atlases; return self;
} }
GskGLTextureAtlases * GskGLTextureAtlases *
gsk_gl_texture_atlases_ref (GskGLTextureAtlases *atlases) gsk_gl_texture_atlases_ref (GskGLTextureAtlases *self)
{ {
atlases->ref_count++; self->ref_count++;
return atlases; return self;
} }
void void
gsk_gl_texture_atlases_unref (GskGLTextureAtlases *atlases) gsk_gl_texture_atlases_unref (GskGLTextureAtlases *self)
{ {
g_assert (atlases->ref_count > 0); g_assert (self->ref_count > 0);
if (atlases->ref_count == 1) if (self->ref_count == 1)
{ {
g_ptr_array_unref (atlases->atlases); g_ptr_array_unref (self->atlases);
g_free (atlases); g_free (self);
return; return;
} }
atlases->ref_count--; self->ref_count--;
} }
#if 0 #if 0
@ -74,13 +74,13 @@ write_atlas_to_png (GskGLTextureAtlas *atlas,
#endif #endif
void void
gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *atlases) gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *self)
{ {
int i; int i;
for (i = atlases->atlases->len - 1; i >= 0; i--) for (i = self->atlases->len - 1; i >= 0; i--)
{ {
GskGLTextureAtlas *atlas = g_ptr_array_index (atlases->atlases, i); GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i);
if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO) if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO)
{ {
@ -94,7 +94,7 @@ gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *atlases)
atlas->texture_id = 0; atlas->texture_id = 0;
} }
g_ptr_array_remove_index (atlases->atlases, i); g_ptr_array_remove_index (self->atlases, i);
} }
} }
@ -104,9 +104,9 @@ gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *atlases)
timestamp++; timestamp++;
if (timestamp % 10 == 0) if (timestamp % 10 == 0)
for (i = 0; i < atlases->atlases->len; i++) for (i = 0; i < self->atlases->len; i++)
{ {
GskGLTextureAtlas *atlas = g_ptr_array_index (atlases->atlases, i); GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i);
if (atlas->texture_id) if (atlas->texture_id)
{ {
@ -122,7 +122,7 @@ gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *atlases)
} }
gboolean gboolean
gsk_gl_texture_atlases_pack (GskGLTextureAtlases *atlases, gsk_gl_texture_atlases_pack (GskGLTextureAtlases *self,
int width, int width,
int height, int height,
GskGLTextureAtlas **atlas_out, GskGLTextureAtlas **atlas_out,
@ -138,9 +138,9 @@ gsk_gl_texture_atlases_pack (GskGLTextureAtlases *atlases,
atlas = NULL; atlas = NULL;
for (i = 0; i < atlases->atlases->len; i++) for (i = 0; i < self->atlases->len; i++)
{ {
atlas = g_ptr_array_index (atlases->atlases, i); atlas = g_ptr_array_index (self->atlases, i);
if (gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y)) if (gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y))
break; break;
@ -154,7 +154,7 @@ gsk_gl_texture_atlases_pack (GskGLTextureAtlases *atlases,
atlas = g_malloc (sizeof (GskGLTextureAtlas)); atlas = g_malloc (sizeof (GskGLTextureAtlas));
gsk_gl_texture_atlas_init (atlas, ATLAS_SIZE, ATLAS_SIZE); gsk_gl_texture_atlas_init (atlas, ATLAS_SIZE, ATLAS_SIZE);
gsk_gl_texture_atlas_realize (atlas); gsk_gl_texture_atlas_realize (atlas);
g_ptr_array_add (atlases->atlases, atlas); g_ptr_array_add (self->atlases, atlas);
/* Pack it onto that one, which surely has enough space... */ /* Pack it onto that one, which surely has enough space... */
gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y); gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y);