1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2014 Google Inc. 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci#include "include/core/SkBitmap.h" 9cb93a386Sopenharmony_ci#include "tests/PathOpsExtendedTest.h" 10cb93a386Sopenharmony_ci#include "tests/PathOpsTestCommon.h" 11cb93a386Sopenharmony_ci#include "tests/Test.h" 12cb93a386Sopenharmony_ci 13cb93a386Sopenharmony_ciDEF_TEST(PathOpsBuilder, reporter) { 14cb93a386Sopenharmony_ci SkOpBuilder builder; 15cb93a386Sopenharmony_ci SkPath result; 16cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 17cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isEmpty()); 18cb93a386Sopenharmony_ci 19cb93a386Sopenharmony_ci builder.add(result, kDifference_SkPathOp); 20cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 21cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isEmpty()); 22cb93a386Sopenharmony_ci 23cb93a386Sopenharmony_ci builder.add(result, kUnion_SkPathOp); 24cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 25cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isEmpty()); 26cb93a386Sopenharmony_ci 27cb93a386Sopenharmony_ci SkPath rectPath; 28cb93a386Sopenharmony_ci rectPath.setFillType(SkPathFillType::kEvenOdd); 29cb93a386Sopenharmony_ci rectPath.addRect(0, 1, 2, 3, SkPathDirection::kCW); 30cb93a386Sopenharmony_ci builder.add(rectPath, kUnion_SkPathOp); 31cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 32cb93a386Sopenharmony_ci bool closed; 33cb93a386Sopenharmony_ci SkPathDirection dir; 34cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); 35cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, closed); 36cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, dir == SkPathDirection::kCCW); 37cb93a386Sopenharmony_ci int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result); 38cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, pixelDiff == 0); 39cb93a386Sopenharmony_ci 40cb93a386Sopenharmony_ci rectPath.reset(); 41cb93a386Sopenharmony_ci rectPath.setFillType(SkPathFillType::kEvenOdd); 42cb93a386Sopenharmony_ci rectPath.addRect(0, 1, 2, 3, SkPathDirection::kCCW); 43cb93a386Sopenharmony_ci builder.add(rectPath, kUnion_SkPathOp); 44cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 45cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); 46cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, closed); 47cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, dir == SkPathDirection::kCCW); 48cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, rectPath == result); 49cb93a386Sopenharmony_ci 50cb93a386Sopenharmony_ci builder.add(rectPath, kDifference_SkPathOp); 51cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 52cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isEmpty()); 53cb93a386Sopenharmony_ci 54cb93a386Sopenharmony_ci SkPath rect2, rect3; 55cb93a386Sopenharmony_ci rect2.addRect(2, 1, 4, 3, SkPathDirection::kCW); 56cb93a386Sopenharmony_ci rect3.addRect(4, 1, 5, 3, SkPathDirection::kCCW); 57cb93a386Sopenharmony_ci builder.add(rectPath, kUnion_SkPathOp); 58cb93a386Sopenharmony_ci builder.add(rect2, kUnion_SkPathOp); 59cb93a386Sopenharmony_ci builder.add(rect3, kUnion_SkPathOp); 60cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 61cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); 62cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, closed); 63cb93a386Sopenharmony_ci SkRect expected; 64cb93a386Sopenharmony_ci expected.setLTRB(0, 1, 5, 3); 65cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, result.getBounds() == expected); 66cb93a386Sopenharmony_ci 67cb93a386Sopenharmony_ci SkPath circle1, circle2, circle3; 68cb93a386Sopenharmony_ci circle1.addCircle(5, 6, 4, SkPathDirection::kCW); 69cb93a386Sopenharmony_ci circle2.addCircle(7, 4, 8, SkPathDirection::kCCW); 70cb93a386Sopenharmony_ci circle3.addCircle(6, 5, 6, SkPathDirection::kCW); 71cb93a386Sopenharmony_ci SkPath opCompare; 72cb93a386Sopenharmony_ci Op(circle1, circle2, kUnion_SkPathOp, &opCompare); 73cb93a386Sopenharmony_ci Op(opCompare, circle3, kDifference_SkPathOp, &opCompare); 74cb93a386Sopenharmony_ci builder.add(circle1, kUnion_SkPathOp); 75cb93a386Sopenharmony_ci builder.add(circle2, kUnion_SkPathOp); 76cb93a386Sopenharmony_ci builder.add(circle3, kDifference_SkPathOp); 77cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, builder.resolve(&result)); 78cb93a386Sopenharmony_ci pixelDiff = comparePaths(reporter, __FUNCTION__, opCompare, result); 79cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, pixelDiff == 0); 80cb93a386Sopenharmony_ci} 81cb93a386Sopenharmony_ci 82cb93a386Sopenharmony_ciDEF_TEST(BuilderIssue3838, reporter) { 83cb93a386Sopenharmony_ci SkPath path; 84cb93a386Sopenharmony_ci path.moveTo(200, 170); 85cb93a386Sopenharmony_ci path.lineTo(220, 170); 86cb93a386Sopenharmony_ci path.lineTo(220, 230); 87cb93a386Sopenharmony_ci path.lineTo(240, 230); 88cb93a386Sopenharmony_ci path.lineTo(240, 210); 89cb93a386Sopenharmony_ci path.lineTo(180, 210); 90cb93a386Sopenharmony_ci path.lineTo(180, 190); 91cb93a386Sopenharmony_ci path.lineTo(260, 190); 92cb93a386Sopenharmony_ci path.lineTo(260, 250); 93cb93a386Sopenharmony_ci path.lineTo(200, 250); 94cb93a386Sopenharmony_ci path.lineTo(200, 170); 95cb93a386Sopenharmony_ci path.close(); 96cb93a386Sopenharmony_ci SkPath path2; 97cb93a386Sopenharmony_ci SkOpBuilder builder; 98cb93a386Sopenharmony_ci builder.add(path, kUnion_SkPathOp); 99cb93a386Sopenharmony_ci builder.resolve(&path2); 100cb93a386Sopenharmony_ci int pixelDiff = comparePaths(reporter, __FUNCTION__, path, path2); 101cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, pixelDiff == 0); 102cb93a386Sopenharmony_ci} 103cb93a386Sopenharmony_ci 104cb93a386Sopenharmony_ciDEF_TEST(BuilderIssue3838_2, reporter) { 105cb93a386Sopenharmony_ci SkPath path; 106cb93a386Sopenharmony_ci path.addCircle(100, 100, 50); 107cb93a386Sopenharmony_ci 108cb93a386Sopenharmony_ci SkOpBuilder builder; 109cb93a386Sopenharmony_ci builder.add(path, kUnion_SkPathOp); 110cb93a386Sopenharmony_ci builder.add(path, kUnion_SkPathOp); 111cb93a386Sopenharmony_ci 112cb93a386Sopenharmony_ci SkPath result; 113cb93a386Sopenharmony_ci builder.resolve(&result); 114cb93a386Sopenharmony_ci int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result); 115cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, pixelDiff == 0); 116cb93a386Sopenharmony_ci} 117cb93a386Sopenharmony_ci 118cb93a386Sopenharmony_ciDEF_TEST(BuilderIssue3838_3, reporter) { 119cb93a386Sopenharmony_ci SkPath path; 120cb93a386Sopenharmony_ci path.moveTo(40, 10); 121cb93a386Sopenharmony_ci path.lineTo(60, 10); 122cb93a386Sopenharmony_ci path.lineTo(60, 30); 123cb93a386Sopenharmony_ci path.lineTo(40, 30); 124cb93a386Sopenharmony_ci path.lineTo(40, 10); 125cb93a386Sopenharmony_ci path.moveTo(41, 11); 126cb93a386Sopenharmony_ci path.lineTo(41, 29); 127cb93a386Sopenharmony_ci path.lineTo(59, 29); 128cb93a386Sopenharmony_ci path.lineTo(59, 11); 129cb93a386Sopenharmony_ci path.lineTo(41, 11); 130cb93a386Sopenharmony_ci 131cb93a386Sopenharmony_ci SkOpBuilder builder; 132cb93a386Sopenharmony_ci builder.add(path, kUnion_SkPathOp); 133cb93a386Sopenharmony_ci SkPath result; 134cb93a386Sopenharmony_ci builder.resolve(&result); 135cb93a386Sopenharmony_ci int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result); 136cb93a386Sopenharmony_ci REPORTER_ASSERT(reporter, pixelDiff == 0); 137cb93a386Sopenharmony_ci} 138cb93a386Sopenharmony_ci 139cb93a386Sopenharmony_ciDEF_TEST(BuilderIssue502792_2, reporter) { 140cb93a386Sopenharmony_ci SkPath path, pathB; 141cb93a386Sopenharmony_ci path.setFillType(SkPathFillType::kWinding); 142cb93a386Sopenharmony_ci path.addRect(0, 0, 1, 1, SkPathDirection::kCW); 143cb93a386Sopenharmony_ci path.addRect(2, 2, 3, 3, SkPathDirection::kCW); 144cb93a386Sopenharmony_ci pathB.setFillType(SkPathFillType::kEvenOdd); 145cb93a386Sopenharmony_ci pathB.addRect(3, 3, 4, 4, SkPathDirection::kCW); 146cb93a386Sopenharmony_ci pathB.addRect(3, 3, 4, 4, SkPathDirection::kCW); 147cb93a386Sopenharmony_ci SkOpBuilder builder; 148cb93a386Sopenharmony_ci builder.add(path, kUnion_SkPathOp); 149cb93a386Sopenharmony_ci builder.add(pathB, kDifference_SkPathOp); 150cb93a386Sopenharmony_ci SkPath result; 151cb93a386Sopenharmony_ci builder.resolve(&result); 152cb93a386Sopenharmony_ci} 153cb93a386Sopenharmony_ci 154cb93a386Sopenharmony_ciDEF_TEST(Fuzz846, reporter) { 155cb93a386Sopenharmony_ci/* 156cb93a386Sopenharmony_ci<clipPath id="clip-circle"> 157cb93a386Sopenharmony_ci <circle id="circle" cx="60" cy="60" r="50" /> 158cb93a386Sopenharmony_ci</clipPath> 159cb93a386Sopenharmony_ci<clipPath id="clip-rect"> 160cb93a386Sopenharmony_ci <clipPath id="clip-rect"> 161cb93a386Sopenharmony_ci <clipPath id="clip-rect"> 162cb93a386Sopenharmony_ci <clipPath id="clip-rect"> 163cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="60" /> 164cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="60" /> 165cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 166cb93a386Sopenharmony_ci <rect x="10" y="30" width="32668" /> 167cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="18446744073709551615" /> 168cb93a386Sopenharmony_ci <rect x="10" y="255" width="100" height="60" /> 169cb93a386Sopenharmony_ci <rect width="100" height="60" /> 170cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 171cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="4294967236" /> 172cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 173cb93a386Sopenharmony_ci </clipPath> 174cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="60" /> 175cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="0.18093252719929986369568203" /> 176cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 177cb93a386Sopenharmony_ci <rect x="10" y="30" width="32668" height="60" /> 178cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="18446744073709551615" /> 179cb93a386Sopenharmony_ci <rect x="10" y="255" width="100" height="60" /> 180cb93a386Sopenharmony_ci <rect x="2147483649" y="30" width="100" height="60" /> 181cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 182cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 183cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 184cb93a386Sopenharmony_ci </clipPath> 185cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="60" /> 186cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="60" /> 187cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 188cb93a386Sopenharmony_ci <rect x="10" y="30" width="32668" height="60" /> 189cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="18446744073709551615" /> 190cb93a386Sopenharmony_ci <rect x="10" y="255" width="100" height="60" /> 191cb93a386Sopenharmony_ci <rect x="2147483649" y="30" width="100" height="60" /> 192cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 193cb93a386Sopenharmony_ci <rect x="10" y="2879753595" width="100" height="60" /> 194cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 195cb93a386Sopenharmony_ci </clipPath> 196cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 197cb93a386Sopenharmony_ci <rect x="10" y="30" width="0" height="60" /> 198cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 199cb93a386Sopenharmony_ci <rect x="10" y="30" width="32668" height="60" /> 200cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="18446744073709551615" /> 201cb93a386Sopenharmony_ci <rect x="10" y="255" width="100" height="60" /> 202cb93a386Sopenharmony_ci <rect x="2147483649" y="30" width="100" height="60" /> 203cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 204cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="4294967236" /> 205cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="4294967236" /> 206cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="4294967236" /> 207cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="4294967236" /> 208cb93a386Sopenharmony_ci <rect x="10" y="30" width="100" height="60" /> 209cb93a386Sopenharmony_ci <rect x="757798030" y="30" width="100" height="60" /> 210cb93a386Sopenharmony_ci*/ 211cb93a386Sopenharmony_ci SkPath clipCircle, clipRect; 212cb93a386Sopenharmony_ci SkPath inner; 213cb93a386Sopenharmony_ci clipCircle.addCircle(60, 60, 50); // <circle id="circle" cx="60" cy="60" r="50" /> 214cb93a386Sopenharmony_ci 215cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 216cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 217cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 218cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+32668, 30+0); // <rect x="10" y="30" width="32668" /> 219cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 220cb93a386Sopenharmony_ci inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 221cb93a386Sopenharmony_ci inner.addRect(0, 0, 0+100, 0+60); // <rect width="100" height="60" /> 222cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 223cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 224cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 225cb93a386Sopenharmony_ci clipRect.addPath(inner); 226cb93a386Sopenharmony_ci inner.reset(); 227cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 228cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+0.18093252719929986369568203f); // <rect x="10" y="30" width="0" height="0.18093252719929986369568203" /> 229cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 230cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> 231cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 232cb93a386Sopenharmony_ci inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 233cb93a386Sopenharmony_ci inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> 234cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 235cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 236cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 237cb93a386Sopenharmony_ci clipRect.addPath(inner); 238cb93a386Sopenharmony_ci inner.reset(); 239cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 240cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 241cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 242cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> 243cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 244cb93a386Sopenharmony_ci inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 245cb93a386Sopenharmony_ci inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> 246cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 247cb93a386Sopenharmony_ci inner.addRect(10, 2879753595.f, 10+100, 30+2879753595.f); // <rect x="10" y="2879753595" width="100" height="60" /> 248cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 249cb93a386Sopenharmony_ci clipRect.addPath(inner); 250cb93a386Sopenharmony_ci inner.reset(); 251cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 252cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 253cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 254cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> 255cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 256cb93a386Sopenharmony_ci inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 257cb93a386Sopenharmony_ci inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> 258cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 259cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 260cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 261cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 262cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 263cb93a386Sopenharmony_ci inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 264cb93a386Sopenharmony_ci inner.addRect(757798030.f, 30, 757798030.f+100, 30+60); // <rect x="757798030" y="30" width="100" height="60" /> 265cb93a386Sopenharmony_ci clipRect.addPath(inner); 266cb93a386Sopenharmony_ci 267cb93a386Sopenharmony_ci SkOpBuilder builder; 268cb93a386Sopenharmony_ci builder.add(clipCircle, kUnion_SkPathOp); 269cb93a386Sopenharmony_ci builder.add(clipRect, kDifference_SkPathOp); 270cb93a386Sopenharmony_ci SkPath result; 271cb93a386Sopenharmony_ci builder.resolve(&result); 272cb93a386Sopenharmony_ci} 273cb93a386Sopenharmony_ci 274cb93a386Sopenharmony_ciDEF_TEST(Issue569540, reporter) { 275cb93a386Sopenharmony_ci SkPath path1; 276cb93a386Sopenharmony_ci path1.moveTo(5, -225); 277cb93a386Sopenharmony_ci path1.lineTo(-225, 7425); 278cb93a386Sopenharmony_ci path1.lineTo(7425, 7425); 279cb93a386Sopenharmony_ci path1.lineTo(7425, -225); 280cb93a386Sopenharmony_ci path1.lineTo(-225, -225); 281cb93a386Sopenharmony_ci path1.lineTo(5, -225); 282cb93a386Sopenharmony_ci path1.close(); 283cb93a386Sopenharmony_ci 284cb93a386Sopenharmony_ci SkPath path2; 285cb93a386Sopenharmony_ci path2.moveTo(5940, 2790); 286cb93a386Sopenharmony_ci path2.lineTo(5940, 2160); 287cb93a386Sopenharmony_ci path2.lineTo(5970, 1980); 288cb93a386Sopenharmony_ci path2.lineTo(5688, 773669888); 289cb93a386Sopenharmony_ci path2.lineTo(5688, 2160); 290cb93a386Sopenharmony_ci path2.lineTo(5688, 2430); 291cb93a386Sopenharmony_ci path2.lineTo(5400, 4590); 292cb93a386Sopenharmony_ci path2.lineTo(5220, 4590); 293cb93a386Sopenharmony_ci path2.lineTo(5220, 4920); 294cb93a386Sopenharmony_ci path2.cubicTo(5182.22900390625f, 4948.328125f, 5160, 4992.78662109375f, 5160, 5040.00048828125f); 295cb93a386Sopenharmony_ci path2.lineTo(5940, 2790); 296cb93a386Sopenharmony_ci path2.close(); 297cb93a386Sopenharmony_ci 298cb93a386Sopenharmony_ci SkOpBuilder builder; 299cb93a386Sopenharmony_ci builder.add(path1, kUnion_SkPathOp); 300cb93a386Sopenharmony_ci builder.add(path2, kUnion_SkPathOp); 301cb93a386Sopenharmony_ci SkPath result; 302cb93a386Sopenharmony_ci builder.resolve(&result); 303cb93a386Sopenharmony_ci} 304cb93a386Sopenharmony_ci 305cb93a386Sopenharmony_ciDEF_TEST(SkOpBuilderFuzz665, reporter) { 306cb93a386Sopenharmony_ci SkPath path; 307cb93a386Sopenharmony_ci path.setFillType(SkPathFillType::kEvenOdd); 308cb93a386Sopenharmony_cipath.moveTo(SkBits2Float(0xcc4264a7), SkBits2Float(0x4bb12e50)); // -5.0959e+07f, 2.32235e+07f 309cb93a386Sopenharmony_cipath.lineTo(SkBits2Float(0xcc4264b0), SkBits2Float(0x4bb12e48)); // -5.0959e+07f, 2.32234e+07f 310cb93a386Sopenharmony_cipath.lineTo(SkBits2Float(0xcc4264a7), SkBits2Float(0x4bb12e50)); // -5.0959e+07f, 2.32235e+07f 311cb93a386Sopenharmony_cipath.close(); 312cb93a386Sopenharmony_ci SkPath path1(path); 313cb93a386Sopenharmony_ci path.reset(); 314cb93a386Sopenharmony_ci path.setFillType(SkPathFillType::kWinding); 315cb93a386Sopenharmony_cipath.moveTo(SkBits2Float(0x43213333), SkBits2Float(0x43080000)); // 161.2f, 136 316cb93a386Sopenharmony_cipath.lineTo(SkBits2Float(0x43038000), SkBits2Float(0x43080000)); // 131.5f, 136 317cb93a386Sopenharmony_cipath.cubicTo(SkBits2Float(0x43038000), SkBits2Float(0x42f00000), SkBits2Float(0x42f16666), SkBits2Float(0x42d53333), SkBits2Float(0x42d3cccd), SkBits2Float(0x42cd6666)); // 131.5f, 120, 120.7f, 106.6f, 105.9f, 102.7f 318cb93a386Sopenharmony_cipath.lineTo(SkBits2Float(0x42e33333), SkBits2Float(0x42940000)); // 113.6f, 74 319cb93a386Sopenharmony_ci SkPath path2(path); 320cb93a386Sopenharmony_ci SkOpBuilder builder; 321cb93a386Sopenharmony_ci builder.add(path1, kUnion_SkPathOp); 322cb93a386Sopenharmony_ci builder.add(path2, kUnion_SkPathOp); 323cb93a386Sopenharmony_ci SkPath result; 324cb93a386Sopenharmony_ci builder.resolve(&result); 325cb93a386Sopenharmony_ci} 326cb93a386Sopenharmony_ci 327cb93a386Sopenharmony_ciDEF_TEST(SkOpBuilder618991, reporter) { 328cb93a386Sopenharmony_ci SkPath path0; 329cb93a386Sopenharmony_ci path0.moveTo(140, 40); 330cb93a386Sopenharmony_ci path0.lineTo(200, 210); 331cb93a386Sopenharmony_ci path0.lineTo(40, 100); 332cb93a386Sopenharmony_ci path0.lineTo(2.22223e+07f, 2.22222e+14f); 333cb93a386Sopenharmony_ci path0.lineTo(2.22223e+07f, 2.22222e+14f); 334cb93a386Sopenharmony_ci 335cb93a386Sopenharmony_ci SkPath path1; 336cb93a386Sopenharmony_ci path1.moveTo(160, 60); 337cb93a386Sopenharmony_ci path1.lineTo(220, 230); 338cb93a386Sopenharmony_ci path1.lineTo(60, 120); 339cb93a386Sopenharmony_ci path1.lineTo(2.22223e+07f, 2.22222e+14f); 340cb93a386Sopenharmony_ci path1.lineTo(2.22223e+07f, 2.22222e+14f); 341cb93a386Sopenharmony_ci 342cb93a386Sopenharmony_ci SkOpBuilder builder; 343cb93a386Sopenharmony_ci builder.add(path0, SkPathOp::kUnion_SkPathOp); 344cb93a386Sopenharmony_ci builder.add(path1, SkPathOp::kUnion_SkPathOp); 345cb93a386Sopenharmony_ci builder.resolve(&path0); 346cb93a386Sopenharmony_ci} 347cb93a386Sopenharmony_ci 348cb93a386Sopenharmony_ciDEF_TEST(SkOpBuilderKFuzz1, reporter) { 349cb93a386Sopenharmony_ci SkPath path; 350cb93a386Sopenharmony_cipath.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 351cb93a386Sopenharmony_cipath.lineTo(SkBits2Float(0x39008001), SkBits2Float(0xd31fbc1d)); // 0.000122547f, -6.86056e+11f 352cb93a386Sopenharmony_cipath.conicTo(SkBits2Float(0x246a205a), SkBits2Float(0x0080d3fb), SkBits2Float(0xce000001), SkBits2Float(0x04d31fbc), SkBits2Float(0x57a82c00)); // 5.07681e-17f, 1.1831e-38f, -5.36871e+08f, 4.9635e-36f, 3.69814e+14f 353cb93a386Sopenharmony_ci SkPath path0(path); 354cb93a386Sopenharmony_ci path.reset(); 355cb93a386Sopenharmony_cipath.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 356cb93a386Sopenharmony_cipath.cubicTo(SkBits2Float(0x80d3f924), SkBits2Float(0xcecece4f), SkBits2Float(0xcececece), SkBits2Float(0xcececece), SkBits2Float(0x9a9a9ace), SkBits2Float(0x9a9a9a9a)); // -1.94667e-38f, -1.73481e+09f, -1.73483e+09f, -1.73483e+09f, -6.3943e-23f, -6.39427e-23f 357cb93a386Sopenharmony_cipath.moveTo(SkBits2Float(0x9a9a019a), SkBits2Float(0xa59a9a9a)); // -6.36955e-23f, -2.68195e-16f 358cb93a386Sopenharmony_ci SkPath path1(path); 359cb93a386Sopenharmony_ciSkOpBuilder builder; 360cb93a386Sopenharmony_ci builder.add(path0, SkPathOp::kUnion_SkPathOp); 361cb93a386Sopenharmony_ci builder.add(path1, SkPathOp::kUnion_SkPathOp); 362cb93a386Sopenharmony_ci builder.resolve(&path); 363cb93a386Sopenharmony_ci} 364