skia2/gm/text_scale_skew.cpp
Mike Reed 71f5a0b56d update more gms to use textutils
Bug: skia:
Change-Id: I90f434b56e07c88b9de58be531c7a73fe385ca05
Reviewed-on: https://skia-review.googlesource.com/c/165140
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-10-25 20:58:59 +00:00

28 lines
718 B
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkTextUtils.h"
// http://bug.skia.org/7315
DEF_SIMPLE_GM(text_scale_skew, canvas, 256, 128) {
SkPaint p;
p.setTextSize(18.0f);
p.setAntiAlias(true);
float y = 10.0f;
for (float scale : { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) {
p.setTextScaleX(scale);
y += p.getFontSpacing();
float x = 50.0f;
for (float skew : { -0.5f, 0.0f, 0.5f }) {
p.setTextSkewX(skew);
SkTextUtils::DrawString(canvas, "Skia", x, y, p, SkPaint::kCenter_Align);
x += 78.0f;
}
}
}