X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=pdf%2Fxpdf%2FAnnot.cc;h=42bf8499e0989fb1ff37f12b485c0d74d9a26a66;hb=refs%2Ftags%2FGNOME_2_8_ANCHOR;hp=68373f9b17e53bef5e070e656f29c813876ae558;hpb=7c5ab64d4db75e4bb6dadedb578e10178554d0db;p=evince.git diff --git a/pdf/xpdf/Annot.cc b/pdf/xpdf/Annot.cc index 68373f9b..42bf8499 100644 --- a/pdf/xpdf/Annot.cc +++ b/pdf/xpdf/Annot.cc @@ -21,15 +21,18 @@ // Annot //------------------------------------------------------------------------ -Annot::Annot(XRef *xrefA, Dict *dict) { +Annot::Annot(XRef *xrefA, Dict *dictA) { Object apObj, asObj, obj1, obj2; double t; ok = gFalse; xref = xrefA; + dict = dictA; + dict->incRef(); - if (dict->lookup("AP", &apObj)->isDict()) { - if (dict->lookup("AS", &asObj)->isName()) { + dictA->lookup("Subtype", &subtype); + if (dictA->lookup("AP", &apObj)->isDict()) { + if (dictA->lookup("AS", &asObj)->isName()) { if (apObj.dictLookup("N", &obj1)->isDict()) { if (obj1.dictLookupNF(asObj.getName(), &obj2)->isRef()) { obj2.copy(&appearance); @@ -49,7 +52,7 @@ Annot::Annot(XRef *xrefA, Dict *dict) { } apObj.free(); - if (dict->lookup("Rect", &obj1)->isArray() && + if (dictA->lookup("Rect", &obj1)->isArray() && obj1.arrayGetLength() == 4) { //~ should check object types here obj1.arrayGet(0, &obj2); @@ -97,7 +100,7 @@ void Annot::draw(Gfx *gfx) { Annots::Annots(XRef *xref, Object *annotsObj) { Annot *annot; - Object obj1, obj2; + Object obj1; int size; int i; @@ -108,21 +111,16 @@ Annots::Annots(XRef *xref, Object *annotsObj) { if (annotsObj->isArray()) { for (i = 0; i < annotsObj->arrayGetLength(); ++i) { if (annotsObj->arrayGet(i, &obj1)->isDict()) { - obj1.dictLookup("Subtype", &obj2); - if (obj2.isName("Widget") || - obj2.isName("Stamp")) { - annot = new Annot(xref, obj1.getDict()); - if (annot->isOk()) { - if (nAnnots >= size) { - size += 16; - annots = (Annot **)grealloc(annots, size * sizeof(Annot *)); - } - annots[nAnnots++] = annot; - } else { - delete annot; + annot = new Annot(xref, obj1.getDict()); + if (annot->isOk()) { + if (nAnnots >= size) { + size += 16; + annots = (Annot **)grealloc(annots, size * sizeof(Annot *)); } + annots[nAnnots++] = annot; + } else { + delete annot; } - obj2.free(); } obj1.free(); }