Flutter Engine
The Flutter Engine
Functions
upscale_checkerboard.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (upscale_checkerboard, 512, 512, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( upscale_checkerboard  ,
512  ,
512  ,
false  ,
 
)

Definition at line 4 of file upscale_checkerboard.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 SkPMColor p[] = {0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF};
7 const auto info = SkImageInfo::MakeN32Premul(2, 2);
8 auto img = SkImages::RasterFromPixmapCopy({info, p, 8});
9
11 paint.setShader(img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
13
14 canvas->translate(20, 20);
15 canvas->scale(20, 20);
16 canvas->drawRect({0, 0, 20, 20}, paint);
17}
18} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
uint32_t SkPMColor
Definition: SkColor.h:205
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
const Paint & paint
Definition: color_source.cc:38
SK_API sk_sp< SkImage > RasterFromPixmapCopy(const SkPixmap &pixmap)
static SkImageInfo MakeN32Premul(int width, int height)