Commit 78de919
committed
Improve the Pattern-detection in
The vast majority of the time, unless a Pattern is active, the `strokeColor`-property contains a "simple" colour value represented by a String. Hence it seems somewhat ridiculous to do a `hasOwnProperty` check on a String, and it's should thus be possible to improve things a tiny bit here.
Unfortunately using a simple `instanceof` check would only work for `TilingPattern`s, but not for the `ShadingIRs` given how they are implemented; see `src/display/pattern_helper.js`. (While that file could probably do with some clean-up, given the age of some of its code, that probably shouldn't happen here.)
Finally, the `this.type = "Pattern"`-property of the various Shadings/TilingPatterns were removed, since I cannot see why it's necessary when we can simply check for a `getPattern` method instead. Note that part of this code even pre-dates the main/worker-thread split, which probably in part explains why it looks the way it does.CanvasGraphics.stroke
1 parent be0794c commit 78de919
2 files changed
+1
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1350 | 1350 | | |
1351 | 1351 | | |
1352 | 1352 | | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
| 1353 | + | |
1358 | 1354 | | |
1359 | 1355 | | |
1360 | 1356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
340 | 339 | | |
341 | 340 | | |
342 | 341 | | |
343 | | - | |
344 | 342 | | |
345 | 343 | | |
346 | 344 | | |
| |||
390 | 388 | | |
391 | 389 | | |
392 | 390 | | |
393 | | - | |
394 | 391 | | |
395 | 392 | | |
396 | 393 | | |
| |||
429 | 426 | | |
430 | 427 | | |
431 | 428 | | |
432 | | - | |
433 | 429 | | |
434 | 430 | | |
435 | 431 | | |
| |||
0 commit comments