aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/textblobmixedsizes.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2016-03-04 00:12:33 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-04 00:12:34 -0800
commit68c63b3727f05638a95fcf5f65c5476a2fcb34d0 (patch)
tree6e6f44df1192216cf5d7d4211b4cc83a8263e43a /gm/textblobmixedsizes.cpp
parent56fb57a05159b72a746ab534c3daf50d4220acef (diff)
Avoid drawing NVPR DIF text when text size is 0
Avoid drawing text when using NVPR and device independent fonts. The drawing calculations cause division by zero and produce NaNs to transforms (due to fTextInverseRatio). Reproed by top25desk_twitter.skp as well as the added testcase. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1760163002 Review URL: https://codereview.chromium.org/1760163002
Diffstat (limited to 'gm/textblobmixedsizes.cpp')
-rw-r--r--gm/textblobmixedsizes.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp
index 330d33f62c..86ab0ac8fb 100644
--- a/gm/textblobmixedsizes.cpp
+++ b/gm/textblobmixedsizes.cpp
@@ -73,6 +73,13 @@ protected:
sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset);
+ // Zero size.
+ paint.measureText(text, strlen(text), &bounds);
+ yOffset += bounds.height();
+ paint.setTextSize(0);
+
+ sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset);
+
// build
fBlob.reset(builder.build());
}