Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Macros | Functions
fatpathfill.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathUtils.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSurface.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Macros

#define ZOOM   32
 
#define SMALL_W   9
 
#define SMALL_H   3
 
#define REPEAT_LOOP   5
 

Functions

static sk_sp< SkSurfacenew_surface (int width, int height)
 
static void draw_pixel_centers (SkCanvas *canvas)
 
static void draw_fatpath (SkCanvas *canvas, SkSurface *surface, const SkPath &path)
 
 DEF_SIMPLE_GM (fatpathfill, canvas, SMALL_W *ZOOM, SMALL_H *ZOOM *REPEAT_LOOP)
 

Macro Definition Documentation

◆ REPEAT_LOOP

#define REPEAT_LOOP   5

Definition at line 22 of file fatpathfill.cpp.

◆ SMALL_H

#define SMALL_H   3

Definition at line 21 of file fatpathfill.cpp.

◆ SMALL_W

#define SMALL_W   9

Definition at line 20 of file fatpathfill.cpp.

◆ ZOOM

#define ZOOM   32

Definition at line 19 of file fatpathfill.cpp.

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( fatpathfill  ,
canvas  ,
SMALL_W ZOOM,
SMALL_H *ZOOM REPEAT_LOOP 
)

Definition at line 55 of file fatpathfill.cpp.

57 {
59
60 canvas->scale(ZOOM, ZOOM);
61
64 paint.setStrokeWidth(SK_Scalar1);
65
66 for (int i = 0; i < REPEAT_LOOP; ++i) {
68 line.moveTo(1, 2);
69 line.lineTo(SkIntToScalar(4 + i), 1);
71 draw_fatpath(canvas, surface.get(), path);
72
73 canvas->translate(0, SMALL_H);
74 }
75}
#define SK_Scalar1
Definition SkScalar.h:18
#define SkIntToScalar(x)
Definition SkScalar.h:57
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
const Paint & paint
VkSurfaceKHR surface
Definition main.cc:49
static sk_sp< SkSurface > new_surface(int width, int height)
static void draw_fatpath(SkCanvas *canvas, SkSurface *surface, const SkPath &path)
#define SMALL_W
#define SMALL_H
#define REPEAT_LOOP
#define ZOOM
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)

◆ draw_fatpath()

static void draw_fatpath ( SkCanvas canvas,
SkSurface surface,
const SkPath path 
)
static

Definition at line 40 of file fatpathfill.cpp.

40 {
42
43 surface->getCanvas()->clear(SK_ColorTRANSPARENT);
44 surface->getCanvas()->drawPath(path, paint);
45 surface->draw(canvas, 0, 0);
46
47 paint.setAntiAlias(true);
48 paint.setColor(SK_ColorRED);
50 canvas->drawPath(path, paint);
51
52 draw_pixel_centers(canvas);
53}
constexpr SkColor SK_ColorTRANSPARENT
Definition SkColor.h:99
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
void drawPath(const SkPath &path, const SkPaint &paint)
static void draw_pixel_centers(SkCanvas *canvas)

◆ draw_pixel_centers()

static void draw_pixel_centers ( SkCanvas canvas)
static

Definition at line 28 of file fatpathfill.cpp.

28 {
30 paint.setColor(ToolUtils::color_to_565(0xFF0088FF));
31 paint.setAntiAlias(true);
32
33 for (int y = 0; y < SMALL_H; ++y) {
34 for (int x = 0; x < SMALL_W; ++x) {
35 canvas->drawCircle(x + 0.5f, y + 0.5f, 1.5f / ZOOM, paint);
36 }
37 }
38}
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
double y
double x
SkColor color_to_565(SkColor color)

◆ new_surface()

static sk_sp< SkSurface > new_surface ( int  width,
int  height 
)
static

Definition at line 24 of file fatpathfill.cpp.

24 {
26}
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
int32_t height
int32_t width
static SkImageInfo MakeN32Premul(int width, int height)