35 : fEffectiveClip(effectiveClip)
43 name.append(
"_clipped");
45 name.append(
"_ignorable_clip");
50 name.append(
"_no_lcd");
65 SkASSERTF(4 == std::size(fTypefaces),
"typeface_cnt");
72 for (
int i = 0; i < kCnt; ++i) {
74 char text[kMaxLength];
75 for (
int j = 0; j <
length; ++j) {
80 fColors[i] = random.
nextU();
81 fColors[i] |= 0xFF000000;
85 constexpr SkScalar kMaxPtSize = 32.f;
89 fTypefaceIndices[i] = random.
nextULessThan(std::size(fTypefaces));
107 fClipRects[i].
offset(fOffsets[i].fX, fOffsets[i].fY);
108 fClipRects[i].
outset(2.f, 2.f);
110 if (fEffectiveClip) {
111 fClipRects[i].
fRight -= 0.25f * fClipRects[i].
width();
117 for (
int i = 0; i < kCnt; ++i) {
120 fFont.
setTypeface(fTypefaces[fTypefaceIndices[i]]);
124 canvas->
translate(fOffsets[i].fX, fOffsets[i].fY);
126 0, 0, fFont, fPaint);
136 for (
int i = 0; i < kCnt; ++i) {
137 canvas->
drawRect(fClipRects[i], wirePaint);
145 inline static constexpr int kCnt = 30;
146 inline static constexpr int kMinLength = 15;
147 inline static constexpr int kMaxLength = 40;
159 int fTypefaceIndices[kCnt];
#define SkASSERTF(cond, fmt,...)
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
static constexpr SkFontStyle Bold()
void setTypeface(sk_sp< SkTypeface > tf)
SkScalar measureText(const void *text, size_t byteLength, SkTextEncoding encoding, SkRect *bounds=nullptr) const
void setEdging(Edging edging)
void setSize(SkScalar textSize)
@ kAntiAlias
may have transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
uint32_t nextULessThan(uint32_t count)
uint32_t nextRangeU(uint32_t min, uint32_t max)
void set(const SkString &src)
bool runAsBench() const override
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
SkString getName() const override
SkISize getISize() override
VariedTextGM(bool effectiveClip, bool lcd)
static constexpr SkISize Make(int32_t w, int32_t h)
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
void outset(float dx, float dy)
SkScalar fRight
larger x-axis bounds
void offset(float dx, float dy)
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
SkScalar fTop
smaller y-axis bounds