xref: /aosp_15_r20/external/skia/src/core/SkStrokerPriv.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2006 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 
9 #ifndef SkStrokerPriv_DEFINED
10 #define SkStrokerPriv_DEFINED
11 
12 #include "include/core/SkPaint.h"
13 #include "include/core/SkPoint.h"
14 #include "include/core/SkScalar.h"
15 
16 class SkPath;
17 
18 #define CWX(x, y)   (-y)
19 #define CWY(x, y)   (x)
20 #define CCWX(x, y)  (y)
21 #define CCWY(x, y)  (-x)
22 
23 #define CUBIC_ARC_FACTOR    ((SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3)
24 
25 // this enables a global which is not thread-safe; doing so triggers a TSAN error in Chrome tests.
26 #define QUAD_STROKE_APPROX_EXTENDED_DEBUGGING 0  // set to 1 to enable debugging in StrokerTest.cpp
27 
28 class SkStrokerPriv {
29 public:
30     typedef void (*CapProc)(SkPath* path,
31                             const SkPoint& pivot,
32                             const SkVector& normal,
33                             const SkPoint& stop,
34                             SkPath* otherPath);
35 
36     typedef void (*JoinProc)(SkPath* outer, SkPath* inner,
37                              const SkVector& beforeUnitNormal,
38                              const SkPoint& pivot,
39                              const SkVector& afterUnitNormal,
40                              SkScalar radius, SkScalar invMiterLimit,
41                              bool prevIsLine, bool currIsLine);
42 
43     static CapProc  CapFactory(SkPaint::Cap);
44     static JoinProc JoinFactory(SkPaint::Join);
45 };
46 
47 #endif
48