mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Use pre-increment when post-increment is not necessary
This commit is contained in:
parent
fbd624bcf3
commit
a3b27b4a6d
@ -7559,7 +7559,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
|
|||||||
if (exts_i == NULL) {
|
if (exts_i == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
|
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
|
||||||
size_t len = strlen(gl_str_tmp) + 1;
|
size_t len = strlen(gl_str_tmp) + 1;
|
||||||
|
|
||||||
@ -7580,7 +7580,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
|
|||||||
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
|
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
|
||||||
if (exts_i != NULL) {
|
if (exts_i != NULL) {
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
free((void *) (exts_i[index]));
|
free((void *) (exts_i[index]));
|
||||||
}
|
}
|
||||||
free((void *)exts_i);
|
free((void *)exts_i);
|
||||||
@ -7610,7 +7610,7 @@ static int glad_gl_has_extension(int version, const char *exts, unsigned int num
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
const char *e = exts_i[index];
|
const char *e = exts_i[index];
|
||||||
if(strcmp(e, ext) == 0) {
|
if(strcmp(e, ext) == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -7682,7 +7682,7 @@ static int glad_gl_find_core_gl(void) {
|
|||||||
};
|
};
|
||||||
version = (const char*) glad_glGetString(GL_VERSION);
|
version = (const char*) glad_glGetString(GL_VERSION);
|
||||||
if (!version) return 0;
|
if (!version) return 0;
|
||||||
for (i = 0; prefixes[i]; i++) {
|
for (i = 0; prefixes[i]; ++i) {
|
||||||
const size_t length = strlen(prefixes[i]);
|
const size_t length = strlen(prefixes[i]);
|
||||||
if (strncmp(version, prefixes[i], length) == 0) {
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
version += length;
|
version += length;
|
||||||
@ -7783,7 +7783,7 @@ static int glad_gl_find_core_gles1(void) {
|
|||||||
};
|
};
|
||||||
version = (const char*) glad_glGetString(GL_VERSION);
|
version = (const char*) glad_glGetString(GL_VERSION);
|
||||||
if (!version) return 0;
|
if (!version) return 0;
|
||||||
for (i = 0; prefixes[i]; i++) {
|
for (i = 0; prefixes[i]; ++i) {
|
||||||
const size_t length = strlen(prefixes[i]);
|
const size_t length = strlen(prefixes[i]);
|
||||||
if (strncmp(version, prefixes[i], length) == 0) {
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
version += length;
|
version += length;
|
||||||
|
@ -136,7 +136,7 @@ int main()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Start up our thread pool
|
// Start up our thread pool
|
||||||
for (unsigned int i = 0; i < threadCount; i++)
|
for (unsigned int i = 0; i < threadCount; ++i)
|
||||||
{
|
{
|
||||||
threads.emplace_back(threadFunction);
|
threads.emplace_back(threadFunction);
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ float getElevation(float x, float y)
|
|||||||
|
|
||||||
float elevation = 0.0f;
|
float elevation = 0.0f;
|
||||||
|
|
||||||
for (int i = 0; i < perlinOctaves; i++)
|
for (int i = 0; i < perlinOctaves; ++i)
|
||||||
{
|
{
|
||||||
elevation += stb_perlin_noise3(
|
elevation += stb_perlin_noise3(
|
||||||
x * perlinFrequency * static_cast<float>(std::pow(perlinFrequencyBase, i)),
|
x * perlinFrequency * static_cast<float>(std::pow(perlinFrequencyBase, i)),
|
||||||
@ -467,9 +467,9 @@ void processWorkItem(std::vector<sf::Vertex>& vertices, const WorkItem& workItem
|
|||||||
const float scalingFactorX = static_cast<float>(windowWidth) / static_cast<float>(resolutionX);
|
const float scalingFactorX = static_cast<float>(windowWidth) / static_cast<float>(resolutionX);
|
||||||
const float scalingFactorY = static_cast<float>(windowHeight) / static_cast<float>(resolutionY);
|
const float scalingFactorY = static_cast<float>(windowHeight) / static_cast<float>(resolutionY);
|
||||||
|
|
||||||
for (unsigned int y = rowStart; y < rowEnd; y++)
|
for (unsigned int y = rowStart; y < rowEnd; ++y)
|
||||||
{
|
{
|
||||||
for (unsigned int x = 0; x < resolutionX; x++)
|
for (unsigned int x = 0; x < resolutionX; ++x)
|
||||||
{
|
{
|
||||||
unsigned int arrayIndexBase = ((y - rowStart) * resolutionX + x) * 6;
|
unsigned int arrayIndexBase = ((y - rowStart) * resolutionX + x) * 6;
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ void generateTerrain(sf::Vertex* buffer)
|
|||||||
{
|
{
|
||||||
std::scoped_lock lock(workQueueMutex);
|
std::scoped_lock lock(workQueueMutex);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < blockCount; i++)
|
for (unsigned int i = 0; i < blockCount; ++i)
|
||||||
{
|
{
|
||||||
WorkItem workItem = {buffer, i};
|
WorkItem workItem = {buffer, i};
|
||||||
workQueue.push_back(workItem);
|
workQueue.push_back(workItem);
|
||||||
|
@ -226,7 +226,7 @@ float stb_perlin_ridge_noise3(float x, float y, float z,float lacunarity, float
|
|||||||
float amplitude = 0.5f;
|
float amplitude = 0.5f;
|
||||||
float sum = 0.0f;
|
float sum = 0.0f;
|
||||||
|
|
||||||
for (i = 0; i < octaves; i++) {
|
for (i = 0; i < octaves; ++i) {
|
||||||
float r = (float)(stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap));
|
float r = (float)(stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap));
|
||||||
r = r<0 ? -r : r; // fabs()
|
r = r<0 ? -r : r; // fabs()
|
||||||
r = offset - r;
|
r = offset - r;
|
||||||
@ -246,7 +246,7 @@ float stb_perlin_fbm_noise3(float x, float y, float z,float lacunarity, float ga
|
|||||||
float amplitude = 1.0f;
|
float amplitude = 1.0f;
|
||||||
float sum = 0.0f;
|
float sum = 0.0f;
|
||||||
|
|
||||||
for (i = 0; i < octaves; i++) {
|
for (i = 0; i < octaves; ++i) {
|
||||||
sum += stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude;
|
sum += stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude;
|
||||||
frequency *= lacunarity;
|
frequency *= lacunarity;
|
||||||
amplitude *= gain;
|
amplitude *= gain;
|
||||||
@ -261,7 +261,7 @@ float stb_perlin_turbulence_noise3(float x, float y, float z, float lacunarity,
|
|||||||
float amplitude = 1.0f;
|
float amplitude = 1.0f;
|
||||||
float sum = 0.0f;
|
float sum = 0.0f;
|
||||||
|
|
||||||
for (i = 0; i < octaves; i++) {
|
for (i = 0; i < octaves; ++i) {
|
||||||
float r = stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude;
|
float r = stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude;
|
||||||
r = r<0 ? -r : r; // fabs()
|
r = r<0 ? -r : r; // fabs()
|
||||||
sum += r;
|
sum += r;
|
||||||
|
@ -7559,7 +7559,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
|
|||||||
if (exts_i == NULL) {
|
if (exts_i == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
|
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
|
||||||
size_t len = strlen(gl_str_tmp) + 1;
|
size_t len = strlen(gl_str_tmp) + 1;
|
||||||
|
|
||||||
@ -7580,7 +7580,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
|
|||||||
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
|
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
|
||||||
if (exts_i != NULL) {
|
if (exts_i != NULL) {
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
free((void *) (exts_i[index]));
|
free((void *) (exts_i[index]));
|
||||||
}
|
}
|
||||||
free((void *)exts_i);
|
free((void *)exts_i);
|
||||||
@ -7610,7 +7610,7 @@ static int glad_gl_has_extension(int version, const char *exts, unsigned int num
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
const char *e = exts_i[index];
|
const char *e = exts_i[index];
|
||||||
if(strcmp(e, ext) == 0) {
|
if(strcmp(e, ext) == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -7682,7 +7682,7 @@ static int glad_gl_find_core_gl(void) {
|
|||||||
};
|
};
|
||||||
version = (const char*) glad_glGetString(GL_VERSION);
|
version = (const char*) glad_glGetString(GL_VERSION);
|
||||||
if (!version) return 0;
|
if (!version) return 0;
|
||||||
for (i = 0; prefixes[i]; i++) {
|
for (i = 0; prefixes[i]; ++i) {
|
||||||
const size_t length = strlen(prefixes[i]);
|
const size_t length = strlen(prefixes[i]);
|
||||||
if (strncmp(version, prefixes[i], length) == 0) {
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
version += length;
|
version += length;
|
||||||
@ -7783,7 +7783,7 @@ static int glad_gl_find_core_gles1(void) {
|
|||||||
};
|
};
|
||||||
version = (const char*) glad_glGetString(GL_VERSION);
|
version = (const char*) glad_glGetString(GL_VERSION);
|
||||||
if (!version) return 0;
|
if (!version) return 0;
|
||||||
for (i = 0; prefixes[i]; i++) {
|
for (i = 0; prefixes[i]; ++i) {
|
||||||
const size_t length = strlen(prefixes[i]);
|
const size_t length = strlen(prefixes[i]);
|
||||||
if (strncmp(version, prefixes[i], length) == 0) {
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
version += length;
|
version += length;
|
||||||
|
@ -282,7 +282,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Move the points in the point cloud to random positions
|
// Move the points in the point cloud to random positions
|
||||||
for (std::size_t i = 0; i < 10000; i++)
|
for (std::size_t i = 0; i < 10000; ++i)
|
||||||
{
|
{
|
||||||
// Spread the coordinates from -480 to +480
|
// Spread the coordinates from -480 to +480
|
||||||
// So they'll always fill the viewport at 800x600
|
// So they'll always fill the viewport at 800x600
|
||||||
@ -427,7 +427,7 @@ int main()
|
|||||||
if (current == 0)
|
if (current == 0)
|
||||||
current = effects.size() - 1;
|
current = effects.size() - 1;
|
||||||
else
|
else
|
||||||
current--;
|
--current;
|
||||||
description.setString("Current effect: " + effects[current]->getName());
|
description.setString("Current effect: " + effects[current]->getName());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ int main()
|
|||||||
if (current == effects.size() - 1)
|
if (current == effects.size() - 1)
|
||||||
current = 0;
|
current = 0;
|
||||||
else
|
else
|
||||||
current++;
|
++current;
|
||||||
description.setString("Current effect: " + effects[current]->getName());
|
description.setString("Current effect: " + effects[current]->getName());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ void main()
|
|||||||
half_size /= resolution;
|
half_size /= resolution;
|
||||||
|
|
||||||
// Iterate over all vertices
|
// Iterate over all vertices
|
||||||
for (int i = 0; i < gl_in.length(); i++)
|
for (int i = 0; i < gl_in.length(); ++i)
|
||||||
{
|
{
|
||||||
// Retrieve the passed vertex position
|
// Retrieve the passed vertex position
|
||||||
vec2 pos = gl_in[i].gl_Position.xy;
|
vec2 pos = gl_in[i].gl_Position.xy;
|
||||||
|
@ -29,9 +29,9 @@ namespace
|
|||||||
{
|
{
|
||||||
Matrix temp;
|
Matrix temp;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; ++j)
|
||||||
temp[i][j] = left[0][j] * right[i][0] + left[1][j] * right[i][1] + left[2][j] * right[i][2] + left[3][j] * right[i][3];
|
temp[i][j] = left[0][j] * right[i][0] + left[1][j] * right[i][1] + left[2][j] * right[i][2] + left[3][j] * right[i][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,7 +665,7 @@ public:
|
|||||||
|
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &objectCount, queueFamilyProperties.data());
|
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &objectCount, queueFamilyProperties.data());
|
||||||
|
|
||||||
for (std::size_t i = 0; i < queueFamilyProperties.size(); i++)
|
for (std::size_t i = 0; i < queueFamilyProperties.size(); ++i)
|
||||||
{
|
{
|
||||||
VkBool32 surfaceSupported = VK_FALSE;
|
VkBool32 surfaceSupported = VK_FALSE;
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ public:
|
|||||||
imageViewCreateInfo.subresourceRange.layerCount = 1;
|
imageViewCreateInfo.subresourceRange.layerCount = 1;
|
||||||
|
|
||||||
// Create an image view for each swapchain image
|
// Create an image view for each swapchain image
|
||||||
for (std::size_t i = 0; i < swapchainImages.size(); i++)
|
for (std::size_t i = 0; i < swapchainImages.size(); ++i)
|
||||||
{
|
{
|
||||||
imageViewCreateInfo.image = swapchainImages[i];
|
imageViewCreateInfo.image = swapchainImages[i];
|
||||||
|
|
||||||
@ -1220,7 +1220,7 @@ public:
|
|||||||
framebufferCreateInfo.height = swapchainExtent.height;
|
framebufferCreateInfo.height = swapchainExtent.height;
|
||||||
framebufferCreateInfo.layers = 1;
|
framebufferCreateInfo.layers = 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < swapchainFramebuffers.size(); i++)
|
for (std::size_t i = 0; i < swapchainFramebuffers.size(); ++i)
|
||||||
{
|
{
|
||||||
// Each framebuffer consists of a corresponding swapchain image and the shared depth image
|
// Each framebuffer consists of a corresponding swapchain image and the shared depth image
|
||||||
VkImageView attachments[] = {swapchainImageViews[i], depthImageView};
|
VkImageView attachments[] = {swapchainImageViews[i], depthImageView};
|
||||||
@ -1277,7 +1277,7 @@ public:
|
|||||||
|
|
||||||
uint32_t memoryType = 0;
|
uint32_t memoryType = 0;
|
||||||
|
|
||||||
for (; memoryType < memoryProperties.memoryTypeCount; memoryType++)
|
for (; memoryType < memoryProperties.memoryTypeCount; ++memoryType)
|
||||||
{
|
{
|
||||||
if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) &&
|
if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) &&
|
||||||
((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties))
|
((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties))
|
||||||
@ -1546,7 +1546,7 @@ public:
|
|||||||
void setupUniformBuffers()
|
void setupUniformBuffers()
|
||||||
{
|
{
|
||||||
// Create a uniform buffer for every frame that might be in flight to prevent clobbering
|
// Create a uniform buffer for every frame that might be in flight to prevent clobbering
|
||||||
for (size_t i = 0; i < swapchainImages.size(); i++)
|
for (size_t i = 0; i < swapchainImages.size(); ++i)
|
||||||
{
|
{
|
||||||
uniformBuffers.push_back(0);
|
uniformBuffers.push_back(0);
|
||||||
uniformBuffersMemory.push_back(0);
|
uniformBuffersMemory.push_back(0);
|
||||||
@ -1599,7 +1599,7 @@ public:
|
|||||||
|
|
||||||
uint32_t memoryType = 0;
|
uint32_t memoryType = 0;
|
||||||
|
|
||||||
for (; memoryType < memoryProperties.memoryTypeCount; memoryType++)
|
for (; memoryType < memoryProperties.memoryTypeCount; ++memoryType)
|
||||||
{
|
{
|
||||||
if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) &&
|
if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) &&
|
||||||
((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties))
|
((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties))
|
||||||
@ -2124,7 +2124,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For every descriptor set, set up the bindings to our uniform buffer and texture sampler
|
// For every descriptor set, set up the bindings to our uniform buffer and texture sampler
|
||||||
for (std::size_t i = 0; i < descriptorSets.size(); i++)
|
for (std::size_t i = 0; i < descriptorSets.size(); ++i)
|
||||||
{
|
{
|
||||||
VkWriteDescriptorSet writeDescriptorSets[2];
|
VkWriteDescriptorSet writeDescriptorSets[2];
|
||||||
|
|
||||||
@ -2218,7 +2218,7 @@ public:
|
|||||||
commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
|
commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
|
||||||
|
|
||||||
// Set up the command buffers for each frame in flight
|
// Set up the command buffers for each frame in flight
|
||||||
for (std::size_t i = 0; i < commandBuffers.size(); i++)
|
for (std::size_t i = 0; i < commandBuffers.size(); ++i)
|
||||||
{
|
{
|
||||||
// Begin the command buffer
|
// Begin the command buffer
|
||||||
if (vkBeginCommandBuffer(commandBuffers[i], &commandBufferBeginInfo) != VK_SUCCESS)
|
if (vkBeginCommandBuffer(commandBuffers[i], &commandBufferBeginInfo) != VK_SUCCESS)
|
||||||
@ -2268,7 +2268,7 @@ public:
|
|||||||
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||||
|
|
||||||
// Create a semaphore to track when an swapchain image is available for each frame in flight
|
// Create a semaphore to track when an swapchain image is available for each frame in flight
|
||||||
for (std::size_t i = 0; i < maxFramesInFlight; i++)
|
for (std::size_t i = 0; i < maxFramesInFlight; ++i)
|
||||||
{
|
{
|
||||||
imageAvailableSemaphores.push_back(0);
|
imageAvailableSemaphores.push_back(0);
|
||||||
|
|
||||||
@ -2281,7 +2281,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a semaphore to track when rendering is complete for each frame in flight
|
// Create a semaphore to track when rendering is complete for each frame in flight
|
||||||
for (std::size_t i = 0; i < maxFramesInFlight; i++)
|
for (std::size_t i = 0; i < maxFramesInFlight; ++i)
|
||||||
{
|
{
|
||||||
renderFinishedSemaphores.push_back(0);
|
renderFinishedSemaphores.push_back(0);
|
||||||
|
|
||||||
@ -2303,7 +2303,7 @@ public:
|
|||||||
fenceCreateInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
|
fenceCreateInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
|
||||||
|
|
||||||
// Create a fence to track when queue submission is complete for each frame in flight
|
// Create a fence to track when queue submission is complete for each frame in flight
|
||||||
for (std::size_t i = 0; i < maxFramesInFlight; i++)
|
for (std::size_t i = 0; i < maxFramesInFlight; ++i)
|
||||||
{
|
{
|
||||||
fences.push_back(0);
|
fences.push_back(0);
|
||||||
|
|
||||||
|
@ -7559,7 +7559,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
|
|||||||
if (exts_i == NULL) {
|
if (exts_i == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
|
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
|
||||||
size_t len = strlen(gl_str_tmp) + 1;
|
size_t len = strlen(gl_str_tmp) + 1;
|
||||||
|
|
||||||
@ -7580,7 +7580,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
|
|||||||
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
|
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
|
||||||
if (exts_i != NULL) {
|
if (exts_i != NULL) {
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
free((void *) (exts_i[index]));
|
free((void *) (exts_i[index]));
|
||||||
}
|
}
|
||||||
free((void *)exts_i);
|
free((void *)exts_i);
|
||||||
@ -7610,7 +7610,7 @@ static int glad_gl_has_extension(int version, const char *exts, unsigned int num
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
for(index = 0; index < num_exts_i; index++) {
|
for(index = 0; index < num_exts_i; ++index) {
|
||||||
const char *e = exts_i[index];
|
const char *e = exts_i[index];
|
||||||
if(strcmp(e, ext) == 0) {
|
if(strcmp(e, ext) == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -7682,7 +7682,7 @@ static int glad_gl_find_core_gl(void) {
|
|||||||
};
|
};
|
||||||
version = (const char*) glad_glGetString(GL_VERSION);
|
version = (const char*) glad_glGetString(GL_VERSION);
|
||||||
if (!version) return 0;
|
if (!version) return 0;
|
||||||
for (i = 0; prefixes[i]; i++) {
|
for (i = 0; prefixes[i]; ++i) {
|
||||||
const size_t length = strlen(prefixes[i]);
|
const size_t length = strlen(prefixes[i]);
|
||||||
if (strncmp(version, prefixes[i], length) == 0) {
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
version += length;
|
version += length;
|
||||||
@ -7783,7 +7783,7 @@ static int glad_gl_find_core_gles1(void) {
|
|||||||
};
|
};
|
||||||
version = (const char*) glad_glGetString(GL_VERSION);
|
version = (const char*) glad_glGetString(GL_VERSION);
|
||||||
if (!version) return 0;
|
if (!version) return 0;
|
||||||
for (i = 0; prefixes[i]; i++) {
|
for (i = 0; prefixes[i]; ++i) {
|
||||||
const size_t length = strlen(prefixes[i]);
|
const size_t length = strlen(prefixes[i]);
|
||||||
if (strncmp(version, prefixes[i], length) == 0) {
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
version += length;
|
version += length;
|
||||||
|
@ -465,7 +465,7 @@ Out Utf<16>::toLatin1(In begin, In end, Out output, char replacement)
|
|||||||
while (begin < end)
|
while (begin < end)
|
||||||
{
|
{
|
||||||
*output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
|
*output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
|
||||||
begin++;
|
++begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -607,7 +607,7 @@ Out Utf<32>::toLatin1(In begin, In end, Out output, char replacement)
|
|||||||
while (begin < end)
|
while (begin < end)
|
||||||
{
|
{
|
||||||
*output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
|
*output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
|
||||||
begin++;
|
++begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
@ -57,7 +57,7 @@ AlResource::AlResource()
|
|||||||
globalDevice = std::make_unique<priv::AudioDevice>();
|
globalDevice = std::make_unique<priv::AudioDevice>();
|
||||||
|
|
||||||
// Increment the resources counter
|
// Increment the resources counter
|
||||||
count++;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ AlResource::~AlResource()
|
|||||||
std::scoped_lock lock(mutex);
|
std::scoped_lock lock(mutex);
|
||||||
|
|
||||||
// Decrement the resources counter
|
// Decrement the resources counter
|
||||||
count--;
|
--count;
|
||||||
|
|
||||||
// If there's no more resource alive, we can destroy the device
|
// If there's no more resource alive, we can destroy the device
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
@ -143,7 +143,7 @@ namespace
|
|||||||
{
|
{
|
||||||
// If there's room in the output buffer, copy the sample there
|
// If there's room in the output buffer, copy the sample there
|
||||||
*data->buffer++ = sample;
|
*data->buffer++ = sample;
|
||||||
data->remaining--;
|
--data->remaining;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -508,7 +508,7 @@ JNIEXPORT void ANativeActivity_onCreate(ANativeActivity* activity, void* savedSt
|
|||||||
states->inputQueue = nullptr;
|
states->inputQueue = nullptr;
|
||||||
states->config = nullptr;
|
states->config = nullptr;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < sf::Mouse::ButtonCount; i++)
|
for (unsigned int i = 0; i < sf::Mouse::ButtonCount; ++i)
|
||||||
states->isButtonPressed[i] = false;
|
states->isButtonPressed[i] = false;
|
||||||
|
|
||||||
gladLoaderLoadEGL(EGL_DEFAULT_DISPLAY);
|
gladLoaderLoadEGL(EGL_DEFAULT_DISPLAY);
|
||||||
|
@ -563,11 +563,11 @@ Ftp::Response Ftp::DataChannel::open(Ftp::TransferMode mode)
|
|||||||
while (isdigit(str[index]))
|
while (isdigit(str[index]))
|
||||||
{
|
{
|
||||||
datum = static_cast<Uint8>(static_cast<Uint8>(datum * 10) + static_cast<Uint8>(str[index] - '0'));
|
datum = static_cast<Uint8>(static_cast<Uint8>(datum * 10) + static_cast<Uint8>(str[index] - '0'));
|
||||||
index++;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip separator
|
// Skip separator
|
||||||
index++;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconstruct connection port and address
|
// Reconstruct connection port and address
|
||||||
|
@ -245,7 +245,7 @@ void Http::Response::parse(const std::string& data)
|
|||||||
// Copy the actual content data
|
// Copy the actual content data
|
||||||
std::istreambuf_iterator<char> it(in);
|
std::istreambuf_iterator<char> it(in);
|
||||||
std::istreambuf_iterator<char> itEnd;
|
std::istreambuf_iterator<char> itEnd;
|
||||||
for (std::size_t i = 0; ((i < length) && (it != itEnd)); i++)
|
for (std::size_t i = 0; ((i < length) && (it != itEnd)); ++i)
|
||||||
m_body.push_back(*it++);
|
m_body.push_back(*it++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void SocketSelector::add(Socket& socket)
|
|||||||
if (FD_ISSET(handle, &m_impl->allSockets))
|
if (FD_ISSET(handle, &m_impl->allSockets))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_impl->socketCount++;
|
++m_impl->socketCount;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void SocketSelector::remove(Socket& socket)
|
|||||||
if (!FD_ISSET(handle, &m_impl->allSockets))
|
if (!FD_ISSET(handle, &m_impl->allSockets))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_impl->socketCount--;
|
--m_impl->socketCount;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s
|
|||||||
|
|
||||||
size_t pointerCount = AMotionEvent_getPointerCount(_event);
|
size_t pointerCount = AMotionEvent_getPointerCount(_event);
|
||||||
|
|
||||||
for (size_t p = 0; p < pointerCount; p++)
|
for (size_t p = 0; p < pointerCount; ++p)
|
||||||
{
|
{
|
||||||
int32_t id = AMotionEvent_getPointerId(_event, p);
|
int32_t id = AMotionEvent_getPointerId(_event, p);
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
|
|||||||
|
|
||||||
if (usage == HUP_BUTTON)
|
if (usage == HUP_BUTTON)
|
||||||
{
|
{
|
||||||
caps.buttonCount++;
|
++caps.buttonCount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (usage == HUP_GENERIC_DESKTOP)
|
else if (usage == HUP_GENERIC_DESKTOP)
|
||||||
|
@ -275,7 +275,7 @@ namespace
|
|||||||
const char* extension = extensionString;
|
const char* extension = extensionString;
|
||||||
|
|
||||||
while (*extensionString && (*extensionString != ' '))
|
while (*extensionString && (*extensionString != ' '))
|
||||||
extensionString++;
|
++extensionString;
|
||||||
|
|
||||||
extensions.emplace_back(extension, extensionString);
|
extensions.emplace_back(extension, extensionString);
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ void GlContext::initResource()
|
|||||||
if (sharedContext)
|
if (sharedContext)
|
||||||
{
|
{
|
||||||
// Increment the resources counter
|
// Increment the resources counter
|
||||||
resourceCount++;
|
++resourceCount;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ void GlContext::initResource()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Increment the resources counter
|
// Increment the resources counter
|
||||||
resourceCount++;
|
++resourceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ void GlContext::cleanupResource()
|
|||||||
std::scoped_lock lock(mutex);
|
std::scoped_lock lock(mutex);
|
||||||
|
|
||||||
// Decrement the resources counter
|
// Decrement the resources counter
|
||||||
resourceCount--;
|
--resourceCount;
|
||||||
|
|
||||||
// If there's no more resource alive, we can trigger the global context cleanup
|
// If there's no more resource alive, we can trigger the global context cleanup
|
||||||
if (resourceCount == 0)
|
if (resourceCount == 0)
|
||||||
@ -412,7 +412,7 @@ void GlContext::acquireTransientContext()
|
|||||||
transientContext = std::make_unique<TransientContext>();
|
transientContext = std::make_unique<TransientContext>();
|
||||||
|
|
||||||
// Increase the reference count
|
// Increase the reference count
|
||||||
transientContext->referenceCount++;
|
++transientContext->referenceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ void GlContext::releaseTransientContext()
|
|||||||
assert(transientContext);
|
assert(transientContext);
|
||||||
|
|
||||||
// Decrease the reference count
|
// Decrease the reference count
|
||||||
transientContext->referenceCount--;
|
--transientContext->referenceCount;
|
||||||
|
|
||||||
// If this is the last TransientContextLock that is released
|
// If this is the last TransientContextLock that is released
|
||||||
// destroy the state object
|
// destroy the state object
|
||||||
|
@ -261,7 +261,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
|
|||||||
|
|
||||||
if (usage == HUP_BUTTON)
|
if (usage == HUP_BUTTON)
|
||||||
{
|
{
|
||||||
caps.buttonCount++;
|
++caps.buttonCount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (usage == HUP_GENERIC_DESKTOP)
|
else if (usage == HUP_GENERIC_DESKTOP)
|
||||||
|
@ -134,7 +134,7 @@ void HIDJoystickManager::update()
|
|||||||
void HIDJoystickManager::pluggedIn(void* context, IOReturn, void*, IOHIDDeviceRef)
|
void HIDJoystickManager::pluggedIn(void* context, IOReturn, void*, IOHIDDeviceRef)
|
||||||
{
|
{
|
||||||
HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context);
|
HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context);
|
||||||
manager->m_joystickCount++;
|
++manager->m_joystickCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void HIDJoystickManager::pluggedIn(void* context, IOReturn, void*, IOHIDDeviceRe
|
|||||||
void HIDJoystickManager::pluggedOut(void* context, IOReturn, void*, IOHIDDeviceRef)
|
void HIDJoystickManager::pluggedOut(void* context, IOReturn, void*, IOHIDDeviceRef)
|
||||||
{
|
{
|
||||||
HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context);
|
HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context);
|
||||||
manager->m_joystickCount--;
|
--manager->m_joystickCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ bool JoystickImpl::isConnected(unsigned int index)
|
|||||||
for (unsigned int i(0); i < sf::Joystick::Count; ++i)
|
for (unsigned int i(0); i < sf::Joystick::Count; ++i)
|
||||||
{
|
{
|
||||||
if (m_locationIDs[i] != 0)
|
if (m_locationIDs[i] != 0)
|
||||||
openedCount++;
|
++openedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
|
|||||||
|
|
||||||
// Loop on each mode and convert it into a sf::VideoMode object.
|
// Loop on each mode and convert it into a sf::VideoMode object.
|
||||||
const CFIndex modesCount = CFArrayGetCount(cgmodes);
|
const CFIndex modesCount = CFArrayGetCount(cgmodes);
|
||||||
for (CFIndex i = 0; i < modesCount; i++)
|
for (CFIndex i = 0; i < modesCount; ++i)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef cgmode = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(cgmodes, i)));
|
CGDisplayModeRef cgmode = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(cgmodes, i)));
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ Display* OpenDisplay()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
referenceCount++;
|
++referenceCount;
|
||||||
return sharedDisplay;
|
return sharedDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void CloseDisplay(Display* display)
|
|||||||
|
|
||||||
assert(display == sharedDisplay);
|
assert(display == sharedDisplay);
|
||||||
|
|
||||||
referenceCount--;
|
--referenceCount;
|
||||||
if (referenceCount == 0)
|
if (referenceCount == 0)
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ XIM OpenXIM()
|
|||||||
XSetLocaleModifiers(prevXLoc.c_str());
|
XSetLocaleModifiers(prevXLoc.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
referenceCountXIM++;
|
++referenceCountXIM;
|
||||||
|
|
||||||
return sharedXIM;
|
return sharedXIM;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ void CloseXIM(XIM xim)
|
|||||||
|
|
||||||
assert(xim == sharedXIM);
|
assert(xim == sharedXIM);
|
||||||
|
|
||||||
referenceCountXIM--;
|
--referenceCountXIM;
|
||||||
|
|
||||||
if ((referenceCountXIM == 0) && (xim != nullptr))
|
if ((referenceCountXIM == 0) && (xim != nullptr))
|
||||||
XCloseIM(xim);
|
XCloseIM(xim);
|
||||||
|
@ -740,14 +740,14 @@ void GlxContext::createContext(GlxContext* shared)
|
|||||||
else if (m_settings.minorVersion > 0)
|
else if (m_settings.minorVersion > 0)
|
||||||
{
|
{
|
||||||
// If the minor version is not 0, we decrease it and try again
|
// If the minor version is not 0, we decrease it and try again
|
||||||
m_settings.minorVersion--;
|
--m_settings.minorVersion;
|
||||||
|
|
||||||
m_settings.attributeFlags = settings.attributeFlags;
|
m_settings.attributeFlags = settings.attributeFlags;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the minor version is 0, we decrease the major version
|
// If the minor version is 0, we decrease the major version
|
||||||
m_settings.majorVersion--;
|
--m_settings.majorVersion;
|
||||||
m_settings.minorVersion = 9;
|
m_settings.minorVersion = 9;
|
||||||
|
|
||||||
m_settings.attributeFlags = settings.attributeFlags;
|
m_settings.attributeFlags = settings.attributeFlags;
|
||||||
|
@ -1372,7 +1372,7 @@ void WindowImplX11::setVideoMode(const VideoMode& mode)
|
|||||||
bool modeFound = false;
|
bool modeFound = false;
|
||||||
RRMode xRandMode;
|
RRMode xRandMode;
|
||||||
|
|
||||||
for (int i = 0; (i < res->nmode) && !modeFound; i++)
|
for (int i = 0; (i < res->nmode) && !modeFound; ++i)
|
||||||
{
|
{
|
||||||
if (crtcInfo->rotation == RR_Rotate_90 || crtcInfo->rotation == RR_Rotate_270)
|
if (crtcInfo->rotation == RR_Rotate_90 || crtcInfo->rotation == RR_Rotate_270)
|
||||||
std::swap(res->modes[i].height, res->modes[i].width);
|
std::swap(res->modes[i].height, res->modes[i].width);
|
||||||
|
@ -683,14 +683,14 @@ void WglContext::createContext(WglContext* shared)
|
|||||||
else if (m_settings.minorVersion > 0)
|
else if (m_settings.minorVersion > 0)
|
||||||
{
|
{
|
||||||
// If the minor version is not 0, we decrease it and try again
|
// If the minor version is not 0, we decrease it and try again
|
||||||
m_settings.minorVersion--;
|
--m_settings.minorVersion;
|
||||||
|
|
||||||
m_settings.attributeFlags = settings.attributeFlags;
|
m_settings.attributeFlags = settings.attributeFlags;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the minor version is 0, we decrease the major version
|
// If the minor version is 0, we decrease the major version
|
||||||
m_settings.majorVersion--;
|
--m_settings.majorVersion;
|
||||||
m_settings.minorVersion = 9;
|
m_settings.minorVersion = 9;
|
||||||
|
|
||||||
m_settings.attributeFlags = settings.attributeFlags;
|
m_settings.attributeFlags = settings.attributeFlags;
|
||||||
|
@ -233,7 +233,7 @@ m_cursorGrabbed (m_fullscreen)
|
|||||||
switchToFullscreen(mode);
|
switchToFullscreen(mode);
|
||||||
|
|
||||||
// Increment window count
|
// Increment window count
|
||||||
windowCount++;
|
++windowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ WindowImplWin32::~WindowImplWin32()
|
|||||||
DestroyWindow(m_handle);
|
DestroyWindow(m_handle);
|
||||||
|
|
||||||
// Decrement the window count
|
// Decrement the window count
|
||||||
windowCount--;
|
--windowCount;
|
||||||
|
|
||||||
// Unregister window class if we were the last window
|
// Unregister window class if we were the last window
|
||||||
if (windowCount == 0)
|
if (windowCount == 0)
|
||||||
|
@ -220,11 +220,11 @@ void SensorImpl::setEnabled(bool enabled)
|
|||||||
{
|
{
|
||||||
if (deviceMotionEnabledCount == 0)
|
if (deviceMotionEnabledCount == 0)
|
||||||
[[SFAppDelegate getInstance].motionManager startDeviceMotionUpdates];
|
[[SFAppDelegate getInstance].motionManager startDeviceMotionUpdates];
|
||||||
deviceMotionEnabledCount++;
|
++deviceMotionEnabledCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deviceMotionEnabledCount--;
|
--deviceMotionEnabledCount;
|
||||||
if (deviceMotionEnabledCount == 0)
|
if (deviceMotionEnabledCount == 0)
|
||||||
[[SFAppDelegate getInstance].motionManager stopDeviceMotionUpdates];
|
[[SFAppDelegate getInstance].motionManager stopDeviceMotionUpdates];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user