8#ifndef skgpu_tessellate_CullTest_DEFINED
9#define skgpu_tessellate_CullTest_DEFINED
31 this->
set(devCullBounds,
m);
37 fMatX = {
m.getScaleX(),
m.getSkewY(), -
m.getScaleX(), -
m.getSkewY()};
38 fMatY = {
m.getSkewX(),
m.getScaleY(), -
m.getSkewX(), -
m.getScaleY()};
42 fCullBounds = {devCullBounds.
fLeft -
m.getTranslateX(),
43 devCullBounds.
fTop -
m.getTranslateY(),
44 m.getTranslateX() - devCullBounds.
fRight,
45 m.getTranslateY() - devCullBounds.
fBottom};
51 auto devPt = fMatX*
p.fX + fMatY*
p.fY;
53 return all(fCullBounds < devPt);
59 auto val0 = fMatY *
p[0].fY;
60 auto val1 = fMatY *
p[1].fY;
61 auto val2 = fMatY *
p[2].fY;
62 val0 = fMatX*
p[0].fX + val0;
63 val1 = fMatX*
p[1].fX + val1;
64 val2 = fMatX*
p[2].fX + val2;
68 val0 =
max(val0, val1);
69 val0 =
max(val0, val2);
74 return all(fCullBounds < val0);
80 auto val0 = fMatY *
p[0].fY;
81 auto val1 = fMatY *
p[1].fY;
82 auto val2 = fMatY *
p[2].fY;
83 auto val3 = fMatY *
p[3].fY;
84 val0 = fMatX*
p[0].fX + val0;
85 val1 = fMatX*
p[1].fX + val1;
86 val2 = fMatX*
p[2].fX + val2;
87 val3 = fMatX*
p[3].fX + val3;
91 val0 =
max(val0, val1);
92 val2 =
max(val2, val3);
93 val0 =
max(val0, val2);
98 return all(fCullBounds < val0);
CullTest(const SkRect &devCullBounds, const SkMatrix &m)
bool isVisible(SkPoint p) const
bool areVisible3(const SkPoint p[3]) const
bool areVisible4(const SkPoint p[4]) const
void set(const SkRect &devCullBounds, const SkMatrix &m)
static float max(float r, float g, float b)
SIT bool all(const Vec< 1, T > &x)
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
SkScalar fTop
smaller y-axis bounds