Flutter Engine
The Flutter Engine
Functions | Variables
widebuttcaps.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrDirectContext.h"
#include "src/base/SkRandom.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrDrawingManager.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/ops/TessellationPathRenderer.h"

Go to the source code of this file.

Functions

static void draw_strokes (SkCanvas *canvas, SkRandom *rand, const SkPath &path, const SkPath &cubic)
 
static void draw_test (SkCanvas *canvas)
 
 DEF_SIMPLE_GM (widebuttcaps, canvas, kTestWidth, kTestHeight)
 

Variables

static constexpr float kStrokeWidth = 100
 
static constexpr int kTestWidth = 120 * 4
 
static constexpr int kTestHeight = 120 * 3 + 140
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( widebuttcaps  ,
canvas  ,
kTestWidth  ,
kTestHeight   
)

Definition at line 81 of file widebuttcaps.cpp.

81 {
82 canvas->clear(SK_ColorBLACK);
83 draw_test(canvas);
84}
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
static void draw_test(SkCanvas *canvas)

◆ draw_strokes()

static void draw_strokes ( SkCanvas canvas,
SkRandom rand,
const SkPath path,
const SkPath cubic 
)
static

Definition at line 25 of file widebuttcaps.cpp.

26 {
27 SkPaint strokePaint;
28 strokePaint.setAntiAlias(true);
29 strokePaint.setStrokeWidth(kStrokeWidth);
31
32 SkAutoCanvasRestore arc(canvas, true);
34 strokePaint.setColor(rand->nextU() | 0xff808080);
35 canvas->drawPath(path, strokePaint);
36
37 canvas->translate(120, 0);
39 strokePaint.setColor(rand->nextU() | 0xff808080);
40 canvas->drawPath(path, strokePaint);
41
42 canvas->translate(120, 0);
44 strokePaint.setColor(rand->nextU() | 0xff808080);
45 canvas->drawPath(path, strokePaint);
46
47 canvas->translate(120, 0);
48 strokePaint.setColor(rand->nextU() | 0xff808080);
49 canvas->drawPath(cubic, strokePaint);
50}
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
void setStrokeJoin(Join join)
Definition: SkPaint.cpp:189
@ kRound_Join
adds circle
Definition: SkPaint.h:360
@ kMiter_Join
extends to miter limit
Definition: SkPaint.h:359
@ kBevel_Join
connects outside edges
Definition: SkPaint.h:361
void setStrokeWidth(SkScalar width)
Definition: SkPaint.cpp:159
uint32_t nextU()
Definition: SkRandom.h:42
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
AI float cubic(float precision, const SkPoint pts[], const VectorXform &vectorXform=VectorXform())
Definition: WangsFormula.h:195
static constexpr float kStrokeWidth

◆ draw_test()

static void draw_test ( SkCanvas canvas)
static

Definition at line 52 of file widebuttcaps.cpp.

52 {
53 SkRandom rand;
54
55 canvas->clear(SK_ColorBLACK);
56
57 SkAutoCanvasRestore arc(canvas, true);
58 canvas->translate(60, 60);
59
60 draw_strokes(canvas, &rand,
61 SkPath().lineTo(10,0).lineTo(10,10),
62 SkPath().cubicTo(10,0, 10,0, 10,10));
63 canvas->translate(0, 120);
64
65 draw_strokes(canvas, &rand,
66 SkPath().lineTo(0,-10).lineTo(0,10),
67 SkPath().cubicTo(0,-10, 0,-10, 0,10));
68 canvas->translate(0, 120);
69
70 draw_strokes(canvas, &rand,
71 SkPath().lineTo(0,-10).lineTo(10,-10).lineTo(10,10).lineTo(0,10),
72 SkPath().cubicTo(0,-10, 10,10, 0,10));
73 canvas->translate(0, 140);
74
75 draw_strokes(canvas, &rand,
76 SkPath().lineTo(0,-10).lineTo(10,-10).lineTo(10,0).lineTo(0,0),
77 SkPath().cubicTo(0,-10, 10,0, 0,0));
78 canvas->translate(0, 120);
79}
void clear(SkColor color)
Definition: SkCanvas.h:1199
Definition: SkPath.h:59
static void draw_strokes(SkCanvas *canvas, SkRandom *rand, const SkPath &path, const SkPath &cubic)

Variable Documentation

◆ kStrokeWidth

constexpr float kStrokeWidth = 100
staticconstexpr

Definition at line 21 of file widebuttcaps.cpp.

◆ kTestHeight

constexpr int kTestHeight = 120 * 3 + 140
staticconstexpr

Definition at line 23 of file widebuttcaps.cpp.

◆ kTestWidth

constexpr int kTestWidth = 120 * 4
staticconstexpr

Definition at line 22 of file widebuttcaps.cpp.