summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoratravita-mods <94934860+atravita-mods@users.noreply.github.com>2022-08-22 19:32:45 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-10-08 13:27:06 -0400
commitce63efa2f45ee770fdb628a45f5a6b63544b0031 (patch)
tree426e90ff86328d40e3e7fdffd0634cba9169d8a5
parentff523c619a040c8eb2d2f1c1a0d19c8fe83f1c75 (diff)
downloadSMAPI-ce63efa2f45ee770fdb628a45f5a6b63544b0031.tar.gz
SMAPI-ce63efa2f45ee770fdb628a45f5a6b63544b0031.tar.bz2
SMAPI-ce63efa2f45ee770fdb628a45f5a6b63544b0031.zip
Avoid making copy if the source image is just taller than the sourceArea.
-rw-r--r--src/SMAPI/Framework/Content/AssetDataForImage.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Content/AssetDataForImage.cs b/src/SMAPI/Framework/Content/AssetDataForImage.cs
index 9c71328f..bcdebff6 100644
--- a/src/SMAPI/Framework/Content/AssetDataForImage.cs
+++ b/src/SMAPI/Framework/Content/AssetDataForImage.cs
@@ -47,10 +47,12 @@ namespace StardewModdingAPI.Framework.Content
int areaWidth = sourceArea.Value.Width;
int areaHeight = sourceArea.Value.Height;
- if (areaX == 0 && areaY == 0 && areaWidth == source.Width && areaHeight == source.Height)
+ if (areaX == 0 && areaY == 0 && areaWidth == source.Width && areaHeight <= source.Height)
{
+ // It's actually fine if the source is taller than the sourceArea
+ // the "extra" bits on the end of the array can just be ignored.
sourceData = source.Data;
- this.PatchImageImpl(sourceData, source.Width, source.Height, sourceArea.Value, targetArea.Value, patchMode);
+ this.PatchImageImpl(sourceData, areaWidth, areaHeight, sourceArea.Value, targetArea.Value, patchMode);
}
else
{