From 09fd12ddfe89c5d36b1db66167dd741e4f8a7e0f Mon Sep 17 00:00:00 2001 From: atravita-mods <94934860+atravita-mods@users.noreply.github.com> Date: Mon, 22 Aug 2022 23:44:07 -0400 Subject: [PATCH] use startindex/endindex since I've already calculated those... --- src/SMAPI/Framework/Content/AssetDataForImage.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/SMAPI/Framework/Content/AssetDataForImage.cs b/src/SMAPI/Framework/Content/AssetDataForImage.cs index 90468316..70fa369f 100644 --- a/src/SMAPI/Framework/Content/AssetDataForImage.cs +++ b/src/SMAPI/Framework/Content/AssetDataForImage.cs @@ -207,7 +207,6 @@ namespace StardewModdingAPI.Framework.Content // Update target rectangle targetArea = new(targetArea.X, targetArea.Y + topoffset, targetArea.Width, bottomoffset - topoffset + 1); - pixelCount = targetArea.Width * targetArea.Height; int sourceoffset = topoffset * sourceArea.Width; @@ -217,11 +216,11 @@ namespace StardewModdingAPI.Framework.Content target.GetData(0, targetArea, mergedData, 0, pixelCount); // merge pixels - for (int i = 0; i < pixelCount; i++) + for (int i = startIndex; i <= endIndex; i++) { // ref locals here? Not sure. - Color above = sourceData[sourceoffset + i]; - Color below = mergedData[i]; + Color above = sourceData[i]; + Color below = mergedData[i - sourceoffset]; // shortcut transparency if (above.A < MinOpacity)