From 09b419242ed85acb6ddf64cddfaa7ca8fbb07b1a Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 27 Oct 2017 20:39:29 +0000 Subject: Revert "Revert "Reland "Remove ContrastAdjust().""" This reverts commit 978ba20ffd0d2b37bf02b9d86828fa701c0c02fa. Reason for revert: I now have the new expected files for the chrome test ready in https://chromium-review.googlesource.com/c/chromium/src/+/742061 Landing this again and will immediately add a manual pdfium roll to cl 742061 to unblock the deps roller. Original change's description: > Revert "Reland "Remove ContrastAdjust()."" > > This reverts commit d5ec7ab0cd0663184d6056bc6fc87c86ec345342. > > Reason for revert: Did not mean to reland, just create the reland CL. > > Original change's description: > > Reland "Remove ContrastAdjust()." > > > > Original change's description: > > > Revert "Remove ContrastAdjust()." > > > > > > This reverts commit 53d443f042b590ae2d920def16bc9daf66f8427d. > > > > > > Reason for revert: Breaks PDFToPWGRasterBrowserTest > > > > > > Original change's description: > > > > Remove ContrastAdjust(). > > > > > > > > This post-processing increased the contrast of scaled-down features - > > > > mainly lines and fonts, relative to the background. The effect does not > > > > improved readability and in some cases makes the scaled-down version > > > > look like a different document at a glance. Text that is normal > > > > weight appears bold when scaled down in these cases. > > > > > > > > Change-Id: I2544d45e2bcec25d6742d2a60c1316d8df08cce1 > > > > Reviewed-on: https://pdfium-review.googlesource.com/15471 > > > > Commit-Queue: Henrique Nakashima > > > > Reviewed-by: dsinclair > > > > > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > > > > > # Not skipping CQ checks because original CL landed > 1 day ago. > > > > > > Change-Id: I7f61650bc6d917b3c6640da60f3f740ef4498de0 > > > Reviewed-on: https://pdfium-review.googlesource.com/16970 > > > Commit-Queue: Henrique Nakashima > > > Reviewed-by: Henrique Nakashima > > > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > > > Change-Id: I77d4377d30908d1e2d4dc842300a761072a5fbd4 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Reviewed-on: https://pdfium-review.googlesource.com/16990 > > Reviewed-by: Henrique Nakashima > > Commit-Queue: Henrique Nakashima > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > Change-Id: Ie2e91662a1e82c0a793952aab47c2acbde1596d4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://pdfium-review.googlesource.com/16991 > Reviewed-by: Henrique Nakashima > Commit-Queue: Henrique Nakashima TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org Change-Id: Iaae451131043ee69052809680922fdac06a69458 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/16992 Reviewed-by: Henrique Nakashima Commit-Queue: Henrique Nakashima --- .../parser/cpdf_security_handler_embeddertest.cpp | 4 +- .../parser/fpdf_parser_decode_embeddertest.cpp | 4 +- core/fxge/cfx_facecache.cpp | 55 ++-------------------- 3 files changed, 7 insertions(+), 56 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp index 3770e98d86..91e625ab26 100644 --- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp +++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp @@ -43,11 +43,11 @@ TEST_F(CPDFSecurityHandlerEmbeddertest, OwnerPassword) { TEST_F(CPDFSecurityHandlerEmbeddertest, PasswordAfterGenerateSave) { #if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ - const char md5[] = "e4a3701ca5b2a759e06455aa8d97d46e"; + const char md5[] = "7048dca58e2ed8f93339008b91e4eb4e"; #elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ const char md5[] = "6951b6c9891dfe0332a5b1983e484400"; #else - const char md5[] = "50985f3440d3f66c3b599ab138214015"; + const char md5[] = "a5dde3c6c37b8716b9b369a03752a728"; #endif // _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ { ASSERT_TRUE(OpenDocument("encrypted.pdf", "5678", true)); diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp index bb186924b6..bf2fd6d10f 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp @@ -115,9 +115,9 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) { #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a"; #elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - const char kExpectedMd5sum[] = "9a2637b73fd5265309bfddd9c69476cd"; + const char kExpectedMd5sum[] = "e5a6fa28298db07484cd922f3e210c88"; #else - const char kExpectedMd5sum[] = "f7e129d97c58e91adeace32a4327b925"; + const char kExpectedMd5sum[] = "2baa4c0e1758deba1b9c908e1fbd04ed"; #endif CompareBitmap(bitmap, 200, 200, kExpectedMd5sum); FPDFBitmap_Destroy(bitmap); diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp index a3e58ff29c..3f037ac65a 100644 --- a/core/fxge/cfx_facecache.cpp +++ b/core/fxge/cfx_facecache.cpp @@ -35,48 +35,8 @@ namespace { constexpr uint32_t kInvalidGlyphIndex = static_cast(-1); -constexpr int kMinPixel = 0; -constexpr int kMaxPixel = 255; - constexpr int kMaxGlyphDimension = 2048; -void ContrastAdjust(uint8_t* pDataIn, - uint8_t* pDataOut, - int nWidth, - int nHeight, - int nSrcRowBytes, - int nDstRowBytes) { - int max = kMinPixel; - int min = kMaxPixel; - for (int row = 0; row < nHeight; row++) { - uint8_t* pRow = pDataIn + row * nSrcRowBytes; - for (int col = 0; col < nWidth; col++) { - int val = pRow[col]; - max = std::max(val, max); - min = std::min(val, min); - } - } - int diff = max - min; - if (diff == kMinPixel || diff == kMaxPixel) { - int rowbytes = std::min(abs(nSrcRowBytes), nDstRowBytes); - for (int row = 0; row < nHeight; row++) { - memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes, - rowbytes); - } - return; - } - float rate = 255.f / diff; - for (int row = 0; row < nHeight; row++) { - uint8_t* pSrcRow = pDataIn + row * nSrcRowBytes; - uint8_t* pDstRow = pDataOut + row * nDstRowBytes; - for (int col = 0; col < nWidth; col++) { - int val = static_cast((pSrcRow[col] - min) * rate + 0.5); - pDstRow[col] = - static_cast(pdfium::clamp(val, kMinPixel, kMaxPixel)); - } - } -} - struct UniqueKeyGen { void Generate(int count, ...); @@ -224,18 +184,9 @@ std::unique_ptr CFX_FaceCache::RenderGlyph( } } else { memset(pDestBuf, 0, dest_pitch * bmheight); - if (anti_alias == FXFT_RENDER_MODE_MONO && - FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == - FXFT_PIXEL_MODE_MONO) { - int rowbytes = abs(src_pitch) > dest_pitch ? dest_pitch : abs(src_pitch); - for (int row = 0; row < bmheight; row++) { - memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, - rowbytes); - } - } else { - ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch, - dest_pitch); - } + int rowbytes = std::min(abs(src_pitch), dest_pitch); + for (int row = 0; row < bmheight; row++) + memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, rowbytes); } return pGlyphBitmap; } -- cgit v1.2.3