summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Content/AssetDataForImage.cs
diff options
context:
space:
mode:
authoratravita-mods <94934860+atravita-mods@users.noreply.github.com>2022-08-22 23:44:07 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-10-08 13:27:07 -0400
commit09fd12ddfe89c5d36b1db66167dd741e4f8a7e0f (patch)
treea8f2c90c73141145199d12fb76aee853de64b03e /src/SMAPI/Framework/Content/AssetDataForImage.cs
parentc1d5d19e43a9305ebf71696408fc8a0777794f55 (diff)
downloadSMAPI-09fd12ddfe89c5d36b1db66167dd741e4f8a7e0f.tar.gz
SMAPI-09fd12ddfe89c5d36b1db66167dd741e4f8a7e0f.tar.bz2
SMAPI-09fd12ddfe89c5d36b1db66167dd741e4f8a7e0f.zip
use startindex/endindex since I've already calculated those...
Diffstat (limited to 'src/SMAPI/Framework/Content/AssetDataForImage.cs')
-rw-r--r--src/SMAPI/Framework/Content/AssetDataForImage.cs7
1 files 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)