38 return SkString(fMinimal ?
"persptext_minimal" :
"persptext");
47 canvas->
clear(0xffffffff);
50 paint.setAntiAlias(
true);
53 font.setSubpixel(
true);
55 font.setBaselineSnap(
false);
57 const char*
text =
"Hamburgefons";
58 const size_t textLen = strlen(
text);
66 float kMinimalFactor = fMinimal ? 32.f : 1.f;
67 for (
auto pm : {PerspMode::kX, PerspMode::kY, PerspMode::kXY}) {
68 for (
int i = 0;
i < kSteps; ++
i) {
70#ifdef TEST_PERSP_CHECK
80 persp.
setPerspX(
i*0.0005f/kSteps/kMinimalFactor);
86 persp.
setPerspY(
i*0.0025f/kSteps/kMinimalFactor);
89 persp.
setPerspX(
i*-0.00025f/kSteps/kMinimalFactor);
90 persp.
setPerspY(
i*-0.00125f/kSteps/kMinimalFactor);
98#ifdef TEST_PERSP_CHECK
108 y += textHeight + 5.f;
112 x += textWidth + 10.f;
113 y = textHeight + 5.f;
119 enum class PerspMode { kX, kY, kXY };
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void onDraw(SkCanvas *canvas) override
PerspTextGM(bool minimal)
SkString getName() const override
SkISize getISize() override
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void clear(SkColor color)
void concat(const SkMatrix &matrix)
static bool NearlyAffine(const SkMatrix &m, const SkRect &bounds, SkScalar tolerance=SK_ScalarNearlyZero)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
SkMatrix & setPerspX(SkScalar v)
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
SkMatrix & setPerspY(SkScalar v)
static const SkMatrix & I()
Optional< SkRect > bounds
font
Font Metadata and Metrics.
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)