55 const char*
s =
"01234567890!@#$%^&*=+<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
59 for (
int y = 0;
y < atlasSize;
y += cellSize) {
60 for (
int x = 0;
x < atlasSize;
x += cellSize) {
63 int index =
i % strlen(
s);
70 return surface->makeImageSnapshot();
74 static constexpr int kMaxScale = 2;
75 static constexpr int kCellSize = 32;
76 static constexpr int kAtlasSize = 512;
92 fVelocity.
fX = -fVelocity.
fX;
93 }
else if (fCenter.
fX <
bounds.left()) {
95 fVelocity.
fX = -fVelocity.
fX;
98 if (fVelocity.
fY > 0) {
99 fVelocity.
fY = -fVelocity.
fY;
101 }
else if (fCenter.
fY <
bounds.top()) {
102 if (fVelocity.
fY < 0) {
103 fVelocity.
fY = -fVelocity.
fY;
119 }
else if (fAlpha < 0) {
156 fTex[
i].
setXYWH(sx, sy, cell, cell);
158 fRec[
i].fCenter.set(sx + cell/2, sy + 3*cell/4);
173 fUseColors = !fUseColors;
181 for (
int i = 0;
i < N; ++
i) {
183 xform[
i] = fRec[
i].asRSXform();
223 bool animate(
double )
override {
return true; }
226 bool animate(
double nanos)
override {
228 fAnimatingDrawable->setSweep(angle);
void(* DrawAtlasProc)(SkCanvas *, SkImage *, const SkRSXform[], const SkRect[], const SkColor[], int, const SkRect *, const SkSamplingOptions &, const SkPaint *)
static void draw_atlas(SkCanvas *canvas, SkImage *atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, const SkRect *cull, const SkSamplingOptions &sampling, const SkPaint *paint)
static sk_sp< SkImage > make_atlas(int atlasSize, int cellSize)
static void draw_atlas_sim(SkCanvas *canvas, SkImage *atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, const SkRect *cull, const SkSamplingOptions &sampling, const SkPaint *paint)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
@ kUTF8
uses bytes to represent UTF-8 or ASCII
#define SkScalarMod(x, y)
#define SkDoubleToScalar(x)
SkRect onGetBounds() override
void onDraw(SkCanvas *canvas) override
DrawAtlasDrawable(DrawAtlasProc proc, const SkRect &r)
DrawAtlasSlide(const char name[], DrawAtlasProc proc)
bool onChar(SkUnichar uni) override
SkISize getDimensions() const override
void load(SkScalar winWidth, SkScalar winHeight) override
bool animate(double) override
void draw(SkCanvas *canvas) override
void drawDrawable(SkDrawable *drawable, const SkMatrix *matrix=nullptr)
@ kFast_SrcRectConstraint
sample outside bounds; faster
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void drawAtlas(const SkImage *atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkBlendMode mode, const SkSamplingOptions &sampling, const SkRect *cullRect, const SkPaint *paint)
void concat(const SkMatrix &matrix)
static void Draw(SkCanvas *, const void *text, size_t size, SkTextEncoding, SkScalar x, SkScalar y, const SkFont &, const SkPaint &, Align=kLeft_Align)
sk_sp< const SkImage > atlas
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
PODArray< SkColor > colors
SkSamplingOptions sampling
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library name
font
Font Metadata and Metrics.
static SkImageInfo MakeN32Premul(int width, int height)
constexpr float y() const
constexpr float x() const
static SkRect Make(const SkISize &size)
void setXYWH(float x, float y, float width, float height)
void outset(float dx, float dy)