senorblanco | d6ed19c | 2015-02-26 06:58:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "tests/Test.h" |
Robert Phillips | 77505da | 2017-01-20 09:11:37 -0500 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/core/SkPath.h" |
| 11 | #include "include/effects/SkGradientShader.h" |
| 12 | #include "include/gpu/GrContext.h" |
| 13 | #include "src/gpu/GrClip.h" |
| 14 | #include "src/gpu/GrContextPriv.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 15 | #include "src/gpu/GrStyle.h" |
| 16 | #include "src/gpu/effects/GrPorterDuffXferProcessor.h" |
Michael Ludwig | 663afe5 | 2019-06-03 16:46:19 -0400 | [diff] [blame] | 17 | #include "src/gpu/geometry/GrShape.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 18 | #include "src/gpu/ops/GrTessellatingPathRenderer.h" |
| 19 | #include "src/shaders/SkShaderBase.h" |
senorblanco | d6ed19c | 2015-02-26 06:58:17 -0800 | [diff] [blame] | 20 | |
| 21 | /* |
| 22 | * These tests pass by not crashing, hanging or asserting in Debug. |
| 23 | */ |
| 24 | |
| 25 | // Tests active edges made inactive by splitting. |
| 26 | // Also tests active edge list forced into an invalid ordering by |
| 27 | // splitting (mopped up in cleanup_active_edges()). |
| 28 | static SkPath create_path_0() { |
| 29 | SkPath path; |
| 30 | path.moveTo(229.127044677734375f, 67.34100341796875f); |
| 31 | path.lineTo(187.8097381591796875f, -6.7729740142822265625f); |
| 32 | path.lineTo(171.411407470703125f, 50.94266510009765625f); |
| 33 | path.lineTo(245.5253753662109375f, 9.6253643035888671875f); |
| 34 | path.moveTo(208.4683990478515625f, 30.284009933471679688f); |
| 35 | path.lineTo(171.411407470703125f, 50.94266510009765625f); |
| 36 | path.lineTo(187.8097381591796875f, -6.7729740142822265625f); |
| 37 | return path; |
| 38 | } |
| 39 | |
| 40 | // Intersections which fall exactly on the current vertex, and require |
| 41 | // a restart of the intersection checking. |
| 42 | static SkPath create_path_1() { |
| 43 | SkPath path; |
| 44 | path.moveTo(314.483551025390625f, 486.246002197265625f); |
| 45 | path.lineTo(385.41949462890625f, 532.8087158203125f); |
| 46 | path.lineTo(373.232879638671875f, 474.05938720703125f); |
| 47 | path.lineTo(326.670166015625f, 544.995361328125f); |
| 48 | path.moveTo(349.951507568359375f, 509.52734375f); |
| 49 | path.lineTo(373.232879638671875f, 474.05938720703125f); |
| 50 | path.lineTo(385.41949462890625f, 532.8087158203125f); |
| 51 | return path; |
| 52 | } |
| 53 | |
| 54 | // Tests active edges which are removed by splitting. |
| 55 | static SkPath create_path_2() { |
| 56 | SkPath path; |
| 57 | path.moveTo(343.107391357421875f, 613.62176513671875f); |
| 58 | path.lineTo(426.632415771484375f, 628.5740966796875f); |
| 59 | path.lineTo(392.3460693359375f, 579.33544921875f); |
| 60 | path.lineTo(377.39373779296875f, 662.86041259765625f); |
| 61 | path.moveTo(384.869873046875f, 621.097900390625f); |
| 62 | path.lineTo(392.3460693359375f, 579.33544921875f); |
| 63 | path.lineTo(426.632415771484375f, 628.5740966796875f); |
| 64 | return path; |
| 65 | } |
| 66 | |
| 67 | // Collinear edges merged in set_top(). |
| 68 | // Also, an intersection between left and right enclosing edges which |
| 69 | // falls above the current vertex. |
| 70 | static SkPath create_path_3() { |
| 71 | SkPath path; |
| 72 | path.moveTo(545.95751953125f, 791.69854736328125f); |
| 73 | path.lineTo(612.05816650390625f, 738.494140625f); |
| 74 | path.lineTo(552.4056396484375f, 732.0460205078125f); |
| 75 | path.lineTo(605.61004638671875f, 798.14666748046875f); |
| 76 | path.moveTo(579.00787353515625f, 765.0963134765625f); |
| 77 | path.lineTo(552.4056396484375f, 732.0460205078125f); |
| 78 | path.lineTo(612.05816650390625f, 738.494140625f); |
| 79 | return path; |
| 80 | } |
| 81 | |
| 82 | // Tests active edges which are made inactive by set_top(). |
| 83 | static SkPath create_path_4() { |
| 84 | SkPath path; |
| 85 | path.moveTo(819.2725830078125f, 751.77447509765625f); |
| 86 | path.lineTo(820.70904541015625f, 666.933837890625f); |
| 87 | path.lineTo(777.57049560546875f, 708.63592529296875f); |
| 88 | path.lineTo(862.4111328125f, 710.0723876953125f); |
| 89 | path.moveTo(819.99078369140625f, 709.3541259765625f); |
| 90 | path.lineTo(777.57049560546875f, 708.63592529296875f); |
| 91 | path.lineTo(820.70904541015625f, 666.933837890625f); |
| 92 | return path; |
| 93 | } |
| 94 | |
| 95 | static SkPath create_path_5() { |
| 96 | SkPath path; |
| 97 | path.moveTo(823.33209228515625f, 749.052734375f); |
| 98 | path.lineTo(823.494873046875f, 664.20013427734375f); |
| 99 | path.lineTo(780.9871826171875f, 706.5450439453125f); |
| 100 | path.lineTo(865.8397216796875f, 706.70782470703125f); |
| 101 | path.moveTo(823.4134521484375f, 706.6263427734375f); |
| 102 | path.lineTo(780.9871826171875f, 706.5450439453125f); |
| 103 | path.lineTo(823.494873046875f, 664.20013427734375f); |
| 104 | return path; |
| 105 | } |
| 106 | |
| 107 | static SkPath create_path_6() { |
| 108 | SkPath path; |
| 109 | path.moveTo(954.862548828125f, 562.8349609375f); |
| 110 | path.lineTo(899.32818603515625f, 498.679443359375f); |
| 111 | path.lineTo(895.017578125f, 558.52435302734375f); |
| 112 | path.lineTo(959.17315673828125f, 502.990081787109375f); |
| 113 | path.moveTo(927.0953369140625f, 530.7572021484375f); |
| 114 | path.lineTo(895.017578125f, 558.52435302734375f); |
| 115 | path.lineTo(899.32818603515625f, 498.679443359375f); |
| 116 | return path; |
| 117 | } |
| 118 | |
| 119 | static SkPath create_path_7() { |
| 120 | SkPath path; |
| 121 | path.moveTo(958.5330810546875f, 547.35516357421875f); |
| 122 | path.lineTo(899.93109130859375f, 485.989013671875f); |
| 123 | path.lineTo(898.54901123046875f, 545.97308349609375f); |
| 124 | path.lineTo(959.9151611328125f, 487.37109375f); |
| 125 | path.moveTo(929.2320556640625f, 516.67205810546875f); |
| 126 | path.lineTo(898.54901123046875f, 545.97308349609375f); |
| 127 | path.lineTo(899.93109130859375f, 485.989013671875f); |
| 128 | return path; |
| 129 | } |
| 130 | |
| 131 | static SkPath create_path_8() { |
| 132 | SkPath path; |
| 133 | path.moveTo(389.8609619140625f, 369.326873779296875f); |
| 134 | path.lineTo(470.6290283203125f, 395.33697509765625f); |
| 135 | path.lineTo(443.250030517578125f, 341.9478759765625f); |
| 136 | path.lineTo(417.239959716796875f, 422.7159423828125f); |
| 137 | path.moveTo(430.244964599609375f, 382.3319091796875f); |
| 138 | path.lineTo(443.250030517578125f, 341.9478759765625f); |
| 139 | path.lineTo(470.6290283203125f, 395.33697509765625f); |
| 140 | return path; |
| 141 | } |
| 142 | |
| 143 | static SkPath create_path_9() { |
| 144 | SkPath path; |
| 145 | path.moveTo(20, 20); |
| 146 | path.lineTo(50, 80); |
| 147 | path.lineTo(20, 80); |
| 148 | path.moveTo(80, 50); |
| 149 | path.lineTo(50, 50); |
| 150 | path.lineTo(20, 50); |
| 151 | return path; |
| 152 | } |
| 153 | |
| 154 | static SkPath create_path_10() { |
| 155 | SkPath path; |
| 156 | path.moveTo(257.19439697265625f, 320.876617431640625f); |
| 157 | path.lineTo(190.113037109375f, 320.58978271484375f); |
| 158 | path.lineTo(203.64404296875f, 293.8145751953125f); |
| 159 | path.moveTo(203.357177734375f, 360.896026611328125f); |
| 160 | path.lineTo(216.88824462890625f, 334.120819091796875f); |
| 161 | path.lineTo(230.41925048828125f, 307.345611572265625f); |
| 162 | return path; |
| 163 | } |
| 164 | |
| 165 | // A degenerate segments case, where both upper and lower segments of |
| 166 | // a split edge must remain active. |
| 167 | static SkPath create_path_11() { |
| 168 | SkPath path; |
| 169 | path.moveTo(231.9331207275390625f, 306.2012939453125f); |
| 170 | path.lineTo(191.4859161376953125f, 306.04547119140625f); |
| 171 | path.lineTo(231.0659332275390625f, 300.2642822265625f); |
| 172 | path.moveTo(189.946807861328125f, 302.072265625f); |
| 173 | path.lineTo(179.79705810546875f, 294.859771728515625f); |
| 174 | path.lineTo(191.0016021728515625f, 296.165679931640625f); |
| 175 | path.moveTo(150.8942108154296875f, 304.900146484375f); |
| 176 | path.lineTo(179.708892822265625f, 297.849029541015625f); |
| 177 | path.lineTo(190.4742279052734375f, 299.11895751953125f); |
| 178 | return path; |
| 179 | } |
| 180 | |
| 181 | // Handle the case where edge.dist(edge.fTop) != 0.0. |
| 182 | static SkPath create_path_12() { |
| 183 | SkPath path; |
| 184 | path.moveTo( 0.0f, 400.0f); |
| 185 | path.lineTo( 138.0f, 202.0f); |
| 186 | path.lineTo( 0.0f, 202.0f); |
| 187 | path.moveTo( 12.62693023681640625f, 250.57464599609375f); |
| 188 | path.lineTo( 8.13896942138671875f, 254.556884765625f); |
| 189 | path.lineTo(-18.15641021728515625f, 220.40203857421875f); |
| 190 | path.lineTo(-15.986493110656738281f, 219.6513519287109375f); |
| 191 | path.moveTo( 36.931194305419921875f, 282.485504150390625f); |
| 192 | path.lineTo( 15.617521286010742188f, 261.2901611328125f); |
| 193 | path.lineTo( 10.3829498291015625f, 252.565765380859375f); |
| 194 | path.lineTo(-16.165292739868164062f, 222.646026611328125f); |
| 195 | return path; |
| 196 | } |
| 197 | |
| 198 | // A degenerate segments case which exercises inactive edges being |
| 199 | // made active by splitting. |
| 200 | static SkPath create_path_13() { |
| 201 | SkPath path; |
| 202 | path.moveTo(690.62127685546875f, 509.25555419921875f); |
| 203 | path.lineTo(99.336181640625f, 511.71405029296875f); |
| 204 | path.lineTo(708.362548828125f, 512.4349365234375f); |
| 205 | path.lineTo(729.9940185546875f, 516.3114013671875f); |
| 206 | path.lineTo(738.708984375f, 518.76995849609375f); |
| 207 | path.lineTo(678.3463134765625f, 510.0819091796875f); |
| 208 | path.lineTo(681.21795654296875f, 504.81378173828125f); |
| 209 | path.moveTo(758.52764892578125f, 521.55963134765625f); |
| 210 | path.lineTo(719.1549072265625f, 514.50372314453125f); |
| 211 | path.lineTo(689.59063720703125f, 512.0628662109375f); |
| 212 | path.lineTo(679.78216552734375f, 507.447845458984375f); |
| 213 | return path; |
| 214 | } |
| 215 | |
| 216 | // Tests vertices which become "orphaned" (ie., no connected edges) |
| 217 | // after simplification. |
| 218 | static SkPath create_path_14() { |
| 219 | SkPath path; |
| 220 | path.moveTo(217.326019287109375f, 166.4752960205078125f); |
| 221 | path.lineTo(226.279266357421875f, 170.929473876953125f); |
| 222 | path.lineTo(234.3973388671875f, 177.0623626708984375f); |
| 223 | path.lineTo(262.0921630859375f, 188.746124267578125f); |
| 224 | path.moveTo(196.23638916015625f, 174.0722198486328125f); |
| 225 | path.lineTo(416.15277099609375f, 180.138214111328125f); |
| 226 | path.lineTo(192.651947021484375f, 304.0228271484375f); |
| 227 | return path; |
| 228 | } |
| 229 | |
senorblanco | a2b6d28 | 2015-03-02 09:34:13 -0800 | [diff] [blame] | 230 | static SkPath create_path_15() { |
| 231 | SkPath path; |
| 232 | path.moveTo( 0.0f, 0.0f); |
| 233 | path.lineTo(10000.0f, 0.0f); |
| 234 | path.lineTo( 0.0f, -1.0f); |
| 235 | path.lineTo(10000.0f, 0.000001f); |
| 236 | path.lineTo( 0.0f, -30.0f); |
| 237 | return path; |
| 238 | } |
| 239 | |
senorblanco | 70f5251 | 2016-08-17 14:56:22 -0700 | [diff] [blame] | 240 | // Reduction of Nebraska-StateSeal.svg. Floating point error causes the |
| 241 | // same edge to be added to more than one poly on the same side. |
| 242 | static SkPath create_path_16() { |
| 243 | SkPath path; |
| 244 | path.moveTo(170.8199920654296875, 491.86700439453125); |
| 245 | path.lineTo(173.7649993896484375, 489.7340087890625); |
| 246 | path.lineTo(174.1450958251953125, 498.545989990234375); |
| 247 | path.lineTo( 171.998992919921875, 500.88201904296875); |
| 248 | path.moveTo(168.2922515869140625, 498.66265869140625); |
| 249 | path.lineTo(169.8589935302734375, 497.94500732421875); |
| 250 | path.lineTo( 172, 500.88299560546875); |
| 251 | path.moveTo( 169.555267333984375, 490.70111083984375); |
| 252 | path.lineTo(173.7649993896484375, 489.7340087890625); |
| 253 | path.lineTo( 170.82000732421875, 491.86700439453125); |
| 254 | return path; |
| 255 | } |
| 256 | |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 257 | // A simple concave path. Test this with a non-invertible matrix. |
| 258 | static SkPath create_path_17() { |
| 259 | SkPath path; |
| 260 | path.moveTo(20, 20); |
| 261 | path.lineTo(80, 20); |
| 262 | path.lineTo(30, 30); |
| 263 | path.lineTo(20, 80); |
| 264 | return path; |
| 265 | } |
| 266 | |
Stephen White | 64dbb89 | 2017-05-03 16:00:38 -0400 | [diff] [blame] | 267 | // A shape with a vertex collinear to the right hand edge. |
| 268 | // This messes up find_enclosing_edges. |
| 269 | static SkPath create_path_18() { |
| 270 | SkPath path; |
| 271 | path.moveTo(80, 20); |
| 272 | path.lineTo(80, 60); |
| 273 | path.lineTo(20, 60); |
| 274 | path.moveTo(80, 50); |
| 275 | path.lineTo(80, 80); |
| 276 | path.lineTo(20, 80); |
| 277 | return path; |
| 278 | } |
| 279 | |
Stephen White | 6eca90f | 2017-05-25 14:47:11 -0400 | [diff] [blame] | 280 | // Exercises the case where an edge becomes collinear with *two* of its |
| 281 | // adjacent neighbour edges after splitting. |
| 282 | // This is a reduction from |
| 283 | // http://mooooo.ooo/chebyshev-sine-approximation/horner_ulp.svg |
| 284 | static SkPath create_path_19() { |
| 285 | SkPath path; |
| 286 | path.moveTo( 351.99298095703125, 348.23046875); |
| 287 | path.lineTo( 351.91876220703125, 347.33984375); |
| 288 | path.lineTo( 351.91876220703125, 346.1953125); |
| 289 | path.lineTo( 351.90313720703125, 347.734375); |
| 290 | path.lineTo( 351.90313720703125, 346.1328125); |
| 291 | path.lineTo( 351.87579345703125, 347.93359375); |
| 292 | path.lineTo( 351.87579345703125, 345.484375); |
| 293 | path.lineTo( 351.86407470703125, 347.7890625); |
| 294 | path.lineTo( 351.86407470703125, 346.2109375); |
| 295 | path.lineTo( 351.84844970703125, 347.63763427734375); |
| 296 | path.lineTo( 351.84454345703125, 344.19232177734375); |
| 297 | path.lineTo( 351.78204345703125, 346.9483642578125); |
| 298 | path.lineTo( 351.758636474609375, 347.18310546875); |
| 299 | path.lineTo( 351.75469970703125, 346.75); |
| 300 | path.lineTo( 351.75469970703125, 345.46875); |
| 301 | path.lineTo( 352.5546875, 345.46875); |
| 302 | path.lineTo( 352.55078125, 347.01953125); |
| 303 | path.lineTo( 351.75079345703125, 347.02313232421875); |
| 304 | path.lineTo( 351.74688720703125, 346.15203857421875); |
| 305 | path.lineTo( 351.74688720703125, 347.646148681640625); |
| 306 | path.lineTo( 352.5390625, 346.94140625); |
| 307 | path.lineTo( 351.73907470703125, 346.94268798828125); |
| 308 | path.lineTo( 351.73516845703125, 344.48565673828125); |
| 309 | path.lineTo( 352.484375, 346.73828125); |
| 310 | path.lineTo( 351.68438720703125, 346.7401123046875); |
| 311 | path.lineTo( 352.4765625, 346.546875); |
| 312 | path.lineTo( 351.67657470703125, 346.54937744140625); |
| 313 | path.lineTo( 352.47265625, 346.75390625); |
| 314 | path.lineTo( 351.67266845703125, 346.756622314453125); |
| 315 | path.lineTo( 351.66876220703125, 345.612091064453125); |
| 316 | return path; |
| 317 | } |
| 318 | |
Stephen White | 019f6c0 | 2017-06-09 10:06:26 -0400 | [diff] [blame] | 319 | // An intersection above the first vertex in the mesh. |
| 320 | // Reduction from http://crbug.com/730687 |
Stephen White | 0cb3167 | 2017-06-08 14:41:01 -0400 | [diff] [blame] | 321 | static SkPath create_path_20() { |
| 322 | SkPath path; |
| 323 | path.moveTo( 2822128.5, 235.026336669921875); |
| 324 | path.lineTo( 2819349.25, 235.3623504638671875); |
| 325 | path.lineTo( -340558688, 23.83478546142578125); |
| 326 | path.lineTo( -340558752, 25.510419845581054688); |
| 327 | path.lineTo( -340558720, 27.18605804443359375); |
| 328 | return path; |
| 329 | } |
| 330 | |
Stephen White | e3a0be7 | 2017-06-12 11:43:18 -0400 | [diff] [blame] | 331 | // An intersection whose result is NaN (due to rounded-to-inf endpoint). |
| 332 | static SkPath create_path_21() { |
| 333 | SkPath path; |
| 334 | path.moveTo(1.7889142061167663539e+38, 39338463358011572224.0); |
| 335 | path.lineTo( 1647.4193115234375, -522.603515625); |
| 336 | path.lineTo( 1677.74560546875, -529.0028076171875); |
| 337 | path.lineTo( 1678.29541015625, -528.7847900390625); |
| 338 | path.lineTo( 1637.5167236328125, -519.79266357421875); |
| 339 | path.lineTo( 1647.4193115234375, -522.603515625); |
| 340 | return path; |
| 341 | } |
| 342 | |
Stephen White | 3f5301b | 2017-08-15 17:01:15 -0400 | [diff] [blame] | 343 | // A path which contains out-of-range colinear intersections. |
| 344 | static SkPath create_path_23() { |
| 345 | SkPath path; |
| 346 | path.moveTo( 0, 63.39080047607421875); |
| 347 | path.lineTo(-0.70804601907730102539, 63.14350128173828125); |
| 348 | path.lineTo(-7.8608899287380243391e-17, 64.14080047607421875); |
| 349 | path.moveTo( 0, 64.14080047607421875); |
| 350 | path.lineTo(44.285900115966796875, 64.14080047607421875); |
| 351 | path.lineTo( 0, 62.64080047607421875); |
| 352 | path.moveTo(21.434900283813476562, -0.24732701480388641357); |
| 353 | path.lineTo(-0.70804601907730102539, 63.14350128173828125); |
| 354 | path.lineTo(0.70804601907730102539, 63.6381988525390625); |
| 355 | return path; |
| 356 | } |
| 357 | |
Stephen White | 73e7f80 | 2017-08-23 13:56:07 -0400 | [diff] [blame] | 358 | // A path which results in infs and nans when conics are converted to quads. |
| 359 | static SkPath create_path_24() { |
| 360 | SkPath path; |
| 361 | path.moveTo(-2.20883e+37f, -1.02892e+37f); |
| 362 | path.conicTo(-2.00958e+38f, -9.36107e+37f, -1.7887e+38f, -8.33215e+37f, 0.707107f); |
| 363 | path.conicTo(-1.56782e+38f, -7.30323e+37f, 2.20883e+37f, 1.02892e+37f, 0.707107f); |
| 364 | path.conicTo(2.00958e+38f, 9.36107e+37f, 1.7887e+38f, 8.33215e+37f, 0.707107f); |
| 365 | path.conicTo(1.56782e+38f, 7.30323e+37f, -2.20883e+37f, -1.02892e+37f, 0.707107f); |
| 366 | return path; |
| 367 | } |
| 368 | |
Stephen White | e260c46 | 2017-12-19 18:09:54 -0500 | [diff] [blame] | 369 | // An edge collapse event which also collapses a neighbour, requiring |
| 370 | // its event to be removed. |
| 371 | static SkPath create_path_25() { |
| 372 | SkPath path; |
| 373 | path.moveTo( 43.44110107421875, 148.15106201171875); |
| 374 | path.lineTo( 44.64471435546875, 148.16748046875); |
| 375 | path.lineTo( 46.35009765625, 147.403076171875); |
| 376 | path.lineTo( 46.45404052734375, 148.34906005859375); |
| 377 | path.lineTo( 45.0400390625, 148.54205322265625); |
| 378 | path.lineTo( 44.624053955078125, 148.9810791015625); |
| 379 | path.lineTo( 44.59405517578125, 149.16107177734375); |
| 380 | path.lineTo( 44.877044677734375, 149.62005615234375); |
| 381 | path.lineTo(144.373016357421875, 68.8070068359375); |
| 382 | return path; |
| 383 | } |
| 384 | |
| 385 | // An edge collapse event causes an edge to become collinear, requiring |
| 386 | // its event to be removed. |
| 387 | static SkPath create_path_26() { |
| 388 | SkPath path; |
| 389 | path.moveTo( 43.44110107421875, 148.15106201171875); |
| 390 | path.lineTo( 44.64471435546875, 148.16748046875); |
| 391 | path.lineTo( 46.35009765625, 147.403076171875); |
| 392 | path.lineTo( 46.45404052734375, 148.34906005859375); |
| 393 | path.lineTo( 45.0400390625, 148.54205322265625); |
| 394 | path.lineTo( 44.624053955078125, 148.9810791015625); |
| 395 | path.lineTo( 44.59405517578125, 149.16107177734375); |
| 396 | path.lineTo( 44.877044677734375, 149.62005615234375); |
| 397 | path.lineTo(144.373016357421875, 68.8070068359375); |
| 398 | return path; |
| 399 | } |
| 400 | |
Stephen White | 94b7e54 | 2018-01-04 14:01:10 -0500 | [diff] [blame] | 401 | // A path which results in non-finite points when stroked and bevelled for AA. |
| 402 | static SkPath create_path_27() { |
| 403 | SkPath path; |
| 404 | path.moveTo(8.5027233009104409507e+37, 1.7503381025241130639e+37); |
| 405 | path.lineTo(7.0923661737711584874e+37, 1.4600074517285415699e+37); |
| 406 | path.lineTo(7.0848733446033294691e+37, 1.4584649744781838604e+37); |
| 407 | path.lineTo(-2.0473916115129349496e+37, -4.2146796450364162012e+36); |
| 408 | path.lineTo(2.0473912312177548811e+37, 4.2146815465123165435e+36); |
| 409 | return path; |
| 410 | } |
Stephen White | f470b7e | 2018-01-04 16:45:51 -0500 | [diff] [blame] | 411 | |
| 412 | // AA stroking this path produces intersection failures on bevelling. |
| 413 | // This should skip the point, but not assert. |
| 414 | static SkPath create_path_28() { |
| 415 | SkPath path; |
| 416 | path.moveTo(-7.5952312625177475154e+21, -2.6819185100266674911e+24); |
| 417 | path.lineTo( 1260.3787841796875, 1727.7947998046875); |
| 418 | path.lineTo( 1260.5567626953125, 1728.0386962890625); |
| 419 | path.lineTo(1.1482511310557754163e+21, 4.054538502765980051e+23); |
| 420 | path.lineTo(-7.5952312625177475154e+21, -2.6819185100266674911e+24); |
| 421 | return path; |
| 422 | } |
Stephen White | e40c361 | 2018-01-09 11:49:08 -0500 | [diff] [blame] | 423 | |
| 424 | // A quad which generates a huge number of points (>2B) when uniformly |
| 425 | // linearized. This should not hang or OOM. |
| 426 | static SkPath create_path_29() { |
| 427 | SkPath path; |
| 428 | path.moveTo(10, 0); |
| 429 | path.lineTo(0, 0); |
| 430 | path.quadTo(10, 0, 0, 8315084722602508288); |
| 431 | return path; |
| 432 | } |
| 433 | |
Stephen White | 20010e8 | 2018-03-28 14:41:22 -0400 | [diff] [blame] | 434 | // A path which hangs during simplification. It produces an edge which is |
| 435 | // to the left of its own endpoints, which causes an infinte loop in the |
| 436 | // right-enclosing-edge splitting. |
| 437 | static SkPath create_path_30() { |
| 438 | SkPath path; |
| 439 | path.moveTo(0.75001740455627441406, 23.051967620849609375); |
| 440 | path.lineTo(5.8471612930297851562, 22.731662750244140625); |
| 441 | path.lineTo(10.749670028686523438, 22.253145217895507812); |
| 442 | path.lineTo(13.115868568420410156, 22.180681228637695312); |
| 443 | path.lineTo(15.418928146362304688, 22.340015411376953125); |
| 444 | path.lineTo( 17.654022216796875, 22.82159423828125); |
| 445 | path.lineTo(19.81632232666015625, 23.715869903564453125); |
| 446 | path.lineTo(40, 0); |
| 447 | path.lineTo(5.5635203441547955577e-15, 0); |
| 448 | path.lineTo(5.5635203441547955577e-15, 47); |
| 449 | path.lineTo(-1.4210854715202003717e-14, 21.713298797607421875); |
| 450 | path.lineTo(0.75001740455627441406, 21.694292068481445312); |
| 451 | path.lineTo(0.75001740455627441406, 23.051967620849609375); |
| 452 | return path; |
| 453 | } |
| 454 | |
Stephen White | ea49523 | 2018-04-03 11:28:15 -0400 | [diff] [blame] | 455 | // A path with vertices which become infinite on AA stroking. Should not crash or assert. |
| 456 | static SkPath create_path_31() { |
| 457 | SkPath path; |
| 458 | path.moveTo(2.0257809259190991347e+36, -1244080640); |
| 459 | path.conicTo(2.0257809259190991347e+36, -1244080640, |
| 460 | 2.0257809259190991347e+36, 0.10976474732160568237, 0.70710676908493041992); |
| 461 | path.lineTo(-10036566016, -1954718402215936); |
| 462 | path.conicTo(-1.1375507718551896064e+20, -1954721086570496, |
| 463 | 10036566016, -1954721086570496, 0.70710676908493041992); |
| 464 | return path; |
| 465 | } |
| 466 | |
Stephen White | ec79c39 | 2018-05-18 11:49:21 -0400 | [diff] [blame] | 467 | // Reduction from skbug.com/7911 that causes a crash due to splitting a |
| 468 | // zombie edge. |
| 469 | static SkPath create_path_32() { |
| 470 | SkPath path; |
| 471 | path.moveTo( 0, 1.0927740941146660348e+24); |
| 472 | path.lineTo(2.9333931225865729333e+32, 16476101); |
| 473 | path.lineTo(1.0927731573659435417e+24, 1.0927740941146660348e+24); |
| 474 | path.lineTo(1.0927740941146660348e+24, 3.7616281094287041715e-37); |
| 475 | path.lineTo(1.0927740941146660348e+24, 1.0927740941146660348e+24); |
| 476 | path.lineTo(1.3061803026169399536e-33, 1.0927740941146660348e+24); |
| 477 | path.lineTo(4.7195362919941370727e-16, -8.4247545146051822591e+32); |
| 478 | return path; |
| 479 | } |
| 480 | |
Stephen White | 7b37694 | 2018-05-22 11:51:32 -0400 | [diff] [blame] | 481 | // From crbug.com/844873. Crashes trying to merge a zombie edge. |
| 482 | static SkPath create_path_33() { |
| 483 | SkPath path; |
| 484 | path.moveTo( 316.000579833984375, -4338355948977389568); |
| 485 | path.lineTo(1.5069369808623501312e+20, 75180972320904708096.0); |
| 486 | path.lineTo(1.5069369808623501312e+20, 75180972320904708096.0); |
| 487 | path.lineTo( 771.21014404296875, -4338355948977389568.0); |
| 488 | path.lineTo( 316.000579833984375, -4338355948977389568.0); |
| 489 | path.moveTo( 354.208984375, -4338355948977389568.0); |
| 490 | path.lineTo( 773.00177001953125, -4338355948977389568.0); |
| 491 | path.lineTo(1.5069369808623501312e+20, 75180972320904708096.0); |
| 492 | path.lineTo(1.5069369808623501312e+20, 75180972320904708096.0); |
| 493 | path.lineTo( 354.208984375, -4338355948977389568.0); |
| 494 | return path; |
| 495 | } |
| 496 | |
Stephen White | 53a0298 | 2018-05-30 22:47:46 -0400 | [diff] [blame] | 497 | // From crbug.com/844873. Hangs repeatedly splitting alternate vertices. |
| 498 | static SkPath create_path_34() { |
| 499 | SkPath path; |
| 500 | path.moveTo(10, -1e+20f); |
| 501 | path.lineTo(11, 25000); |
| 502 | path.lineTo(10, 25000); |
| 503 | path.lineTo(11, 25010); |
| 504 | return path; |
| 505 | } |
| 506 | |
| 507 | // Reduction from circular_arcs_stroke_and_fill_round GM which |
| 508 | // repeatedly splits on the opposite edge from case 34 above. |
| 509 | static SkPath create_path_35() { |
| 510 | SkPath path; |
| 511 | path.moveTo( 16.25, 26.495191574096679688); |
| 512 | path.lineTo(32.420825958251953125, 37.377376556396484375); |
| 513 | path.lineTo(25.176382064819335938, 39.31851959228515625); |
| 514 | path.moveTo( 20, 20); |
| 515 | path.lineTo(28.847436904907226562, 37.940830230712890625); |
| 516 | path.lineTo(25.17638397216796875, 39.31851959228515625); |
| 517 | return path; |
| 518 | } |
| 519 | |
Stephen White | e62999f | 2018-06-05 18:45:07 -0400 | [diff] [blame] | 520 | // Reduction from crbug.com/843135 where an intersection is found |
| 521 | // below the bottom of both intersected edges. |
| 522 | static SkPath create_path_36() { |
| 523 | SkPath path; |
| 524 | path.moveTo(-2791476679359332352, 2608107002026524672); |
| 525 | path.lineTo( 0, 11.95427703857421875); |
| 526 | path.lineTo(-2781824066779086848, 2599088532777598976); |
| 527 | path.lineTo( -7772.6875, 7274); |
| 528 | return path; |
| 529 | } |
| 530 | |
Stephen White | 89042d5 | 2018-06-08 12:18:22 -0400 | [diff] [blame] | 531 | // Reduction from crbug.com/843135. Exercises a case where an intersection is missed. |
| 532 | // This causes bad ordering in the active edge list. |
| 533 | static SkPath create_path_37() { |
| 534 | SkPath path; |
| 535 | path.moveTo(-1.0662557646016024569e+23, 9.9621425197286319718e+22); |
| 536 | path.lineTo( -121806400, 113805032); |
| 537 | path.lineTo( -120098872, 112209680); |
| 538 | path.lineTo( 6.2832999862817380468e-36, 2.9885697364807128906); |
| 539 | return path; |
| 540 | } |
| 541 | |
Stephen White | 13f3d8d | 2018-06-22 10:19:20 -0400 | [diff] [blame] | 542 | // Reduction from crbug.com/851914. |
| 543 | static SkPath create_path_38() { |
| 544 | SkPath path; |
| 545 | path.moveTo(14.400531768798828125, 17.711114883422851562); |
| 546 | path.lineTo(14.621990203857421875, 171563104293879808); |
| 547 | path.lineTo(14.027951240539550781, 872585759381520384); |
| 548 | path.lineTo( 14.0216827392578125, 872665817571917824); |
| 549 | path.lineTo(7.699314117431640625, -3417320793833472); |
| 550 | path.moveTo(11.606547355651855469, 17.40966796875); |
| 551 | path.lineTo( 7642114886926860288, 21.08358001708984375); |
| 552 | path.lineTo(11.606547355651855469, 21.08358001708984375); |
| 553 | return path; |
| 554 | } |
| 555 | |
Stephen White | 24289e0 | 2018-06-29 17:02:21 -0400 | [diff] [blame] | 556 | // Reduction from crbug.com/851409. Exercises collinear last vertex. |
Stephen White | 3de40f8 | 2018-06-28 09:36:49 -0400 | [diff] [blame] | 557 | static SkPath create_path_39() { |
| 558 | SkPath path; |
| 559 | path.moveTo(2072553216, 0); |
| 560 | path.lineTo(2072553216, 1); |
| 561 | path.lineTo(2072553472, -13.5); |
| 562 | path.lineTo(2072553216, 0); |
| 563 | path.lineTo(2072553472, -6.5); |
| 564 | return path; |
| 565 | } |
| 566 | |
Stephen White | 24289e0 | 2018-06-29 17:02:21 -0400 | [diff] [blame] | 567 | // Another reduction from crbug.com/851409. Exercises two sequential collinear edges. |
| 568 | static SkPath create_path_40() { |
| 569 | SkPath path; |
| 570 | path.moveTo(2072553216, 0); |
| 571 | path.lineTo(2072553216, 1); |
| 572 | path.lineTo(2072553472, -13); |
| 573 | path.lineTo(2072553216, 0); |
| 574 | path.lineTo(2072553472, -6); |
| 575 | path.lineTo(2072553472, -13); |
| 576 | return path; |
| 577 | } |
| 578 | |
Stephen White | 1c5fd18 | 2018-07-12 15:54:05 -0400 | [diff] [blame] | 579 | // Reduction from crbug.com/860453. Tests a case where a "missing" intersection |
| 580 | // requires the active edge list to go out-of-order. |
| 581 | static SkPath create_path_41() { |
| 582 | SkPath path; |
| 583 | path.moveTo(72154931603311689728.0, 330.95965576171875); |
| 584 | path.lineTo(24053266013925408768.0, 78.11376953125); |
| 585 | path.lineTo(1.2031099003292404941e+20, 387.168731689453125); |
| 586 | path.lineTo(68859835992355373056.0, 346.55047607421875); |
| 587 | path.lineTo(76451708695451009024.0, 337.780029296875); |
| 588 | path.moveTo(-20815817797613387776.0, 18065700622522384384.0); |
| 589 | path.lineTo(-72144121204987396096.0, 142.855804443359375); |
| 590 | path.lineTo(72144121204987396096.0, 325.184783935546875); |
| 591 | path.lineTo(1.2347242901040791552e+20, 18065700622522384384.0); |
| 592 | return path; |
| 593 | } |
| 594 | |
Stephen White | 71ed661 | 2018-07-16 13:31:16 -0400 | [diff] [blame] | 595 | // Reduction from crbug.com/860655. Cause is three collinear edges discovered during |
| 596 | // sanitize_contours pass, before the vertices have been found coincident. |
| 597 | static SkPath create_path_42() { |
| 598 | SkPath path; |
| 599 | path.moveTo( 32572426382475264, -3053391034974208); |
| 600 | path.lineTo( 521289856, -48865776); |
| 601 | path.lineTo( 130322464, -12215873); |
| 602 | path.moveTo( 32572426382475264, -3053391034974208); |
| 603 | path.lineTo( 521289856, -48865776); |
| 604 | path.lineTo( 130322464, -12215873); |
| 605 | path.moveTo( 32572426382475264, -3053391034974208); |
| 606 | path.lineTo( 32114477642022912, -3010462031544320); |
| 607 | path.lineTo( 32111784697528320, -3010209702215680); |
| 608 | return path; |
| 609 | } |
| 610 | |
Stephen White | d26b4d8 | 2018-07-26 10:02:27 -0400 | [diff] [blame] | 611 | // Reduction from crbug.com/866319. Cause is edges that are collinear when tested from |
| 612 | // one side, but non-collinear when tested from the other. |
| 613 | static SkPath create_path_43() { |
| 614 | SkPath path; |
| 615 | path.moveTo( 307316821852160, -28808363114496); |
| 616 | path.lineTo( 307165222928384, -28794154909696); |
| 617 | path.lineTo( 307013691113472, -28779948802048); |
| 618 | path.lineTo( 306862159298560, -28765744791552); |
| 619 | path.lineTo( 306870313025536, -28766508154880); |
| 620 | path.lineTo( 307049695019008, -28783327313920); |
| 621 | path.lineTo( 307408660332544, -28816974020608); |
| 622 | return path; |
| 623 | } |
| 624 | |
Stephen White | 8a3c059 | 2019-05-29 11:26:16 -0400 | [diff] [blame] | 625 | // Reduction from crbug.com/966696 |
| 626 | static SkPath create_path_44() { |
| 627 | SkPath path; |
| 628 | path.moveTo(114.4606170654296875, 186.443878173828125); |
| 629 | path.lineTo( 91.5394744873046875, 185.4189453125); |
| 630 | path.lineTo(306.45538330078125, 3203.986083984375); |
| 631 | path.moveTo(16276206965409972224.0, 815.59393310546875); |
| 632 | path.lineTo(-3.541605062372533207e+20, 487.7236328125); |
| 633 | path.lineTo(-3.541605062372533207e+20, 168.204071044921875); |
| 634 | path.lineTo(16276206965409972224.0, 496.07427978515625); |
| 635 | path.moveTo(-3.541605062372533207e+20, 167.00958251953125); |
| 636 | path.lineTo(-3.541605062372533207e+20, 488.32086181640625); |
| 637 | path.lineTo(16276206965409972224.0, 816.78839111328125); |
| 638 | path.lineTo(16276206965409972224.0, 495.47705078125); |
| 639 | return path; |
| 640 | } |
| 641 | |
Stephen White | b67b235 | 2019-06-01 13:07:27 -0400 | [diff] [blame] | 642 | // Reduction from crbug.com/966274. |
| 643 | static SkPath create_path_45() { |
| 644 | SkPath path; |
| 645 | path.moveTo( 706471854080, 379003666432); |
| 646 | path.lineTo( 706503180288, 379020443648); |
| 647 | path.lineTo( 706595717120, 379070087168); |
| 648 | path.lineTo( 706626060288, 379086372864); |
| 649 | path.lineTo( 706656141312, 379102527488); |
| 650 | path.lineTo( 706774171648, 379165835264); |
| 651 | path.lineTo( 706803073024, 379181334528); |
| 652 | path.lineTo( 706831712256, 379196702720); |
| 653 | path.lineTo( 706860154880, 379211939840); |
| 654 | path.lineTo( 706888335360, 379227078656); |
| 655 | path.lineTo( 706916253696, 379242053632); |
| 656 | path.lineTo( 706956820480, 379263811584); |
| 657 | path.lineTo( 706929098752, 379248934912); |
| 658 | path.lineTo( 706901114880, 379233927168); |
| 659 | path.lineTo( 706872934400, 379218821120); |
| 660 | path.lineTo( 706844491776, 379203551232); |
| 661 | path.lineTo( 706815787008, 379188183040); |
| 662 | path.lineTo( 706786885632, 379172651008); |
| 663 | path.lineTo( 706757722112, 379156987904); |
| 664 | path.lineTo( 706728296448, 379141226496); |
| 665 | path.lineTo( 706698608640, 379125301248); |
| 666 | path.lineTo( 706668724224, 379109244928); |
| 667 | path.lineTo( 706638577664, 379093090304); |
| 668 | path.lineTo( 706608168960, 379076771840); |
| 669 | path.lineTo( 706484174848, 379010252800); |
| 670 | return path; |
| 671 | } |
| 672 | |
Stephen White | 9b7f143 | 2019-06-08 08:56:58 -0400 | [diff] [blame] | 673 | // Reduction from crbug.com/969359. Inf generated by intersections |
| 674 | // causes NaN in subsequent intersections, leading to assert or hang. |
| 675 | |
| 676 | static SkPath create_path_46() { |
| 677 | SkPath path; |
| 678 | path.moveTo(1.0321827899075254821e+37, -5.1199920965387697886e+37); |
| 679 | path.lineTo(-1.0321827899075254821e+37, 5.1199920965387697886e+37); |
| 680 | path.lineTo(-1.0425214946728668754e+37, 4.5731834042267216669e+37); |
| 681 | path.moveTo(-9.5077331762291841872e+36, 8.1304868292377430302e+37); |
| 682 | path.lineTo(9.5077331762291841872e+36, -8.1304868292377430302e+37); |
| 683 | path.lineTo(1.0795449417808426232e+37, 1.2246856113744539311e+37); |
| 684 | path.moveTo(-165.8018341064453125, -44.859375); |
| 685 | path.lineTo(-9.558702871563160835e+36, -7.9814405281448285475e+37); |
| 686 | path.lineTo(-9.4147814283168490381e+36, -8.3935116522790983488e+37); |
| 687 | return path; |
| 688 | } |
| 689 | |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 690 | static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) { |
Stephen White | e260c46 | 2017-12-19 18:09:54 -0500 | [diff] [blame] | 691 | |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 692 | SkPoint pts[2] = { {0, 0}, {1, 1} }; |
| 693 | SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE }; |
| 694 | sk_sp<SkShader> shader = SkGradientShader::MakeLinear( |
Mike Reed | fae8fce | 2019-04-03 10:27:45 -0400 | [diff] [blame] | 695 | pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp); |
Brian Salomon | bd3d8d3 | 2019-07-02 09:16:28 -0400 | [diff] [blame] | 696 | GrColorSpaceInfo colorSpaceInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType, nullptr); |
Florin Malita | c6c5ead | 2018-04-11 15:33:40 -0400 | [diff] [blame] | 697 | GrFPArgs args(ctx, &SkMatrix::I(), SkFilterQuality::kLow_SkFilterQuality, &colorSpaceInfo); |
Florin Malita | 4aed138 | 2017-05-25 10:38:07 -0400 | [diff] [blame] | 698 | return as_SB(shader)->asFragmentProcessor(args); |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 699 | } |
| 700 | |
Robert Phillips | 256c37b | 2017-03-01 14:32:46 -0500 | [diff] [blame] | 701 | static void test_path(GrContext* ctx, |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 702 | GrRenderTargetContext* renderTargetContext, |
| 703 | const SkPath& path, |
| 704 | const SkMatrix& matrix = SkMatrix::I(), |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 705 | GrAAType aaType = GrAAType::kNone, |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 706 | std::unique_ptr<GrFragmentProcessor> fp = nullptr) { |
senorblanco | d6ed19c | 2015-02-26 06:58:17 -0800 | [diff] [blame] | 707 | GrTessellatingPathRenderer tess; |
Stephen White | 8a3c059 | 2019-05-29 11:26:16 -0400 | [diff] [blame] | 708 | tess.setMaxVerbCount(100); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 709 | |
| 710 | GrPaint paint; |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 711 | paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 712 | if (fp) { |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 713 | paint.addColorFragmentProcessor(std::move(fp)); |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 714 | } |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 715 | |
cdalton | 846c051 | 2016-05-13 10:25:00 -0700 | [diff] [blame] | 716 | GrNoClip noClip; |
Chris Dalton | db91c6e | 2017-09-08 16:25:08 -0600 | [diff] [blame] | 717 | SkIRect clipConservativeBounds = SkIRect::MakeWH(renderTargetContext->width(), |
| 718 | renderTargetContext->height()); |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 719 | GrStyle style(SkStrokeRec::kFill_InitStyle); |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 720 | GrShape shape(path, style); |
Robert Phillips | 256c37b | 2017-03-01 14:32:46 -0500 | [diff] [blame] | 721 | GrPathRenderer::DrawPathArgs args{ctx, |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 722 | std::move(paint), |
| 723 | &GrUserStencilSettings::kUnused, |
| 724 | renderTargetContext, |
| 725 | &noClip, |
Chris Dalton | db91c6e | 2017-09-08 16:25:08 -0600 | [diff] [blame] | 726 | &clipConservativeBounds, |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 727 | &matrix, |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 728 | &shape, |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 729 | aaType, |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 730 | false}; |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 731 | tess.drawPath(args); |
senorblanco | d6ed19c | 2015-02-26 06:58:17 -0800 | [diff] [blame] | 732 | } |
| 733 | |
bsalomon | fda8807 | 2016-04-11 14:40:50 -0700 | [diff] [blame] | 734 | DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { |
Robert Phillips | 77505da | 2017-01-20 09:11:37 -0500 | [diff] [blame] | 735 | GrContext* ctx = ctxInfo.grContext(); |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 736 | sk_sp<GrRenderTargetContext> rtc(ctx->priv().makeDeferredRenderTargetContext( |
Brian Salomon | 27ae52c | 2019-07-03 11:27:44 -0400 | [diff] [blame] | 737 | SkBackingFit::kApprox, 800, 800, GrColorType::kRGBA_8888, nullptr, 1, GrMipMapped::kNo, |
| 738 | kTopLeft_GrSurfaceOrigin)); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 739 | if (!rtc) { |
robertphillips | 87f15c8 | 2016-05-20 11:14:33 -0700 | [diff] [blame] | 740 | return; |
| 741 | } |
| 742 | |
Robert Phillips | 77505da | 2017-01-20 09:11:37 -0500 | [diff] [blame] | 743 | ctx->flush(); |
Greg Daniel | f44cb48 | 2018-02-27 14:26:32 -0500 | [diff] [blame] | 744 | // Adding discard to appease vulkan validation warning about loading uninitialized data on draw |
| 745 | rtc->discard(); |
| 746 | |
Robert Phillips | 256c37b | 2017-03-01 14:32:46 -0500 | [diff] [blame] | 747 | test_path(ctx, rtc.get(), create_path_0()); |
| 748 | test_path(ctx, rtc.get(), create_path_1()); |
| 749 | test_path(ctx, rtc.get(), create_path_2()); |
| 750 | test_path(ctx, rtc.get(), create_path_3()); |
| 751 | test_path(ctx, rtc.get(), create_path_4()); |
| 752 | test_path(ctx, rtc.get(), create_path_5()); |
| 753 | test_path(ctx, rtc.get(), create_path_6()); |
| 754 | test_path(ctx, rtc.get(), create_path_7()); |
| 755 | test_path(ctx, rtc.get(), create_path_8()); |
| 756 | test_path(ctx, rtc.get(), create_path_9()); |
| 757 | test_path(ctx, rtc.get(), create_path_10()); |
| 758 | test_path(ctx, rtc.get(), create_path_11()); |
| 759 | test_path(ctx, rtc.get(), create_path_12()); |
| 760 | test_path(ctx, rtc.get(), create_path_13()); |
| 761 | test_path(ctx, rtc.get(), create_path_14()); |
| 762 | test_path(ctx, rtc.get(), create_path_15()); |
| 763 | test_path(ctx, rtc.get(), create_path_16()); |
Stephen White | cc70083 | 2017-02-15 11:45:16 -0500 | [diff] [blame] | 764 | SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0); |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 765 | std::unique_ptr<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx)); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 766 | test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage, |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 767 | std::move(fp)); |
Stephen White | 64dbb89 | 2017-05-03 16:00:38 -0400 | [diff] [blame] | 768 | test_path(ctx, rtc.get(), create_path_18()); |
Stephen White | 6eca90f | 2017-05-25 14:47:11 -0400 | [diff] [blame] | 769 | test_path(ctx, rtc.get(), create_path_19()); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 770 | test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage); |
| 771 | test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage); |
Stephen White | 3f5301b | 2017-08-15 17:01:15 -0400 | [diff] [blame] | 772 | test_path(ctx, rtc.get(), create_path_23()); |
Greg Daniel | 6888c0d | 2017-08-25 11:55:50 -0400 | [diff] [blame] | 773 | test_path(ctx, rtc.get(), create_path_24()); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 774 | test_path(ctx, rtc.get(), create_path_25(), SkMatrix(), GrAAType::kCoverage); |
| 775 | test_path(ctx, rtc.get(), create_path_26(), SkMatrix(), GrAAType::kCoverage); |
| 776 | test_path(ctx, rtc.get(), create_path_27(), SkMatrix(), GrAAType::kCoverage); |
| 777 | test_path(ctx, rtc.get(), create_path_28(), SkMatrix(), GrAAType::kCoverage); |
Stephen White | e40c361 | 2018-01-09 11:49:08 -0500 | [diff] [blame] | 778 | test_path(ctx, rtc.get(), create_path_29()); |
Stephen White | 20010e8 | 2018-03-28 14:41:22 -0400 | [diff] [blame] | 779 | test_path(ctx, rtc.get(), create_path_30()); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 780 | test_path(ctx, rtc.get(), create_path_31(), SkMatrix(), GrAAType::kCoverage); |
Stephen White | ec79c39 | 2018-05-18 11:49:21 -0400 | [diff] [blame] | 781 | test_path(ctx, rtc.get(), create_path_32()); |
Stephen White | 7b37694 | 2018-05-22 11:51:32 -0400 | [diff] [blame] | 782 | test_path(ctx, rtc.get(), create_path_33()); |
Stephen White | 53a0298 | 2018-05-30 22:47:46 -0400 | [diff] [blame] | 783 | test_path(ctx, rtc.get(), create_path_34()); |
| 784 | test_path(ctx, rtc.get(), create_path_35()); |
Stephen White | e62999f | 2018-06-05 18:45:07 -0400 | [diff] [blame] | 785 | test_path(ctx, rtc.get(), create_path_36()); |
Stephen White | 89042d5 | 2018-06-08 12:18:22 -0400 | [diff] [blame] | 786 | test_path(ctx, rtc.get(), create_path_37()); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 787 | test_path(ctx, rtc.get(), create_path_38(), SkMatrix(), GrAAType::kCoverage); |
Stephen White | 3de40f8 | 2018-06-28 09:36:49 -0400 | [diff] [blame] | 788 | test_path(ctx, rtc.get(), create_path_39()); |
Stephen White | 24289e0 | 2018-06-29 17:02:21 -0400 | [diff] [blame] | 789 | test_path(ctx, rtc.get(), create_path_40()); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 790 | test_path(ctx, rtc.get(), create_path_41(), SkMatrix(), GrAAType::kCoverage); |
Stephen White | 71ed661 | 2018-07-16 13:31:16 -0400 | [diff] [blame] | 791 | test_path(ctx, rtc.get(), create_path_42()); |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 792 | test_path(ctx, rtc.get(), create_path_43(), SkMatrix(), GrAAType::kCoverage); |
| 793 | test_path(ctx, rtc.get(), create_path_44(), SkMatrix(), GrAAType::kCoverage); |
| 794 | test_path(ctx, rtc.get(), create_path_45(), SkMatrix(), GrAAType::kCoverage); |
| 795 | test_path(ctx, rtc.get(), create_path_46(), SkMatrix(), GrAAType::kCoverage); |
senorblanco | d6ed19c | 2015-02-26 06:58:17 -0800 | [diff] [blame] | 796 | } |