Flutter Engine
The Flutter Engine
Surface_MakeRaster_2.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.
4REG_FIDDLE(Surface_MakeRaster_2, 256, 256, true, 0) {
5void draw(SkCanvas* ) {
8 SkCanvas* canvas = surface->getCanvas();
9 canvas->clear(SK_ColorWHITE);
10 SkPixmap pixmap;
11 if (surface->peekPixels(&pixmap)) {
12 const uint32_t* colorPtr = pixmap.addr32();
13 SkPMColor pmWhite = colorPtr[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", colorPtr[x] == pmWhite ? '-' : 'x');
19 }
20 colorPtr += info.width();
21 SkDebugf("\n");
22 }
23 }
24}
25} // 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
REG_FIDDLE(Surface_MakeRaster_2, 256, 256, true, 0)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawPoint(SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2695
void clear(SkColor color)
Definition: SkCanvas.h:1199
const uint32_t * addr32() const
Definition: SkPixmap.h:352
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
double y
double x
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)