Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Surface_MakeRasterDirect.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=3f5aeb870104187643197354a7f1d27a
5REG_FIDDLE(Surface_MakeRasterDirect, 256, 256, true, 0) {
6void draw(SkCanvas*) {
8 const size_t size = info.computeMinByteSize();
9 SkPMColor* pixels = new SkPMColor[size];
11 SkCanvas* canvas = surface->getCanvas();
12 canvas->clear(SK_ColorWHITE);
13 SkPMColor pmWhite = pixels[0];
15 canvas->drawPoint(1, 1, paint);
16 for (int y = 0; y < info.height(); ++y) {
17 for (int x = 0; x < info.width(); ++x) {
18 SkDebugf("%c", *pixels++ == pmWhite ? '-' : 'x');
19 }
20 SkDebugf("\n");
21 }
22 delete[] pixels;
23}
24} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
uint32_t SkPMColor
Definition SkColor.h:205
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawPoint(SkScalar x, SkScalar y, const SkPaint &paint)
void clear(SkColor color)
Definition SkCanvas.h:1199
const Paint & paint
VkSurfaceKHR surface
Definition main.cc:49
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
double y
double x
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
static SkImageInfo MakeN32Premul(int width, int height)