145fa447460f70ec21d22cf4e1531490acfd3c578caryclark/* 245fa447460f70ec21d22cf4e1531490acfd3c578caryclark * Copyright 2014 Google Inc. 345fa447460f70ec21d22cf4e1531490acfd3c578caryclark * 445fa447460f70ec21d22cf4e1531490acfd3c578caryclark * Use of this source code is governed by a BSD-style license that can be 545fa447460f70ec21d22cf4e1531490acfd3c578caryclark * found in the LICENSE file. 645fa447460f70ec21d22cf4e1531490acfd3c578caryclark */ 754359294a7c9dc54802d512a5d891a35c1663392caryclark 854359294a7c9dc54802d512a5d891a35c1663392caryclark#include "PathOpsExtendedTest.h" 945fa447460f70ec21d22cf4e1531490acfd3c578caryclark#include "PathOpsTestCommon.h" 1054359294a7c9dc54802d512a5d891a35c1663392caryclark#include "SkBitmap.h" 1145fa447460f70ec21d22cf4e1531490acfd3c578caryclark#include "Test.h" 1245fa447460f70ec21d22cf4e1531490acfd3c578caryclark 1345fa447460f70ec21d22cf4e1531490acfd3c578caryclarkDEF_TEST(PathOpsBuilder, reporter) { 1445fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkOpBuilder builder; 1545fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkPath result; 1645fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 1745fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, result.isEmpty()); 1845fa447460f70ec21d22cf4e1531490acfd3c578caryclark 1954359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(result, kDifference_SkPathOp); 2045fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 2145fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, result.isEmpty()); 2245fa447460f70ec21d22cf4e1531490acfd3c578caryclark 2354359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(result, kUnion_SkPathOp); 2445fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 2545fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, result.isEmpty()); 2645fa447460f70ec21d22cf4e1531490acfd3c578caryclark 2745fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkPath rectPath; 2854359294a7c9dc54802d512a5d891a35c1663392caryclark rectPath.setFillType(SkPath::kEvenOdd_FillType); 2945fa447460f70ec21d22cf4e1531490acfd3c578caryclark rectPath.addRect(0, 1, 2, 3, SkPath::kCW_Direction); 3054359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(rectPath, kUnion_SkPathOp); 3145fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 3245fa447460f70ec21d22cf4e1531490acfd3c578caryclark bool closed; 3345fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkPath::Direction dir; 3496fcdcc219d2a0d3579719b84b28bede76efba64halcanary REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); 3545fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, closed); 365b5ddd73b4baf22752924bf20d097e96236c36f8caryclark REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); 374e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result); 385b5ddd73b4baf22752924bf20d097e96236c36f8caryclark REPORTER_ASSERT(reporter, pixelDiff == 0); 3945fa447460f70ec21d22cf4e1531490acfd3c578caryclark 4045fa447460f70ec21d22cf4e1531490acfd3c578caryclark rectPath.reset(); 4154359294a7c9dc54802d512a5d891a35c1663392caryclark rectPath.setFillType(SkPath::kEvenOdd_FillType); 4245fa447460f70ec21d22cf4e1531490acfd3c578caryclark rectPath.addRect(0, 1, 2, 3, SkPath::kCCW_Direction); 4354359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(rectPath, kUnion_SkPathOp); 4445fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 4596fcdcc219d2a0d3579719b84b28bede76efba64halcanary REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); 4645fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, closed); 4745fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); 485b5ddd73b4baf22752924bf20d097e96236c36f8caryclark REPORTER_ASSERT(reporter, rectPath == result); 4945fa447460f70ec21d22cf4e1531490acfd3c578caryclark 5054359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(rectPath, kDifference_SkPathOp); 5145fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 5245fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, result.isEmpty()); 5345fa447460f70ec21d22cf4e1531490acfd3c578caryclark 5445fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkPath rect2, rect3; 5545fa447460f70ec21d22cf4e1531490acfd3c578caryclark rect2.addRect(2, 1, 4, 3, SkPath::kCW_Direction); 5645fa447460f70ec21d22cf4e1531490acfd3c578caryclark rect3.addRect(4, 1, 5, 3, SkPath::kCCW_Direction); 5754359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(rectPath, kUnion_SkPathOp); 5854359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(rect2, kUnion_SkPathOp); 5954359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(rect3, kUnion_SkPathOp); 6045fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 6196fcdcc219d2a0d3579719b84b28bede76efba64halcanary REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); 6245fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, closed); 6345fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkRect expected; 6445fa447460f70ec21d22cf4e1531490acfd3c578caryclark expected.set(0, 1, 5, 3); 6545fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, result.getBounds() == expected); 6645fa447460f70ec21d22cf4e1531490acfd3c578caryclark 6745fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkPath circle1, circle2, circle3; 6845fa447460f70ec21d22cf4e1531490acfd3c578caryclark circle1.addCircle(5, 6, 4, SkPath::kCW_Direction); 6945fa447460f70ec21d22cf4e1531490acfd3c578caryclark circle2.addCircle(7, 4, 8, SkPath::kCCW_Direction); 7045fa447460f70ec21d22cf4e1531490acfd3c578caryclark circle3.addCircle(6, 5, 6, SkPath::kCW_Direction); 7145fa447460f70ec21d22cf4e1531490acfd3c578caryclark SkPath opCompare; 7254359294a7c9dc54802d512a5d891a35c1663392caryclark Op(circle1, circle2, kUnion_SkPathOp, &opCompare); 7354359294a7c9dc54802d512a5d891a35c1663392caryclark Op(opCompare, circle3, kDifference_SkPathOp, &opCompare); 7454359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(circle1, kUnion_SkPathOp); 7554359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(circle2, kUnion_SkPathOp); 7654359294a7c9dc54802d512a5d891a35c1663392caryclark builder.add(circle3, kDifference_SkPathOp); 7745fa447460f70ec21d22cf4e1531490acfd3c578caryclark REPORTER_ASSERT(reporter, builder.resolve(&result)); 784e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark pixelDiff = comparePaths(reporter, __FUNCTION__, opCompare, result); 7954359294a7c9dc54802d512a5d891a35c1663392caryclark REPORTER_ASSERT(reporter, pixelDiff == 0); 8045fa447460f70ec21d22cf4e1531490acfd3c578caryclark} 81fba9da78acf8853f0074d0518411bafc827f3771caryclark 825b5ddd73b4baf22752924bf20d097e96236c36f8caryclarkDEF_TEST(BuilderIssue3838, reporter) { 83fba9da78acf8853f0074d0518411bafc827f3771caryclark SkPath path; 84fba9da78acf8853f0074d0518411bafc827f3771caryclark path.moveTo(200, 170); 85fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(220, 170); 86fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(220, 230); 87fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(240, 230); 88fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(240, 210); 89fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(180, 210); 90fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(180, 190); 91fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(260, 190); 92fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(260, 250); 93fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(200, 250); 94fba9da78acf8853f0074d0518411bafc827f3771caryclark path.lineTo(200, 170); 95fba9da78acf8853f0074d0518411bafc827f3771caryclark path.close(); 96fba9da78acf8853f0074d0518411bafc827f3771caryclark SkPath path2; 97fba9da78acf8853f0074d0518411bafc827f3771caryclark SkOpBuilder builder; 98fba9da78acf8853f0074d0518411bafc827f3771caryclark builder.add(path, kUnion_SkPathOp); 99fba9da78acf8853f0074d0518411bafc827f3771caryclark builder.resolve(&path2); 1004e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark int pixelDiff = comparePaths(reporter, __FUNCTION__, path, path2); 101fba9da78acf8853f0074d0518411bafc827f3771caryclark REPORTER_ASSERT(reporter, pixelDiff == 0); 102fba9da78acf8853f0074d0518411bafc827f3771caryclark} 1035b5ddd73b4baf22752924bf20d097e96236c36f8caryclark 1045b5ddd73b4baf22752924bf20d097e96236c36f8caryclarkDEF_TEST(BuilderIssue3838_2, reporter) { 1055b5ddd73b4baf22752924bf20d097e96236c36f8caryclark SkPath path; 1065b5ddd73b4baf22752924bf20d097e96236c36f8caryclark path.addCircle(100, 100, 50); 1075b5ddd73b4baf22752924bf20d097e96236c36f8caryclark 1085b5ddd73b4baf22752924bf20d097e96236c36f8caryclark SkOpBuilder builder; 1095b5ddd73b4baf22752924bf20d097e96236c36f8caryclark builder.add(path, kUnion_SkPathOp); 1105b5ddd73b4baf22752924bf20d097e96236c36f8caryclark builder.add(path, kUnion_SkPathOp); 1115b5ddd73b4baf22752924bf20d097e96236c36f8caryclark 1125b5ddd73b4baf22752924bf20d097e96236c36f8caryclark SkPath result; 1135b5ddd73b4baf22752924bf20d097e96236c36f8caryclark builder.resolve(&result); 1144e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result); 1154e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark REPORTER_ASSERT(reporter, pixelDiff == 0); 1164e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark} 1174e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark 1184e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclarkDEF_TEST(BuilderIssue3838_3, reporter) { 1194e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark SkPath path; 1204e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.moveTo(40, 10); 1214e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(60, 10); 1224e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(60, 30); 1234e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(40, 30); 1244e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(40, 10); 1254e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.moveTo(41, 11); 1264e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(41, 29); 1274e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(59, 29); 1284e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(59, 11); 1294e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark path.lineTo(41, 11); 1304e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark 1314e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark SkOpBuilder builder; 1324e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark builder.add(path, kUnion_SkPathOp); 1334e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark SkPath result; 1344e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark builder.resolve(&result); 1354e1a4c9399b8bb0897218f3ec10c254d3bb97463caryclark int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result); 1365b5ddd73b4baf22752924bf20d097e96236c36f8caryclark REPORTER_ASSERT(reporter, pixelDiff == 0); 1375b5ddd73b4baf22752924bf20d097e96236c36f8caryclark} 138218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark 139218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclarkDEF_TEST(BuilderIssue502792_2, reporter) { 140218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark SkPath path, pathB; 141218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark path.setFillType(SkPath::kWinding_FillType); 142218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); 143218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark path.addRect(2, 2, 3, 3, SkPath::kCW_Direction); 144218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark pathB.setFillType(SkPath::kEvenOdd_FillType); 145218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark pathB.addRect(3, 3, 4, 4, SkPath::kCW_Direction); 146218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark pathB.addRect(3, 3, 4, 4, SkPath::kCW_Direction); 147218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark SkOpBuilder builder; 148218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark builder.add(path, kUnion_SkPathOp); 149218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark builder.add(pathB, kDifference_SkPathOp); 150218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark SkPath result; 151218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark builder.resolve(&result); 152218f21ac09c70b98a10cb8e1999b85a22fa0b151caryclark} 153d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark 154d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclarkDEF_TEST(Fuzz846, reporter) { 155d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark/* 156d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark<clipPath id="clip-circle"> 157d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <circle id="circle" cx="60" cy="60" r="50" /> 158d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark</clipPath> 159d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark<clipPath id="clip-rect"> 160d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <clipPath id="clip-rect"> 161d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <clipPath id="clip-rect"> 162d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <clipPath id="clip-rect"> 163d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="60" /> 164d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="60" /> 165d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 166d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="32668" /> 167d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="18446744073709551615" /> 168d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="255" width="100" height="60" /> 169d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect width="100" height="60" /> 170d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 171d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="4294967236" /> 172d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 173d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark </clipPath> 174d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="60" /> 175d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="0.18093252719929986369568203" /> 176d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 177d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="32668" height="60" /> 178d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="18446744073709551615" /> 179d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="255" width="100" height="60" /> 180d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="2147483649" y="30" width="100" height="60" /> 181d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 182d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 183d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 184d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark </clipPath> 185d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="60" /> 186d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="60" /> 187d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 188d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="32668" height="60" /> 189d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="18446744073709551615" /> 190d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="255" width="100" height="60" /> 191d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="2147483649" y="30" width="100" height="60" /> 192d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 193d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="2879753595" width="100" height="60" /> 194d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 195d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark </clipPath> 196d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 197d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="0" height="60" /> 198d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 199d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="32668" height="60" /> 200d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="18446744073709551615" /> 201d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="255" width="100" height="60" /> 202d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="2147483649" y="30" width="100" height="60" /> 203d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 204d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="4294967236" /> 205d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="4294967236" /> 206d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="4294967236" /> 207d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="4294967236" /> 208d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="10" y="30" width="100" height="60" /> 209d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark <rect x="757798030" y="30" width="100" height="60" /> 210d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark*/ 211d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark SkPath clipCircle, clipRect; 212d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark SkPath inner; 213d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark clipCircle.addCircle(60, 60, 50); // <circle id="circle" cx="60" cy="60" r="50" /> 214d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark 215d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 216d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 217d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 218d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+32668, 30+0); // <rect x="10" y="30" width="32668" /> 219d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 220d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 221d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(0, 0, 0+100, 0+60); // <rect width="100" height="60" /> 222d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 223d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 224d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 225d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark clipRect.addPath(inner); 226d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.reset(); 227d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 228d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+0.18093252719929986369568203f); // <rect x="10" y="30" width="0" height="0.18093252719929986369568203" /> 229d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 230d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> 231d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 232d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 233d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> 234d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 235d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 236d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 237d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark clipRect.addPath(inner); 238d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.reset(); 239d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 240d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 241d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 242d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> 243d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 244d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 245d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> 246d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 247d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 2879753595.f, 10+100, 30+2879753595.f); // <rect x="10" y="2879753595" width="100" height="60" /> 248d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 249d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark clipRect.addPath(inner); 250d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.reset(); 251d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 252d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> 253d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 254d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> 255d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> 256d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> 257d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> 258d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 259d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 260d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 261d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 262d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> 263d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> 264d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark inner.addRect(757798030.f, 30, 757798030.f+100, 30+60); // <rect x="757798030" y="30" width="100" height="60" /> 265d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark clipRect.addPath(inner); 266d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark 267d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark SkOpBuilder builder; 268d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark builder.add(clipCircle, kUnion_SkPathOp); 269d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark builder.add(clipRect, kDifference_SkPathOp); 270d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark SkPath result; 271d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark builder.resolve(&result); 272d4349723fac9c0fd4dcf8c275fb7c756bdfdff7bcaryclark} 273364a0074c33f91ded60232f173f7a57a312e9280caryclark 274364a0074c33f91ded60232f173f7a57a312e9280caryclarkDEF_TEST(Issue569540, reporter) { 275364a0074c33f91ded60232f173f7a57a312e9280caryclark SkPath path1; 276364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.moveTo(5, -225); 277364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.lineTo(-225, 7425); 278364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.lineTo(7425, 7425); 279364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.lineTo(7425, -225); 280364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.lineTo(-225, -225); 281364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.lineTo(5, -225); 282364a0074c33f91ded60232f173f7a57a312e9280caryclark path1.close(); 283364a0074c33f91ded60232f173f7a57a312e9280caryclark 284364a0074c33f91ded60232f173f7a57a312e9280caryclark SkPath path2; 285364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.moveTo(5940, 2790); 286364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5940, 2160); 287364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5970, 1980); 288364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5688, 773669888); 289364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5688, 2160); 290364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5688, 2430); 291364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5400, 4590); 292364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5220, 4590); 293364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5220, 4920); 294364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.cubicTo(5182.22900390625f, 4948.328125f, 5160, 4992.78662109375f, 5160, 5040.00048828125f); 295364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.lineTo(5940, 2790); 296364a0074c33f91ded60232f173f7a57a312e9280caryclark path2.close(); 297364a0074c33f91ded60232f173f7a57a312e9280caryclark 298364a0074c33f91ded60232f173f7a57a312e9280caryclark SkOpBuilder builder; 299364a0074c33f91ded60232f173f7a57a312e9280caryclark builder.add(path1, kUnion_SkPathOp); 300364a0074c33f91ded60232f173f7a57a312e9280caryclark builder.add(path2, kUnion_SkPathOp); 301364a0074c33f91ded60232f173f7a57a312e9280caryclark SkPath result; 302364a0074c33f91ded60232f173f7a57a312e9280caryclark builder.resolve(&result); 303364a0074c33f91ded60232f173f7a57a312e9280caryclark} 304