From afc97efcafa70526bbf0bdd6b29040a25460838a Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 29 Jan 2026 14:12:53 +0800 Subject: [PATCH] [Chore] (MG_Util/Texture): more logs --- .../MG_Util/Texture/PixelStoreProcessor.cpp | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/MobileGL/MG_Util/Texture/PixelStoreProcessor.cpp b/MobileGL/MG_Util/Texture/PixelStoreProcessor.cpp index a4a1ef01..77b22188 100644 --- a/MobileGL/MG_Util/Texture/PixelStoreProcessor.cpp +++ b/MobileGL/MG_Util/Texture/PixelStoreProcessor.cpp @@ -9,7 +9,7 @@ #include "PixelStoreProcessor.h" namespace MobileGL::MG_Util::PixelStoreProcessor { - static SizeT CalculateStride(Int width, SizeT pixelSize, Int alignment) { + static SizeT CalculateRowStride(Int width, SizeT pixelSize, Int alignment) { if (width <= 0 || pixelSize == 0) return 0; const SizeT rowBytes = static_cast(width) * pixelSize; @@ -97,8 +97,8 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { const Int effectiveWidth = (params.RowLength > 0) ? params.RowLength : width; const Int effectiveHeight = (params.ImageHeight > 0) ? params.ImageHeight : height; - const SizeT inputStride = CalculateStride(effectiveWidth, pixelSize, params.Alignment); - const SizeT outputStride = static_cast(width) * pixelSize; + const SizeT inputRowStride = CalculateRowStride(effectiveWidth, pixelSize, params.Alignment); + const SizeT outputRowStride = static_cast(width) * pixelSize; const Int startX = params.SkipPixels; const Int startY = params.SkipRows; @@ -108,8 +108,8 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { const Int copyHeight = height; const Int copyDepth = depth; - MGLOG_D("%s: start at: (%d, %d, %d), copy size: (%d, %d, %d)", __func__, - startX, startY, startZ, copyWidth, copyHeight, copyDepth); + MGLOG_D("%s: start at: (%d, %d, %d), copy size: (%d, %d, %d), i/o row stride: (%d, %d)", __func__, + startX, startY, startZ, copyWidth, copyHeight, copyDepth, inputRowStride, outputRowStride); if (copyWidth <= 0 || copyHeight <= 0 || copyDepth <= 0) { outSize = 0; @@ -126,8 +126,8 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { const Uint8* src = static_cast(inputPixels); Uint8* dst = static_cast(outputPixels); - src += static_cast(startZ) * static_cast(effectiveHeight) * inputStride; - src += static_cast(startY) * inputStride; + src += static_cast(startZ) * static_cast(effectiveHeight) * inputRowStride; + src += static_cast(startY) * inputRowStride; src += static_cast(startX) * pixelSize; Bool isByteType = @@ -161,12 +161,12 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { // else // MGLOG_D("%s: pixel0 = %x", __func__, *((Uint32*)layerDst)); - layerSrc += inputStride; - layerDst += static_cast(copyWidth) * pixelSize; + layerSrc += inputRowStride; + layerDst += outputRowStride; } - src += static_cast(effectiveHeight) * inputStride; - dst += static_cast(copyHeight) * static_cast(copyWidth) * pixelSize; + src += static_cast(effectiveHeight) * inputRowStride; + dst += static_cast(copyHeight) * outputRowStride; } return outputPixels; @@ -184,12 +184,12 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { Int depth = dimension.z(); const Int outputWidth = (params.RowLength > 0) ? params.RowLength : width; - const SizeT outputStride = CalculateStride(outputWidth, pixelSize, params.Alignment); - const SizeT inputStride = static_cast(width) * pixelSize; + const SizeT outputRowStride = CalculateRowStride(outputWidth, pixelSize, params.Alignment); + const SizeT inputRowStride = static_cast(width) * pixelSize; const Int effectiveHeight = (params.ImageHeight > 0) ? params.ImageHeight : height; - outSize = static_cast(outputStride) * static_cast(effectiveHeight) * static_cast(depth); + outSize = static_cast(outputRowStride) * static_cast(effectiveHeight) * static_cast(depth); void* outputPixels = malloc(outSize); if (!outputPixels) { outSize = 0; @@ -201,8 +201,8 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { const Uint8* src = static_cast(inputPixels); Uint8* dst = static_cast(outputPixels); - dst += static_cast(params.SkipImages) * static_cast(effectiveHeight) * outputStride; - dst += static_cast(params.SkipRows) * outputStride; + dst += static_cast(params.SkipImages) * static_cast(effectiveHeight) * outputRowStride; + dst += static_cast(params.SkipRows) * outputRowStride; dst += static_cast(params.SkipPixels) * pixelSize; Vector tempRow(static_cast(width) * pixelSize); @@ -224,12 +224,12 @@ namespace MobileGL::MG_Util::PixelStoreProcessor { Memcpy(layerDst, tempRow.data(), static_cast(width) * pixelSize); - layerSrc += inputStride; - layerDst += outputStride; + layerSrc += inputRowStride; + layerDst += outputRowStride; } - src += static_cast(height) * inputStride; - dst += static_cast(effectiveHeight) * outputStride; + src += static_cast(height) * inputRowStride; + dst += static_cast(effectiveHeight) * outputRowStride; } return outputPixels;