summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpvt_generateap.cpp
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-08-02 17:32:23 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-02 17:32:23 -0700
commit0d8c2d120efe62d79d083f25b43aa814d0f24646 (patch)
treeff010c1ca336ef612b76a226093b769aa0a71786 /core/fpdfdoc/cpvt_generateap.cpp
parent33e9b26ba3c191262d0abb945fda1efb3cdb3051 (diff)
downloadpdfium-0d8c2d120efe62d79d083f25b43aa814d0f24646.tar.xz
Generate default AP stream for strike out annotation.
This patch generates a default AP stream for strike out annotation so that strike out annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to ddc1938 to test strike out annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2206083002
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 9bde7e6b85..a19332bb7c 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -619,6 +619,35 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
return true;
}
+bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
+ CPDF_Dictionary* pAnnotDict) {
+ // If AP dictionary exists, we use the appearance defined in the
+ // existing AP dictionary.
+ if (pAnnotDict->KeyExist("AP"))
+ return false;
+
+ CFX_ByteTextBuf sAppStream;
+ CFX_ByteString sExtGSDictName = "GS";
+ sAppStream << "/" << sExtGSDictName << " gs ";
+
+ sAppStream << GetColorStringWithDefault(pAnnotDict,
+ CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
+ PaintOperation::STROKE);
+
+ CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ rect.Normalize();
+
+ FX_FLOAT fLineWidth = 1.0;
+ FX_FLOAT fY = (rect.top + rect.bottom) / 2;
+ sAppStream << fLineWidth << " w " << rect.left << " " << fY << " m "
+ << rect.right << " " << fY << " l S\n";
+
+ CPDF_Dictionary* pExtGStateDict =
+ GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal");
+ GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pExtGStateDict);
+ return true;
+}
+
// Static.
CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,