Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
clip_sierpinski_region.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRegion.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (clip_sierpinski_region, canvas, 2 *kTrans+kSize, 2 *kTrans+kSize)
 

Variables

static constexpr int kSize = 3*3*3*3*3
 
static constexpr int kTrans = 10
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( clip_sierpinski_region  ,
canvas  ,
2 *kTrans kSize,
2 *kTrans kSize 
)

Definition at line 17 of file clip_sierpinski_region.cpp.

17 {
19 static constexpr int kSteps = 4;
20 int n = 1;
21 SkScalar s = kSize/3.f;
22 for (int i = 0; i < kSteps; ++i, n*=3, s/=3.f) {
23 for (int x = 0; x < n; ++x) {
24 for (int y = 0; y < n; ++y) {
25 region.op(SkIRect::MakeXYWH((3*x + 1)*s, (3*y + 1)*s, s, s), SkRegion::kUnion_Op);
26 }
27 }
28 }
29 // Test that a save layer with an offset works as expected.
31 canvas->saveLayer(SkRect::MakeXYWH(kTrans, kTrans, 1000, 1000), nullptr);
32 // Make sure the clip call ignores the CTM.
33 canvas->rotate(25.f, 50.f, 50.f);
34 canvas->clipRegion(region);
35 SkPaint red;
37 canvas->drawPaint(red);
38 canvas->restore();
39}
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
void setColor(SkColor color)
Definition SkPaint.cpp:119
void translate(int dx, int dy)
Definition SkRegion.h:349
@ kUnion_Op
target unioned with operand
Definition SkRegion.h:369
bool op(const SkIRect &rect, Op op)
Definition SkRegion.h:384
static constexpr int kTrans
static constexpr int kSize
float SkScalar
Definition extension.cpp:12
struct MyStruct s
double y
double x
ClipOpAndAA opAA SkRegion region
Definition SkRecords.h:238
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
Definition SkRect.h:104
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659

Variable Documentation

◆ kSize

constexpr int kSize = 3*3*3*3*3
staticconstexpr

Definition at line 14 of file clip_sierpinski_region.cpp.

◆ kTrans

constexpr int kTrans = 10
staticconstexpr

Definition at line 15 of file clip_sierpinski_region.cpp.