Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
polygonoffset.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/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 "include/private/base/SkTDArray.h"
#include "src/utils/SkPolyUtils.h"
#include "tools/ToolUtils.h"
#include <functional>
#include <memory>

Go to the source code of this file.

Classes

class  skiagm::PolygonOffsetGM
 

Namespaces

namespace  PolygonOffsetData
 
namespace  skiagm
 

Functions

static void create_ngon (int n, SkPoint *pts, SkScalar w, SkScalar h, SkPathDirection dir)
 

Variables

const SkPoint PolygonOffsetData::gPoints0 []
 
const SkPoint PolygonOffsetData::gPoints1 []
 
const SkPoint PolygonOffsetData::gPoints2 []
 
const SkPoint PolygonOffsetData::gPoints3 []
 
const SkPoint PolygonOffsetData::gPoints4 []
 
const SkPoint PolygonOffsetData::gPoints5 []
 
const SkPoint PolygonOffsetData::gPoints6 []
 
const SkPoint PolygonOffsetData::gPoints7 []
 
const SkPoint PolygonOffsetData::gPoints8 []
 
const SkPoint PolygonOffsetData::gPoints9 []
 
const SkPoint PolygonOffsetData::gPoints10 []
 
const SkPoint PolygonOffsetData::gPoints11 []
 
const SkPoint PolygonOffsetData::gPoints12 []
 
const SkScalar PolygonOffsetData::kBottom = 25.f
 
const SkPoint PolygonOffsetData::gPoints13 []
 
const SkPoint PolygonOffsetData::gPoints14 []
 
const SkPoint PolygonOffsetData::gPoints15 []
 
const SkPoint PolygonOffsetData::gPoints16 []
 
const SkPoint PolygonOffsetData::gPoints17 []
 
const SkPoint PolygonOffsetData::gPoints18 []
 
const SkPointPolygonOffsetData::gConvexPoints []
 
const size_t PolygonOffsetData::gConvexSizes []
 
const SkPointPolygonOffsetData::gSimplePoints []
 
const size_t PolygonOffsetData::gSimpleSizes []
 

Function Documentation

◆ create_ngon()

static void create_ngon ( int  n,
SkPoint pts,
SkScalar  w,
SkScalar  h,
SkPathDirection  dir 
)
static

Definition at line 27 of file polygonoffset.cpp.

27 {
28 float angleStep = 360.0f / n, angle = 0.0f;
29 if ((n % 2) == 1) {
30 angle = angleStep/2.0f;
31 }
32 if (SkPathDirection::kCCW == dir) {
33 angle = -angle;
34 angleStep = -angleStep;
35 }
36
37 for (int i = 0; i < n; ++i) {
38 pts[i].fX = -SkScalarSin(SkDegreesToRadians(angle)) * w;
39 pts[i].fY = SkScalarCos(SkDegreesToRadians(angle)) * h;
40 angle += angleStep;
41 }
42}
#define SkDegreesToRadians(degrees)
Definition SkScalar.h:77
#define SkScalarSin(radians)
Definition SkScalar.h:45
#define SkScalarCos(radians)
Definition SkScalar.h:46
SkScalar w
SkScalar h
float fX
x-axis value
float fY
y-axis value