Simplify GfxResources::lookupPattern
by using the new Dict::lookup that returns the Ref if the object is a
Ref
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index a9b93b6..47627ad 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -454,20 +454,13 @@
GfxPattern *GfxResources::lookupPattern(const char *name, OutputDev *out, GfxState *state) {
GfxResources *resPtr;
- GfxPattern *pattern;
for (resPtr = this; resPtr; resPtr = resPtr->next) {
if (resPtr->patternDict.isDict()) {
- Object obj = resPtr->patternDict.dictLookupNF(name).copy();
+ Ref patternRef = Ref::INVALID();
+ Object obj = resPtr->patternDict.getDict()->lookup(name, &patternRef);
if (!obj.isNull()) {
- Ref patternRef = { -1, -1 };
- if (obj.isRef()) {
- patternRef = obj.getRef();
- obj = obj.fetch(resPtr->patternDict.getDict()->getXRef());
- }
-
- pattern = GfxPattern::parse(resPtr, &obj, out, state, patternRef.num);
- return pattern;
+ return GfxPattern::parse(resPtr, &obj, out, state, patternRef.num);
}
}
}