From 33b61fb4994ebcdf4105a8553b536bde0312fa50 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 12 Nov 2023 05:57:25 +0300 Subject: [PATCH] Minor refactor --- src/graphics/ImageData.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/graphics/ImageData.cpp b/src/graphics/ImageData.cpp index 26944414..c4897b4a 100644 --- a/src/graphics/ImageData.cpp +++ b/src/graphics/ImageData.cpp @@ -53,15 +53,14 @@ ImageData* add_atlas_margins(ImageData* image, int grid_size) { } } + // Fixing black transparent pixels for Mip-Mapping for (int ly = 0; ly < imgres; ly++) { for (int lx = 0; lx < imgres; lx++) { - int sy = lx; - int sx = ly; - if (srcdata[((soy+sy) * srcwidth + sox + sx) * 4 + 3]) { + if (srcdata[((soy+ly) * srcwidth + sox + lx) * 4 + 3]) { for (int c = 0; c < 3; c++) { - dstdata[((doy+ly) * dstwidth + dox + lx + 1) * 4 + c] = srcdata[((soy+sy) * srcwidth + sox + sx) * 4 + c]; - dstdata[((doy+ly + 1) * dstwidth + dox + lx) * 4 + c] = srcdata[((soy+sy) * srcwidth + sox + sx) * 4 + c]; - dstdata[((doy+ly + 1) * dstwidth + dox + lx + 1) * 4 + c] = srcdata[((soy+sy) * srcwidth + sox + sx) * 4 + c]; + int val = srcdata[((soy+ly) * srcwidth + sox + lx) * 4 + c]; + dstdata[((doy+ly) * dstwidth + dox + lx + 1) * 4 + c] = val; + dstdata[((doy+ly + 1) * dstwidth + dox + lx) * 4 + c] = val; } } }