45 {
46
47 canvas->
clear(0xffffffff);
48
50 paint.setAntiAlias(
true);
51
53 font.setSubpixel(
true);
55 font.setBaselineSnap(
false);
56
57 const char*
text =
"Hamburgefons";
58 const size_t textLen = strlen(
text);
59
61 nullptr, nullptr);
63
65 const int kSteps = 8;
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
71
74#endif
75
77 switch (pm) {
78 case PerspMode::kX:
79 if (fMinimal) {
80 persp.
setPerspX(
i*0.0005f/kSteps/kMinimalFactor);
81 } else {
83 }
84 break;
85 case PerspMode::kY:
86 persp.
setPerspY(
i*0.0025f/kSteps/kMinimalFactor);
87 break;
88 case PerspMode::kXY:
89 persp.
setPerspX(
i*-0.00025f/kSteps/kMinimalFactor);
90 persp.
setPerspY(
i*-0.00125f/kSteps/kMinimalFactor);
91 break;
92 }
96
98#ifdef TEST_PERSP_CHECK
99
104 }
105#endif
107
108 y += textHeight + 5.f;
110 }
111
112 x += textWidth + 10.f;
113 y = textHeight + 5.f;
114 }
115
116 }
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
@ kUTF8
uses bytes to represent UTF-8 or ASCII
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 SkRect MakeXYWH(float x, float y, float w, float h)