summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-21 19:10:19 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-21 19:10:19 -0700
commitbb577af2f17467a55c04fbff21a8f0ec1016601a (patch)
tree5a5321b1aff1bcc6ee6dc19928aa729a4ddc9a3d /fpdfsdk/cpdfsdk_widget.cpp
parent7149abce42b211ad3c0eaa39a340825acd41a1ec (diff)
downloadpdfium-bb577af2f17467a55c04fbff21a8f0ec1016601a.tar.xz
Remove some objnum locals with AddIndirectObject
Also, it's idempotent, so simplify some logic in callers to not care if objnum is zero. The alternate forms are rarely used, using the objnum form makes it clear that SetReferenceFor() can't possibly register the object as a side-effect. Review-Url: https://codereview.chromium.org/2361713002
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index d4fc5c7900..cc2a767039 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -1835,11 +1835,9 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType,
pStreamDict->SetFor("Resources", pStreamResList);
}
- if (pStreamResList) {
- CPDF_Dictionary* pXObject = new CPDF_Dictionary;
- pXObject->SetReferenceFor(sImageAlias, pDoc, pImage);
- pStreamResList->SetFor("XObject", pXObject);
- }
+ CPDF_Dictionary* pXObject = new CPDF_Dictionary;
+ pXObject->SetReferenceFor(sImageAlias, pDoc, pImage->GetObjNum());
+ pStreamResList->SetFor("XObject", pXObject);
}
void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) {