21#if defined(GR_TEST_UTILS)
24 bool includeNonPerspective,
25 bool includePerspective) {
27 static const int kPerspectiveCount = 1;
44 uint32_t
count =
static_cast<uint32_t
>(std::size(gMatrices));
45 if (includeNonPerspective && includePerspective) {
47 }
else if (!includeNonPerspective) {
50 SkASSERT(includeNonPerspective && !includePerspective);
77 for (
size_t i = 0; i < std::size(gMatrices); i++) {
78 SkASSERT(gMatrices[i].preservesRightAngles());
103 for (
size_t i = 0; i < std::size(gMatrices); i++) {
104 SkASSERT(gMatrices[i].rectStaysRect());
119 wrapModes[0] = kWrapModes[random->
nextULessThan(std::size(kWrapModes))];
120 wrapModes[1] = kWrapModes[random->
nextULessThan(std::size(kWrapModes))];
134 return gRects[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gRects)))];
146 return gRects[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gRects)))];
156 gRRect[0].
setRectXY(rectangle, 1.f, 1.f);
158 gRRect[1].
setRectXY(rectangle, 2.0f, 1.0f);
160 for (
size_t i = 0; i < std::size(gRRect); i++) {
164 return gRRect[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gRRect)))];
178 .
quadTo(10.f, 10.f, 20.f, 20.f)
182 .
conicTo(10.f, 10.f, 20.f, 20.f, 1.f)
186 .
cubicTo(10.f, 10.f, 20.f, 20.f, 30.f, 30.f)
191 .
quadTo(10.f, 10.f, 20.f, 20.f)
192 .
conicTo(10.f, 10.f, 20.f, 20.f, 1.f)
193 .
cubicTo(10.f, 10.f, 20.f, 20.f, 30.f, 30.f)
212 return gPath[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gPath)))];
225 {-1.5f, 50.0f}},
false);
231 {-0.025f, 0.025f}},
false);
239 {-50.0f, 31.0f}},
false);
241 for (
size_t i = 0; i < std::size(gPath); i++) {
246 return gPath[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gPath)))];
250 bool strokeAndFill = random->
nextBool();
264 randomize_stroke_rec(&rec, random);
272 randomize_stroke_rec(&stroke, random);
276 std::unique_ptr<SkScalar[]> intervals(
new SkScalar[cnt]);
278 for (
int i = 0; i < cnt; i++) {
284 pe = TestDashPathEffect::Make(intervals.get(), cnt, phase);
286 *style =
GrStyle(stroke, std::move(pe));
291 fIntervals.reset(
count);
292 memcpy(fIntervals.get(), intervals,
count *
sizeof(
SkScalar));
294 &fInitialDashIndex, &fIntervalLength, &fPhase);
300 fInitialDashLength, fInitialDashIndex, fIntervalLength,
306 if (
info->fCount >= fCount &&
info->fIntervals) {
307 memcpy(
info->fIntervals, fIntervals.get(), fCount *
sizeof(
SkScalar));
310 info->fPhase = fPhase;
312 return kDash_DashType;
321 gColorSpaces[0] =
nullptr;
326 return gColorSpaces[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gColorSpaces)))];
338 gXforms[0] =
nullptr;
344 return gXforms[random->
nextULessThan(
static_cast<uint32_t
>(std::size(gXforms)))];
347TestAsFPArgs::TestAsFPArgs(GrProcessorTestData*
d)
352TestAsFPArgs::~TestAsFPArgs() {}
361 kLast_ColorMode = kRandom_ColorMode
364 ColorMode colorMode = ColorMode(random->
nextULessThan(kLast_ColorMode + 1));
367 case kAllOnes_ColorMode:
370 case kAllZeros_ColorMode:
373 case kAlphaOne_ColorMode:
379 case kRandom_ColorMode: {
391uint8_t RandomCoverage(
SkRandom* random) {
394 kAllOnes_CoverageMode,
395 kRandom_CoverageMode,
396 kLast_CoverageMode = kRandom_CoverageMode
402 case kZero_CoverageMode:
405 case kAllOnes_CoverageMode:
408 case kRandom_CoverageMode:
static const int strokeWidth
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a)
static void test_matrix(skiatest::Reporter *reporter)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SK_INIT_TO_AVOID_WARNING
#define SkDoubleToScalar(x)
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkColorSpace > makeColorSpin() const
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
static constexpr int kMPersp1
input y perspective factor
SkMatrix & set(int index, SkScalar value)
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
static constexpr int kMPersp0
input x perspective factor
static constexpr int kCapCount
static constexpr int kJoinCount
SkPathBuilder & conicTo(SkPoint pt1, SkPoint pt2, SkScalar w)
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & cubicTo(SkPoint pt1, SkPoint pt2, SkPoint pt3)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & quadTo(SkPoint pt1, SkPoint pt2)
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
uint32_t nextULessThan(uint32_t count)
uint32_t nextRangeU(uint32_t min, uint32_t max)
static SkRect MakeLargest()
void setStrokeStyle(SkScalar width, bool strokeAndFill=false)
void setStrokeParams(SkPaint::Cap cap, SkPaint::Join join, SkScalar miterLimit)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
bool InternalFilter(SkPath *dst, const SkPath &src, SkStrokeRec *rec, const SkRect *cullRect, const SkScalar aIntervals[], int32_t count, SkScalar initialDashLength, int32_t initialDashIndex, SkScalar intervalLength, SkScalar startPhase, StrokeRecApplication=StrokeRecApplication::kAllow)
void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count, SkScalar *initialDashLength, int32_t *initialDashIndex, SkScalar *intervalLength, SkScalar *adjustedPhase=nullptr)
const myers::Point & get(const myers::Segment &)
const SkMatrix gMatrices[]
SINT Vec< 2 *N, T > join(const Vec< N, T > &lo, const Vec< N, T > &hi)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static sk_sp< SkColorFilter > spin(sk_sp< SkColorFilter > cf)