From eea0467aeeb7d0a0f3dffeed4eb1a35d950fdbee Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Wed, 5 Jul 2017 12:17:08 -0400 Subject: show original text to aid in debugging disabled by default R=dsinclair@chromium.org,npm@chromium.org Bug: Change-Id: Iab08a7120d28b2d81a5e1d4768fd95a460208ebf Reviewed-on: https://pdfium-review.googlesource.com/7277 Reviewed-by: dsinclair Commit-Queue: Cary Clark --- core/fxge/skia/fx_skia_device.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/fxge') diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 0bdf3f8b7b..ab026f6cc4 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -159,6 +159,7 @@ void RgbByteOrderTransferBitmap(const CFX_RetainPtr& pBitmap, #define SHOW_SKIA_PATH_SHORTHAND 0 // set to 1 for abbreviated path contents #endif #define DRAW_SKIA_CLIP 0 // set to 1 to draw a green rectangle around the clip +#define SHOW_TEXT_GLYPHS 0 // set to 1 to print unichar equivalent of glyph #if SHOW_SKIA_PATH void DebugShowSkiaPaint(const SkPaint& paint) { @@ -837,6 +838,14 @@ class SkiaState { #ifdef _SKIA_SUPPORT_PATHS_ m_pDriver->PreMultiply(); #endif // _SKIA_SUPPORT_PATHS_ +#if SHOW_TEXT_GLYPHS + SkTDArray text; + text.setCount(m_glyphs.count()); + skPaint.glyphsToUnichars(m_glyphs.begin(), m_glyphs.count(), text.begin()); + for (size_t i = 0; i < m_glyphs.count(); ++i) + printf("%lc", m_glyphs[i]); + printf("\n"); +#endif skCanvas->drawPosText(m_glyphs.begin(), m_glyphs.count() * 2, m_positions.begin(), skPaint); skCanvas->restore(); @@ -1450,6 +1459,14 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, positions[index] = {cp.m_Origin.x * flip, cp.m_Origin.y * vFlip}; glyphs[index] = static_cast(cp.m_GlyphIndex); } +#if SHOW_TEXT_GLYPHS + SkTDArray text; + text.setCount(glyphs.count()); + paint.glyphsToUnichars(glyphs.begin(), glyphs.count(), text.begin()); + for (size_t i = 0; i < glyphs.count(); ++i) + printf("%lc", text[i]); + printf("\n"); +#endif #ifdef _SKIA_SUPPORT_PATHS_ m_pBitmap->PreMultiply(); #endif // _SKIA_SUPPORT_PATHS_ -- cgit v1.2.3