summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_facecache.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-10-27 17:29:10 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-10-27 17:29:18 +0000
commitd5ec7ab0cd0663184d6056bc6fc87c86ec345342 (patch)
tree5a3d4204ead787e75323bc48d0ad3125c83bfaec /core/fxge/cfx_facecache.cpp
parent42613d8961fe1011210facebe2c8187f79c8eb21 (diff)
downloadpdfium-d5ec7ab0cd0663184d6056bc6fc87c86ec345342.tar.xz
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 <hnakashima@chromium.org> > > Reviewed-by: dsinclair <dsinclair@chromium.org> > > 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 <hnakashima@chromium.org> > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> 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 <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxge/cfx_facecache.cpp')
-rw-r--r--core/fxge/cfx_facecache.cpp55
1 files changed, 3 insertions, 52 deletions
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<uint32_t>(-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<int>((pSrcRow[col] - min) * rate + 0.5);
- pDstRow[col] =
- static_cast<uint8_t>(pdfium::clamp(val, kMinPixel, kMaxPixel));
- }
- }
-}
-
struct UniqueKeyGen {
void Generate(int count, ...);
@@ -224,18 +184,9 @@ std::unique_ptr<CFX_GlyphBitmap> 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;
}