Flutter Engine
The Flutter Engine
upscale_checkerboard.cpp
Go to the documentation of this file.
1// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(upscale_checkerboard, 512, 512, false, 0) {
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)
REG_FIDDLE(upscale_checkerboard, 512, 512, false, 0)