summaryrefslogtreecommitdiff
path: root/core/fxge/skia
diff options
context:
space:
mode:
authorCary Clark <caryclark@skia.org>2017-07-05 12:17:08 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-05 19:35:29 +0000
commiteea0467aeeb7d0a0f3dffeed4eb1a35d950fdbee (patch)
treee4bf3bd2cd904c1ba95ee95b410fca6ece02a153 /core/fxge/skia
parent8528723bc8aa97c62254c9f22afdd6b9f19570de (diff)
downloadpdfium-eea0467aeeb7d0a0f3dffeed4eb1a35d950fdbee.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'core/fxge/skia')
-rw-r--r--core/fxge/skia/fx_skia_device.cpp17
1 files changed, 17 insertions, 0 deletions
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<CFX_DIBitmap>& 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<SkUnichar> 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<uint16_t>(cp.m_GlyphIndex);
}
+#if SHOW_TEXT_GLYPHS
+ SkTDArray<SkUnichar> 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_