34#if defined(SK_GRAPHITE)
39#include <initializer_list>
46 constexpr SkPoint kPts[] = { { 0, 0 }, { 32, 32 } };
48 constexpr SkColor kColors[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
55 memset(matrix, 0, 20 *
sizeof(
float));
56 matrix[0] = matrix[5] = matrix[10] = 0.2126f;
57 matrix[1] = matrix[6] = matrix[11] = 0.7152f;
58 matrix[2] = matrix[7] = matrix[12] = 0.0722f;
97#if defined(SK_GRAPHITE)
109 *errorMsg =
SkStringPrintf(
"Unable to instantiate emoji test font of format %s.",
116 size_t textLen = strlen(
text);
119 constexpr SkScalar textSizes[] = { 10, 30, 50 };
122 for (
const bool& fakeBold : {
false,
true }) {
123 font.setEmbolden(fakeBold);
124 for (
const SkScalar& textSize : textSizes) {
125 font.setSize(textSize);
126 font.getMetrics(&metrics);
136 font.getMetrics(&metrics);
143 for (
int makeLinear = 0; makeLinear < 2; makeLinear++) {
144 for (
int makeBlur = 0; makeBlur < 2; makeBlur++) {
145 for (
int makeGray = 0; makeGray < 2; makeGray++) {
146 for (
int makeMode = 0; makeMode < 2; ++makeMode) {
147 for (
int alpha = 0; alpha < 2; ++alpha) {
148 SkFont shaderFont(font.refTypeface());
173 shaderFont, shaderPaint);
194 boundsHalfWidth, boundsHalfHeight);
196 boundsHalfWidth, boundsHalfHeight);
197 SkRect interiorClip = bounds;
198 interiorClip.
inset(boundsQuarterWidth, boundsQuarterHeight);
200 const SkRect clipRects[] = { bounds, upperLeftClip, lowerRightClip, interiorClip };
207 for (
const SkRect& clipRect : clipRects) {
210 canvas->
drawRect(clipRect, clipHairline);
211 paint.setAlpha(0x20);
214 paint.setAlphaf(1.0f);
static sk_sp< SkColorFilter > make_grayscale()
#define SkColorSetRGB(r, g, b)
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorWHITE
@ kUTF8
uses bytes to represent UTF-8 or ASCII
SK_API SkString static SkString SkStringPrintf()
static constexpr bool SkToBool(const T &x)
static sk_sp< SkColorFilter > make_color_filter()
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)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > Lighting(SkColor mul, SkColor add)
void setSize(SkScalar textSize)
SkScalar getMetrics(SkFontMetrics *metrics) const
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
void setStyle(Style style)
void setColor(SkColor color)
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
@ kStroke_Style
set to stroke geometry
void setShader(sk_sp< SkShader > shader)
void setColorFilter(sk_sp< SkColorFilter > colorFilter)
DrawResult onDraw(SkCanvas *canvas, SkString *errorMsg) override
ToolUtils::EmojiTestSample emojiFont
ToolUtils::EmojiFontFormat fFormat
void modifyGrContextOptions(GrContextOptions *ctxOptions) override
SkString getName() const override
void onOnceBeforeDraw() override
SkISize getISize() override
ColorEmojiGM(ToolUtils::EmojiFontFormat format)
virtual void modifyGraphiteContextOptions(skgpu::graphite::ContextOptions *) const
static sk_sp< SkShader > MakeLinear()
static sk_sp< SkImageFilter > make_blur(float amount, sk_sp< SkImageFilter > input)
static sk_sp< SkColorFilter > make_color_filter()
uint32_t uint32_t * format
size_t fGlyphCacheTextureMaximumBytes
SkScalar fLeading
distance to add between lines, typically positive or zero
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fDescent
distance to reserve below baseline, typically positive
static constexpr SkISize Make(int32_t w, int32_t h)
void inset(float dx, float dy)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
size_t fGlyphCacheTextureMaximumBytes