ref: 073e62de46ffbaaf02dabe80b665161f43453efb
parent: aee4ce0866e18578bf83c7b216313bace1677c76
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Apr 15 12:57:05 EDT 2020
Software renderer tweaks
--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -172,7 +172,7 @@
{
for (long j = 0; j < rect_clamped.bottom - rect_clamped.top; ++j)
{
- unsigned char *source_pointer = &source_surface->pixels[((rect_clamped.top + j) * source_surface->pitch) + (rect_clamped.left * 3)];
+ const unsigned char *source_pointer = &source_surface->pixels[((rect_clamped.top + j) * source_surface->pitch) + (rect_clamped.left * 3)];
unsigned char *destination_pointer = &destination_surface->pixels[((y + j) * destination_surface->pitch) + (x * 3)];
for (long i = 0; i < rect_clamped.right - rect_clamped.left; ++i)
@@ -193,12 +193,15 @@
}
else
{
+ const unsigned char *source_pointer = &source_surface->pixels[(rect_clamped.top * source_surface->pitch) + (rect_clamped.left * 3)];
+ unsigned char *destination_pointer = &destination_surface->pixels[(y * destination_surface->pitch) + (x * 3)];
+
for (long j = 0; j < rect_clamped.bottom - rect_clamped.top; ++j)
{
- unsigned char *source_pointer = &source_surface->pixels[((rect_clamped.top + j) * source_surface->pitch) + (rect_clamped.left * 3)];
- unsigned char *destination_pointer = &destination_surface->pixels[((y + j) * destination_surface->pitch) + (x * 3)];
-
memcpy(destination_pointer, source_pointer, (rect_clamped.right - rect_clamped.left) * 3);
+
+ source_pointer += source_surface->pitch;
+ destination_pointer += destination_surface->pitch;
}
}
}