43 , fSceneSize(sceneSize)
45 , fUseLocalMatrixWrapper(useLocalMatrixWrapper)
53 this->drawTile(pictureCanvas);
60 this->drawTile(&bitmapCanvas);
65 fUseLocalMatrixWrapper ?
"_localwrapper" :
"",
66 fAlpha < 1 ?
"_alpha" :
"");
73 this->drawSceneColumn(canvas,
SkPoint::Make(0, fSceneSize * 6.4f), 1, 2, 0);
74 this->drawSceneColumn(canvas,
SkPoint::Make(fSceneSize * 2.4f, 0), 1, 1, 1);
75 this->drawSceneColumn(canvas,
SkPoint::Make(fSceneSize * 2.4f, fSceneSize * 6.4f), 1, 1, 2);
76 this->drawSceneColumn(canvas,
SkPoint::Make(fSceneSize * 4.8f, 0), 2, 1, 0);
77 this->drawSceneColumn(canvas,
SkPoint::Make(fSceneSize * 9.6f, 0), 2, 2, 0);
84 this->drawScene(canvas, ctm, localMatrix, 0);
88 this->drawScene(canvas, ctm, localMatrix, 0);
92 this->drawScene(canvas, ctm, localMatrix, 0);
94 ctm.
setTranslate(fSceneSize * 13.8f, fSceneSize * 14.3f);
99 this->drawScene(canvas, ctm, localMatrix, 0);
109 localMatrix.
setScale(localScale, localScale);
110 this->drawScene(canvas, ctm, localMatrix, tileMode);
115 localMatrix.
preScale(localScale, localScale);
116 this->drawScene(canvas, ctm, localMatrix, tileMode);
121 localMatrix.
preScale(localScale, localScale);
122 this->drawScene(canvas, ctm, localMatrix, tileMode);
127 localMatrix.
preScale(localScale, localScale);
128 this->drawScene(canvas, ctm, localMatrix, tileMode);
134 localMatrix.
preScale(localScale, localScale);
135 this->drawScene(canvas, ctm, localMatrix, tileMode);
142 paint.setAntiAlias(
true);
144 canvas->
drawCircle(fTileSize / 4, fTileSize / 4, fTileSize / 4,
paint);
146 fTileSize / 2, fTileSize / 2),
paint);
149 canvas->
drawLine(fTileSize / 2, fTileSize * 1 / 3,
150 fTileSize / 2, fTileSize * 2 / 3,
paint);
151 canvas->
drawLine(fTileSize * 1 / 3, fTileSize / 2,
152 fTileSize * 2 / 3, fTileSize / 2,
paint);
168 paint.setAlphaf(fAlpha);
173 fUseLocalMatrixWrapper ?
nullptr : &localMatrix,
175 paint.setShader(fUseLocalMatrixWrapper
176 ? pictureShader->makeWithLocalMatrix(localMatrix)
185 fUseLocalMatrixWrapper ?
nullptr : &localMatrix);
186 paint.setShader(fUseLocalMatrixWrapper
187 ? bitmapShader->makeWithLocalMatrix(localMatrix)
197 const bool fUseLocalMatrixWrapper;
202 using INHERITED =
GM;
222 p.setStrokeWidth(10);
231 p.setColor(0xFFB6B6B6);
240 enum class DrawStrategy {
249 case DrawStrategy::kDirect: {
253 case DrawStrategy::kPictureShader: {
266 font.setTypeface(typeface);
280 m.preScale(2.f, 2.f);
288 for (
auto strategy : { DrawStrategy::kDirect,
289 DrawStrategy::kPictureShader }) {
296 canvas->
drawRect({-1, -1, 101, 101}, outline);
constexpr SkColor SK_ColorLTGRAY
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
@ kNormal
glyph outlines modified to improve constrast
#define SkScalarCeilToInt(x)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
SkString getName() const override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
PictureShaderGM(SkScalar tileSize, SkScalar sceneSize, bool useLocalMatrixWrapper=false, float alpha=1)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
void eraseColor(SkColor4f) const
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void drawPaint(const SkPaint &paint)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void clear(SkColor color)
void concat(const SkMatrix &matrix)
void drawPicture(const SkPicture *picture)
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static SkM44 Rotate(SkV3 axis, SkScalar radians)
SkM44 & preConcat(const SkM44 &m)
static SkM44 Perspective(float near, float far, float angle)
SkM44 & preTranslate(SkScalar x, SkScalar y, SkScalar z=0)
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
SkMatrix & preRotate(SkScalar degrees, SkScalar px, SkScalar py)
SkMatrix & setSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
SkMatrix & preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
void setStyle(Style style)
void setColor(SkColor color)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setStrokeWidth(SkScalar width)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const
static sk_sp< SkTextBlob > MakeFromString(const char *string, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
GM(SkColor backgroundColor=SK_ColorWHITE)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< const SkPicture > picture
drawPicture(r.picture.get(), &r.matrix, r.paint)) DRAW(DrawTextBlob
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
SkSamplingOptions(SkFilterMode::kLinear))
DEF_SIMPLE_GM(tiled_picture_shader, canvas, 400, 400)
static struct @262 kTileConfigs[]
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkPoint Make(float x, float y)
constexpr float y() const
constexpr float x() const
void inset(float dx, float dy)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)