summaryrefslogtreecommitdiff
path: root/poppler/Gfx.cc
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-02-27 15:44:01 +0100
committerAlbert Astals Cid <aacid@kde.org>2019-02-27 17:59:49 +0100
commit49ecbd5933e5b182ffc211d281cdfdc499d0357e (patch)
treec1e3e87aa9a708a63c34970c14be35489d391b24 /poppler/Gfx.cc
parent099a09c57224a8072d1591c193815e6434178f25 (diff)
Change Dict::lookupNF return a const &
Saves some copy()
Diffstat (limited to 'poppler/Gfx.cc')
-rw-r--r--poppler/Gfx.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index c80786e7..4da19c14 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -317,7 +317,6 @@ static inline bool isSameGfxColor(const GfxColor &colorA, const GfxColor &colorB
GfxResources::GfxResources(XRef *xrefA, Dict *resDictA, GfxResources *nextA) :
gStateCache(2), xref(xrefA) {
- Object obj1, obj2;
Ref r;
if (resDictA) {
@@ -325,9 +324,9 @@ GfxResources::GfxResources(XRef *xrefA, Dict *resDictA, GfxResources *nextA) :
// build font dictionary
Dict *resDict = resDictA->copy(xref);
fonts = nullptr;
- obj1 = resDict->lookupNF("Font");
+ const Object &obj1 = resDict->lookupNF("Font");
if (obj1.isRef()) {
- obj2 = obj1.fetch(xref);
+ Object obj2 = obj1.fetch(xref);
if (obj2.isDict()) {
r = obj1.getRef();
fonts = new GfxFontDict(xref, &r, obj2.getDict());
@@ -414,7 +413,7 @@ Object GfxResources::lookupXObjectNF(const char *name) {
for (resPtr = this; resPtr; resPtr = resPtr->next) {
if (resPtr->xObjDict.isDict()) {
- Object obj = resPtr->xObjDict.dictLookupNF(name);
+ Object obj = resPtr->xObjDict.dictLookupNF(name).copy();
if (!obj.isNull())
return obj;
}
@@ -428,7 +427,7 @@ Object GfxResources::lookupMarkedContentNF(const char *name) {
for (resPtr = this; resPtr; resPtr = resPtr->next) {
if (resPtr->propertiesDict.isDict()) {
- Object obj = resPtr->propertiesDict.dictLookupNF(name);
+ Object obj = resPtr->propertiesDict.dictLookupNF(name).copy();
if (!obj.isNull())
return obj;
}
@@ -457,7 +456,7 @@ GfxPattern *GfxResources::lookupPattern(const char *name, OutputDev *out, GfxSta
for (resPtr = this; resPtr; resPtr = resPtr->next) {
if (resPtr->patternDict.isDict()) {
- Object obj = resPtr->patternDict.dictLookupNF(name);
+ Object obj = resPtr->patternDict.dictLookupNF(name).copy();
if (!obj.isNull()) {
Ref patternRef = { -1, -1 };
if (obj.isRef()) {
@@ -515,7 +514,7 @@ Object GfxResources::lookupGStateNF(const char *name) {
for (resPtr = this; resPtr; resPtr = resPtr->next) {
if (resPtr->gStateDict.isDict()) {
- Object obj = resPtr->gStateDict.dictLookupNF(name);
+ Object obj = resPtr->gStateDict.dictLookupNF(name).copy();
if (!obj.isNull()) {
return obj;
}
@@ -4228,7 +4227,7 @@ void Gfx::doImage(Object *ref, Stream *str, bool inlineImg) {
// check for optional content key
if (ref) {
- obj1 = dict->lookupNF("OC");
+ obj1 = dict->lookupNF("OC").copy();
if (catalog->getOptContentConfig() && !catalog->getOptContentConfig()->optContentIsVisible(&obj1)) {
return;
}
@@ -4692,7 +4691,7 @@ void Gfx::doForm(Object *str) {
// check for optional content key
ocSaved = ocState;
- obj1 = dict->lookupNF("OC");
+ obj1 = dict->lookupNF("OC").copy();
if (catalog->getOptContentConfig() && !catalog->getOptContentConfig()->optContentIsVisible(&obj1)) {
if (out->needCharCount()) {
ocState = false;