Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
crbug_996140.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/SkPathBuilder.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM_BG (crbug_996140, canvas, 300, 300, SK_ColorWHITE)
 

Function Documentation

◆ DEF_SIMPLE_GM_BG()

DEF_SIMPLE_GM_BG ( crbug_996140  ,
canvas  ,
300  ,
300  ,
SK_ColorWHITE   
)

Definition at line 31 of file crbug_996140.cpp.

31 {
32 // Specific parameters taken from the canvas minimum working example
33 SkScalar cx = 19.221f;
34 SkScalar cy = 720-6.76f;
35 SkScalar radius = 0.0295275590551181f;
36
37 SkScalar s = 203.20f;
38 SkScalar tx = -14.55f;
39 SkScalar ty = -711.51f;
40
41 // 0: The test canvas was 1920x574 and the circle was located in the bottom left, but that's
42 // not necessary to reproduce the problem, so translate to make a smaller GM.
43 canvas->translate(-800, -200);
44
45 // 3: ctx.beginPath();
46
47 // 4: ctx.scale(203.20, 203.20);
48 canvas->scale(s, s);
49 // 5: ctx.translate(-14.55, -711.51);
50 canvas->translate(tx, ty);
51
52 // 6: ctx.fillStyle = "red";
53 SkPaint fill;
56 fill.setAntiAlias(true);
57
58 // 7: ctx.strokeStyle = "blue";
59 SkPaint stroke;
60 stroke.setColor(SK_ColorBLUE);
61 stroke.setStrokeWidth(1.f);
63 stroke.setAntiAlias(true);
64
65 // 9: ctx.arc(19.221, 720-6.76,0.0295275590551181,0,2*Math.PI);
66 // This matches how Canvas prepares an arc(x, y, radius, 0, 2pi) call
67 SkRect boundingBox = SkRect::MakeLTRB(cx - radius, cy - radius, cx + radius, cy + radius);
68
69 auto path = SkPathBuilder().arcTo(boundingBox, 0, 180.f, false)
70 .arcTo(boundingBox, 180.f, 180.f, false)
71 .detach();
72
73 // 12: ctx.closePath();
74 // path.close();
75
76 // 10: ctx.stroke(); (NOT NEEDED TO REPRODUCE FAILING RED CIRCLE)
77 canvas->drawPath(path, stroke);
78 // 11: ctx.fill()
79 canvas->drawPath(path, fill);
80}
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
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
@ kFill_Style
set to fill geometry
Definition SkPaint.h:193
void setStrokeWidth(SkScalar width)
Definition SkPaint.cpp:159
SkPathBuilder & arcTo(const SkRect &oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg, bool forceMoveTo)
float SkScalar
Definition extension.cpp:12
struct MyStruct s
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
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646