shithub: cstory

Download patch

ref: 5756612212bbf1e0a727131a7b19d4e1fc0c540e
parent: 196ff6ac2f92888d67b341729918277307f25bba
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Oct 14 15:33:35 EDT 2020

3DS - Cleanup

--- a/src/Backends/Rendering/3DS.cpp
+++ b/src/Backends/Rendering/3DS.cpp
@@ -43,7 +43,7 @@
 
 static bool frame_started;
 
-static size_t NextPowerOfTwo(size_t value)
+static size_t RoundUpToPowerOfTwo(size_t value)
 {
 	size_t accumulator = 1;
 
@@ -57,10 +57,10 @@
 {
 	static bool previous_setting = true;
 
-	// Setting will not take effect mid-frame, so
-	// break-up the current frame if we have to.
 	if (enabled != previous_setting)
 	{
+		// Setting will not take effect mid-frame, so
+		// break-up the current frame if we have to.
 		if (frame_started)
 			C2D_Flush();
 
@@ -194,7 +194,7 @@
 
 		memset(&surface->texture, 0, sizeof(surface->texture));
 
-		if ((render_target ? C3D_TexInitVRAM : C3D_TexInit)(&surface->texture, NextPowerOfTwo(width), NextPowerOfTwo(height), GPU_RGBA8))
+		if ((render_target ? C3D_TexInitVRAM : C3D_TexInit)(&surface->texture, RoundUpToPowerOfTwo(width), RoundUpToPowerOfTwo(height), GPU_RGBA8))
 		{
 			C3D_TexSetFilter(&surface->texture, GPU_NEAREST, GPU_NEAREST);
 
@@ -358,8 +358,8 @@
 {
 	RenderBackend_GlyphAtlas *atlas = (RenderBackend_GlyphAtlas*)malloc(sizeof(RenderBackend_GlyphAtlas));
 
-	width = NextPowerOfTwo(width);
-	height = NextPowerOfTwo(height);
+	width = RoundUpToPowerOfTwo(width);
+	height = RoundUpToPowerOfTwo(height);
 
 	if (atlas != NULL)
 	{