summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ContentManagers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-10-09 18:03:05 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-10-09 18:03:05 -0400
commit27856ebea25791d2d82a42a670327f6dd5c4ac23 (patch)
tree2c9ebfbe9897d34c33a5446e21c20a2066ec4ac2 /src/SMAPI/Framework/ContentManagers
parentb78b269cf53529bcb73fa99538a3e9eb23e283b0 (diff)
downloadSMAPI-27856ebea25791d2d82a42a670327f6dd5c4ac23.tar.gz
SMAPI-27856ebea25791d2d82a42a670327f6dd5c4ac23.tar.bz2
SMAPI-27856ebea25791d2d82a42a670327f6dd5c4ac23.zip
drop UseRawImageLoading option
Raw image loading is now always enabled, except in PyTK compatibility mode.
Diffstat (limited to 'src/SMAPI/Framework/ContentManagers')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index ddb6f6f5..badbd766 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -30,9 +30,6 @@ namespace StardewModdingAPI.Framework.ContentManagers
/*********
** Fields
*********/
- /// <summary>Whether to use raw image data when possible, instead of initializing an XNA Texture2D instance through the GPU.</summary>
- private readonly bool UseRawImageLoading;
-
/// <summary>Encapsulates SMAPI's JSON file parsing.</summary>
private readonly JsonHelper JsonHelper;
@@ -74,15 +71,13 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <param name="jsonHelper">Encapsulates SMAPI's JSON file parsing.</param>
/// <param name="onDisposing">A callback to invoke when the content manager is being disposed.</param>
/// <param name="fileLookup">A lookup for files within the <paramref name="rootDirectory"/>.</param>
- /// <param name="useRawImageLoading">Whether to use raw image data when possible, instead of initializing an XNA Texture2D instance through the GPU.</param>
- public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action<BaseContentManager> onDisposing, IFileLookup fileLookup, bool useRawImageLoading)
+ public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action<BaseContentManager> onDisposing, IFileLookup fileLookup)
: base(name, serviceProvider, rootDirectory, currentCulture, coordinator, monitor, reflection, onDisposing, isNamespaced: true)
{
this.GameContentManager = gameContentManager;
this.FileLookup = fileLookup;
this.JsonHelper = jsonHelper;
this.ModName = modName;
- this.UseRawImageLoading = useRawImageLoading;
this.TryLocalizeKeys = false;
}
@@ -205,34 +200,25 @@ namespace StardewModdingAPI.Framework.ContentManagers
{
this.AssertValidType<T>(assetName, file, typeof(Texture2D), typeof(IRawTextureData));
bool returnRawData = typeof(T).IsAssignableTo(typeof(IRawTextureData));
- bool loadRawData =
- returnRawData
- || (
- this.UseRawImageLoading
+
#if SMAPI_DEPRECATED
- && !this.ShouldDisableIntermediateRawDataLoad<T>(assetName, file)
+ if (!returnRawData && this.ShouldDisableIntermediateRawDataLoad<T>(assetName, file))
+ {
+ using FileStream stream = File.OpenRead(file.FullName);
+ Texture2D texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, stream).SetName(assetName);
+ this.PremultiplyTransparency(texture);
+ return (T)(object)texture;
+ }
#endif
- );
- // load
- if (loadRawData)
- {
- IRawTextureData raw = this.LoadRawImageData(file, returnRawData);
+ IRawTextureData raw = this.LoadRawImageData(file, returnRawData);
- if (returnRawData)
- return (T)raw;
- else
- {
- Texture2D texture = new Texture2D(Game1.graphics.GraphicsDevice, raw.Width, raw.Height).SetName(assetName);
- texture.SetData(raw.Data);
- return (T)(object)texture;
- }
- }
+ if (returnRawData)
+ return (T)raw;
else
{
- using FileStream stream = File.OpenRead(file.FullName);
- Texture2D texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, stream).SetName(assetName);
- this.PremultiplyTransparency(texture);
+ Texture2D texture = new Texture2D(Game1.graphics.GraphicsDevice, raw.Width, raw.Height).SetName(assetName);
+ texture.SetData(raw.Data);
return (T)(object)texture;
}
}