make ext gstates stacked
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / Check if this commit has already been published (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled

This commit is contained in:
Alexander Vinnikov
2026-02-11 18:39:33 +00:00
committed by BobLd
parent d6e86b057e
commit d69e3fa6a9
+9 -2
View File
@@ -24,7 +24,7 @@
private readonly StackDictionary<NameToken, IndirectReference> currentFontState = new StackDictionary<NameToken, IndirectReference>(); private readonly StackDictionary<NameToken, IndirectReference> currentFontState = new StackDictionary<NameToken, IndirectReference>();
private readonly StackDictionary<NameToken, IndirectReference> currentXObjectState = new StackDictionary<NameToken, IndirectReference>(); private readonly StackDictionary<NameToken, IndirectReference> currentXObjectState = new StackDictionary<NameToken, IndirectReference>();
private readonly Dictionary<NameToken, DictionaryToken> extendedGraphicsStates = new Dictionary<NameToken, DictionaryToken>(); private readonly StackDictionary<NameToken, DictionaryToken> extendedGraphicsStates = new StackDictionary<NameToken, DictionaryToken>();
private readonly StackDictionary<NameToken, ResourceColorSpace> namedColorSpaces = new StackDictionary<NameToken, ResourceColorSpace>(); private readonly StackDictionary<NameToken, ResourceColorSpace> namedColorSpaces = new StackDictionary<NameToken, ResourceColorSpace>();
private readonly Dictionary<NameToken, ColorSpaceDetails> loadedNamedColorSpaceDetails = new Dictionary<NameToken, ColorSpaceDetails>(); private readonly Dictionary<NameToken, ColorSpaceDetails> loadedNamedColorSpaceDetails = new Dictionary<NameToken, ColorSpaceDetails>();
@@ -56,6 +56,7 @@
namedColorSpaces.Push(); namedColorSpaces.Push();
currentFontState.Push(); currentFontState.Push();
currentXObjectState.Push(); currentXObjectState.Push();
extendedGraphicsStates.Push();
if (resourceDictionary.TryGet(NameToken.Font, out var fontBase)) if (resourceDictionary.TryGet(NameToken.Font, out var fontBase))
{ {
@@ -190,6 +191,7 @@
currentFontState.Pop(); currentFontState.Pop();
currentXObjectState.Pop(); currentXObjectState.Pop();
namedColorSpaces.Pop(); namedColorSpaces.Pop();
extendedGraphicsStates.Pop();
} }
private void LoadFontDictionary(DictionaryToken fontDictionary) private void LoadFontDictionary(DictionaryToken fontDictionary)
@@ -348,8 +350,13 @@
public DictionaryToken? GetExtendedGraphicsStateDictionary(NameToken name) public DictionaryToken? GetExtendedGraphicsStateDictionary(NameToken name)
{ {
if (parsingOptions.UseLenientParsing && !extendedGraphicsStates.ContainsKey(name)) if (parsingOptions.UseLenientParsing)
{ {
if (extendedGraphicsStates.TryGetValue(name, out var dictToken))
{
return dictToken;
}
parsingOptions.Logger.Error($"The graphic state dictionary does not contain the key '{name}'."); parsingOptions.Logger.Error($"The graphic state dictionary does not contain the key '{name}'.");
return null; return null;
} }