Skip to content

Commit fd8b185

Browse files
committed
Refactor how to set the scene values in the native library.
1 parent e7cfa17 commit fd8b185

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

src/Magick.NET/MagickImage.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7163,8 +7163,6 @@ private MagickReadSettings CreateReadSettings(IMagickReadSettings<QuantumType>?
71637163
else
71647164
newReadSettings = new MagickReadSettings(readSettings);
71657165

7166-
newReadSettings.ForceSingleFrame();
7167-
71687166
return newReadSettings;
71697167
}
71707168

src/Magick.NET/Settings/MagickReadSettings.cs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ public bool UseMonochrome
125125
/// </summary>
126126
public uint? Width { get; set; }
127127

128-
internal void ForceSingleFrame()
129-
{
130-
FrameCount = 1;
131-
ApplyFrame();
132-
}
133-
134128
private static string GetDefineKey(IDefine define)
135129
{
136130
if (define.Format == MagickFormat.Unknown)
@@ -139,19 +133,6 @@ private static string GetDefineKey(IDefine define)
139133
return EnumHelper.GetName(define.Format) + ":" + define.Name;
140134
}
141135

142-
private string? GetScenes()
143-
{
144-
if (!FrameIndex.HasValue && (!FrameCount.HasValue || FrameCount.Value == 1))
145-
return null;
146-
147-
if (FrameIndex.HasValue && (!FrameCount.HasValue || FrameCount.Value == 1))
148-
return FrameIndex.Value.ToString(CultureInfo.InvariantCulture);
149-
150-
var frame = FrameIndex ?? 0;
151-
var count = FrameCount ?? 1;
152-
return string.Format(CultureInfo.InvariantCulture, "{0}-{1}", frame, frame + count);
153-
}
154-
155136
private void ApplyDefines()
156137
{
157138
if (Defines is null)
@@ -178,9 +159,13 @@ private void ApplyFrame()
178159
if (!FrameIndex.HasValue && !FrameCount.HasValue)
179160
return;
180161

181-
Scenes = GetScenes();
182162
Scene = FrameIndex ?? 0;
183163
NumberScenes = FrameCount ?? 1;
164+
165+
if (FrameIndex.HasValue && (!FrameCount.HasValue || FrameCount.Value == 1))
166+
Scenes = FrameIndex.Value.ToString(CultureInfo.InvariantCulture);
167+
else
168+
Scenes = string.Format(CultureInfo.InvariantCulture, "{0}-{1}", Scene, Scene + NumberScenes);
184169
}
185170

186171
private void Copy(IMagickReadSettings<QuantumType> settings)

0 commit comments

Comments
 (0)