diff options
Diffstat (limited to 'core/fpdfapi/page/cpdf_contentmark.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp index 29d1bba210..1ff567d9e6 100644 --- a/core/fpdfapi/page/cpdf_contentmark.cpp +++ b/core/fpdfapi/page/cpdf_contentmark.cpp @@ -6,6 +6,7 @@ #include "core/fpdfapi/page/cpdf_contentmark.h" +#include <algorithm> #include <utility> #include "core/fpdfapi/parser/cpdf_dictionary.h" @@ -79,6 +80,20 @@ void CPDF_ContentMark::DeleteLastMark() { m_pMarkData.Reset(); } +size_t CPDF_ContentMark::FindFirstDifference( + const CPDF_ContentMark* other) const { + if (m_pMarkData == other->m_pMarkData) + return CountItems(); + + size_t min_len = std::min(CountItems(), other->CountItems()); + + for (size_t i = 0; i < min_len; ++i) { + if (GetItem(i) != other->GetItem(i)) + return i; + } + return min_len; +} + CPDF_ContentMark::MarkData::MarkData() {} CPDF_ContentMark::MarkData::MarkData(const MarkData& src) |