Flutter Engine
The Flutter Engine
Classes | Namespaces | Functions | Variables
convex_all_line_paths.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "src/core/SkPathPriv.h"
#include <memory>

Go to the source code of this file.

Classes

class  skiagm::ConvexLineOnlyPathsGM
 

Namespaces

namespace  ConvexLineOnlyData
 
namespace  skiagm
 

Functions

static void create_ngon (int n, SkPoint *pts, SkScalar width, SkScalar height)
 

Variables

const SkPoint ConvexLineOnlyData::gPoints0 []
 
const SkPoint ConvexLineOnlyData::gPoints1 []
 
const SkPoint ConvexLineOnlyData::gPoints2 []
 
const SkPoint ConvexLineOnlyData::gPoints3 []
 
const SkPoint ConvexLineOnlyData::gPoints4 []
 
const SkPoint ConvexLineOnlyData::gPoints5 []
 
const SkPoint ConvexLineOnlyData::gPoints6 []
 
const SkPoint ConvexLineOnlyData::gPoints7 []
 
const SkPoint ConvexLineOnlyData::gPoints8 []
 
const SkPoint ConvexLineOnlyData::gPoints9 []
 
const SkPoint ConvexLineOnlyData::gPoints10 []
 
const SkPointConvexLineOnlyData::gPoints []
 
const size_t ConvexLineOnlyData::gSizes []
 

Function Documentation

◆ create_ngon()

static void create_ngon ( int  n,
SkPoint pts,
SkScalar  width,
SkScalar  height 
)
static

Definition at line 24 of file convex_all_line_paths.cpp.

24 {
25 float angleStep = 360.0f / n, angle = 0.0f;
26 if ((n % 2) == 1) {
27 angle = angleStep/2.0f;
28 }
29
30 for (int i = 0; i < n; ++i) {
31 pts[i].fX = -SkScalarSin(SkDegreesToRadians(angle)) * width;
32 pts[i].fY = SkScalarCos(SkDegreesToRadians(angle)) * height;
33 angle += angleStep;
34 }
35}
#define SkDegreesToRadians(degrees)
Definition: SkScalar.h:77
#define SkScalarSin(radians)
Definition: SkScalar.h:45
#define SkScalarCos(radians)
Definition: SkScalar.h:46
int32_t height
int32_t width
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165