Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
pathopsinverse.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/pathops/SkPathOps.h"
#include "tools/ToolUtils.h"
#include "include/utils/SkParsePath.h"

Go to the source code of this file.

Classes

class  skiagm::PathOpsInverseGM
 

Namespaces

namespace  skiagm
 

Functions

 DEF_SIMPLE_GM (pathops_skbug_10155, canvas, 256, 256)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( pathops_skbug_10155  ,
canvas  ,
256  ,
256   
)

Definition at line 121 of file pathopsinverse.cpp.

121 {
122 const char* svgStr[] = {
123 "M474.889 27.0952C474.889 27.1002 474.888 27.1018 474.889 27.1004L479.872 27.5019C479.883 27.3656 479.889 27.2299 479.889 27.0952L474.889 27.0952L474.889 27.0952Z",
124 "M474.94 26.9405C474.93 26.9482 474.917 26.9576 474.901 26.9683L477.689 31.1186C477.789 31.0512 477.888 30.9804 477.985 30.9059L474.94 26.9405L474.94 26.9405Z"
125 };
126
127 SkPath path[2], resultPath;
129
130 for (int i = 0; i < 2; i++)
131 {
132 SkParsePath::FromSVGString(svgStr[i], &path[i]);
133 builder.add(path[i], kUnion_SkPathOp);
134 }
135
136 builder.resolve(&resultPath);
137
138 auto r = path[0].getBounds();
139 canvas->translate(30, 30);
140 canvas->scale(200 / r.width(), 200 / r.width());
141 canvas->translate(-r.fLeft, -r.fTop);
142
144 paint.setColor(SK_ColorRED);
145 paint.setAntiAlias(true);
147 paint.setStrokeWidth(0);
148
149 canvas->drawPath(path[0], paint);
150 canvas->drawPath(path[1], paint);
151
152 // The blue draw should (nearly) overdraw all of the red (except where the two paths intersect)
153 paint.setColor(SK_ColorBLUE);
154 canvas->drawPath(resultPath, paint);
155}
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition SkPathOps.h:25
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
static bool FromSVGString(const char str[], SkPath *)
const Paint & paint
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