aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
Commit message (Collapse)AuthorAge
* Limit iterations when computing convex inset.Gravatar Jim Van Verth2018-06-19
| | | | | | | | | | | | | In the worst case we should compare each vertex in the polygon to the others just once, so we should have at worst n^2 iterations. Bug: skia:8079 Change-Id: Ic22064e86d6eb08d9165b2feb5050701ec8e9639 Reviewed-on: https://skia-review.googlesource.com/135865 Auto-Submit: Jim Van Verth <jvanverth@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
* SkAR: drawing text, shapes, rotation modes enabled, translating objectsGravatar ziadb2018-06-19
| | | | | | | | | | | | | | To run this app, you need to create an out directory as such: bin/gn gen out/arm64 --args='ndk="NDK_PATH" target_cpu="ABI"' For now, the only supported ABI is arm64 Change-Id: I012f0c6a0550d80a0028f42177d5ca72974d848d Bug: skia: Reviewed-on: https://skia-review.googlesource.com/130980 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ziad Ben Hadj-Alouane <ziadb@google.com>
* Fold SkJSON into Skia/utilsGravatar Florin Malita2018-06-19
| | | | | | | | | | | It's a tiny, core-ish component -- might as well treat as such to simplify dependencies. Change-Id: I6f31ce2d151f9a629d88bfc7f15d64891d5150c0 Reviewed-on: https://skia-review.googlesource.com/135780 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Stop using SkTSwap.Gravatar Ben Wagner2018-06-19
| | | | | | | | | | | | | Use std::swap instead. It does not appear that any external user specializes SkTSwap, but some may still use it. This removes all use in Skia so that SkTSwap can later be removed in a smaller CL. After that the <utility> include can be removed from SkTypes.h. Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753 Reviewed-on: https://skia-review.googlesource.com/135578 Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* remove SkTCastGravatar Mike Klein2018-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SkTCast is functionally equivalent to reinterpret_cast. The comment about SkTCast helping to avoid strict alising issues is not true. Dereferencing a pointer cast to a pointer of an unrelated type is always undefined, even if smuggled through a union like in SkTCast. To really avoid aliasing issues, you need to make a union[1] of the two value types, or better, memcpy between values. I've had to fix MatrixText.cpp where switching to reinterpret_cast actually let Clang notice and warn that we're exploiting undefined behavior, and GrSwizzle.h and SkCamera.cpp caught by GCC. I've switched SkTLList over to use SkAlignedSTStorage, which seems to help convince some GCC versions that fObj is used in a sound way. [1] The union punning trick is non-standard in C++, but GCC and MSVC both explicitly support it. I believe Clang does not officially explicitly support it, but probably does quietly for GCC compatibility. Change-Id: I71822e82c962f9aaac8be24d3c0f39f4f8b05026 Reviewed-on: https://skia-review.googlesource.com/134947 Commit-Queue: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Implement tilted concave ambient shadowGravatar Jim Van Verth2018-06-14
| | | | | | | | Bug: skia:7971 Change-Id: I6a92a5021f53ae10fb35ef355081653e96bc04b0 Reviewed-on: https://skia-review.googlesource.com/134844 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Revert "Revert "SkTypes: extract SkTo""Gravatar Hal Canary2018-06-14
| | | | | | | | | | | | | | | | This reverts commit fdcfb8b7c23fbf18f872d2c31d27978235033876. > Original change's description: > > SkTypes: extract SkTo > > > > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 > > Reviewed-on: https://skia-review.googlesource.com/133620 > > Reviewed-by: Mike Klein <mtklein@google.com> Change-Id: Ida74fbc5c21248a724a5edbf9fae18a33bcb23aa Reviewed-on: https://skia-review.googlesource.com/134506 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Add variable offset supportGravatar Jim Van Verth2018-06-14
| | | | | | | | Bug: skia:7970 Change-Id: I9dadf75f21e19ebe26f82643bcc47dd5794d8970 Reviewed-on: https://skia-review.googlesource.com/134421 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Add outline concave shadow supportGravatar Jim Van Verth2018-06-14
| | | | | | | | Bug: skia:7971 Change-Id: I97370b9c942c5e5f1e53ec15524bd2d20794d68c Reviewed-on: https://skia-review.googlesource.com/134328 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Revert "SkTypes: extract SkTo"Gravatar Hal Canary2018-06-13
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2a2f67592602b18527bc3fd449132d420cd5b62e. Reason for revert: this appears to be what is holding up the Chrome roll. Original change's description: > SkTypes: extract SkTo > > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 > Reviewed-on: https://skia-review.googlesource.com/133620 > Reviewed-by: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,halcanary@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae Reviewed-on: https://skia-review.googlesource.com/134504 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkTypes: more into SkMacrosGravatar Hal Canary2018-06-12
| | | | | | | | Change-Id: I4c9a2d81a1bc4ccebc78eea56c0de116b98d415e Reviewed-on: https://skia-review.googlesource.com/134330 Commit-Queue: Hal Canary <halcanary@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkTypes: extract SkToGravatar Hal Canary2018-06-12
| | | | | | Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 Reviewed-on: https://skia-review.googlesource.com/133620 Reviewed-by: Mike Klein <mtklein@google.com>
* More shadow tessellation cleanup.Gravatar Jim Van Verth2018-06-12
| | | | | | | | | | | | This change removes a lot of the unnecessary code that managed coincident and collinear vertices and set the winding direction. It also merges duplicate code when adding edges. Bug: skia:7971 Change-Id: I0397db93c1075e332c5aeb9ca0343bcbd9bb70eb Reviewed-on: https://skia-review.googlesource.com/133580 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* trim #include <new> from SkPostConfig.hGravatar Mike Klein2018-06-11
| | | | | | | Change-Id: I693ddcd4ade101ba4eb4102e03adce183aa1d672 Reviewed-on: https://skia-review.googlesource.com/133829 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* remove unused parts of SkTypes.hGravatar Mike Klein2018-06-08
| | | | | | | | | | | | | | | Lots of completely unused bits and bobs removed. I've decided SK_SUPPORT_UNITTEST and its single use are not very compelling. tests/CPlusPlusEleven was the only user of Sk32ToBool(), and no longer generally needed. Change-Id: I3ee75560f1e1e1cf5ad89ee7df8d7694b5dffdb3 Reviewed-on: https://skia-review.googlesource.com/133622 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* rebaseGravatar Cary Clark2018-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 32a4910e57b1fdd3c8671de1ee85e05ca21d079f. Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia Additionally some bookmaker changes take into account recent additions of typedef comments and the generated header comment. Original change's description: > Revert "remove toString" > > This reverts commit 5191880cbf3ee4d122b0d11b4945fbab0784fda7. > > Reason for revert: broke flutter > > Original change's description: > > remove toString > > > > toString may have been used by obsolete debugger only > > find out if that is so > > > > R=​brianosman@google.com,bsalomon@google.com > > > > Docs-Preview: https://skia.org/?cl=119894 > > Bug:830651 > > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd > > Reviewed-on: https://skia-review.googlesource.com/119894 > > Commit-Queue: Cary Clark <caryclark@google.com> > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c TBR=bsalomon@google.com,brianosman@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Reviewed-on: https://skia-review.googlesource.com/129623 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@google.com> Docs-Preview: https://skia.org/?cl=133583 Bug: 830651 Change-Id: If8499e796be63580ad419e150e94d43e8b89de1b Reviewed-on: https://skia-review.googlesource.com/133583 Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
* Consolidate ambient and spot code setup.Gravatar Jim Van Verth2018-06-05
| | | | | | | | | | | | Uses shared code to create a polygon version of the path, as well as computing the centroid and determining convexity. This makes things more consistent and sets up for creating concave ambient shadows. Bug: skia:7971 Change-Id: I3f36a423431361177ad9f53218b3ff0fdaa179e1 Reviewed-on: https://skia-review.googlesource.com/131585 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Avoid divide-by-zero in shadow codeGravatar Jim Van Verth2018-06-01
| | | | | | | | Bug: oss-fuzz:6728 Change-Id: Id87140c8ee3b4e438c0c1e7d9b108a40e2a65fbe Reviewed-on: https://skia-review.googlesource.com/131145 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* SkFloatToDecimal: optimize the less common cases.Gravatar Hal Canary2018-05-31
| | | | | | | | | | bench PDFScalar_random goes from 120 ns to 70 ns. Change-Id: I6254f5c900395ee470ffee26303915025a8f0dda Reviewed-on: https://skia-review.googlesource.com/131151 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Auto-Submit: Hal Canary <halcanary@google.com>
* Revert "Reland "remove toString""Gravatar Cary Clark2018-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 92e37b6d79f12ccfaaf7671413316952d182267d. Reason for revert: toString still used by flutter Original change's description: > Reland "remove toString" > > This reverts commit 32a4910e57b1fdd3c8671de1ee85e05ca21d079f. > > Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia > > Original change's description: > > Revert "remove toString" > > > > This reverts commit 5191880cbf3ee4d122b0d11b4945fbab0784fda7. > > > > Reason for revert: broke flutter > > > > Original change's description: > > > remove toString > > > > > > toString may have been used by obsolete debugger only > > > find out if that is so > > > > > > R=​brianosman@google.com,bsalomon@google.com > > > > > > Docs-Preview: https://skia.org/?cl=119894 > > > Bug:830651 > > > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd > > > Reviewed-on: https://skia-review.googlesource.com/119894 > > > Commit-Queue: Cary Clark <caryclark@google.com> > > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > > > Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: 830651 > > Reviewed-on: https://skia-review.googlesource.com/129340 > > Reviewed-by: Cary Clark <caryclark@google.com> > > Commit-Queue: Cary Clark <caryclark@google.com> > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: 830651 > Change-Id: Ida8725b6051132d8c46faf99358a8fcc1bcabf34 > Reviewed-on: https://skia-review.googlesource.com/129623 > Reviewed-by: Cary Clark <caryclark@skia.org> > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Cary Clark <caryclark@google.com> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org Change-Id: Iafc59ffc1b3db67c520ba31bf12d68e1b46c0ea2 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 830651 Reviewed-on: https://skia-review.googlesource.com/131082 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* Reland "remove toString"Gravatar Cary Clark2018-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 32a4910e57b1fdd3c8671de1ee85e05ca21d079f. Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia Original change's description: > Revert "remove toString" > > This reverts commit 5191880cbf3ee4d122b0d11b4945fbab0784fda7. > > Reason for revert: broke flutter > > Original change's description: > > remove toString > > > > toString may have been used by obsolete debugger only > > find out if that is so > > > > R=​brianosman@google.com,bsalomon@google.com > > > > Docs-Preview: https://skia.org/?cl=119894 > > Bug:830651 > > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd > > Reviewed-on: https://skia-review.googlesource.com/119894 > > Commit-Queue: Cary Clark <caryclark@google.com> > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 830651 > Reviewed-on: https://skia-review.googlesource.com/129340 > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Cary Clark <caryclark@google.com> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 830651 Change-Id: Ida8725b6051132d8c46faf99358a8fcc1bcabf34 Reviewed-on: https://skia-review.googlesource.com/129623 Reviewed-by: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* 3dGravatar Mike Reed2018-05-30
| | | | | | | | | Bug: skia: Change-Id: I10e56f08a2463fcac2b7813d43d0aae35268ac27 Reviewed-on: https://skia-review.googlesource.com/130842 Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Mike Reed <reed@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Remove SkTextBoxGravatar Herb Derby2018-05-22
| | | | | | | | Change-Id: I697135475fa9c1b7e803500b743f10c3877c1e10 Reviewed-on: https://skia-review.googlesource.com/129560 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Herb Derby <herb@google.com>
* remove defines and add commasGravatar Cary Clark2018-05-21
| | | | | | | | | | | | | | | | | | | | | | | | Preparation for generating bookmaker files for all remaining interfaces Standardize enum and enum classes by including a comma after the last entry. Replace flatten-related #define in public interfaces with their equivalent. The motivation is to give documentation something to refer to. An alternative would be to move part or all of this out of the public interface; something I can work on in a follow-up CL. R=reed@google.com,bsalomon@google.com Bug: skia:6898 Change-Id: I4b865f6ec3d8f5d31e50448fef7d2714510302f0 Reviewed-on: https://skia-review.googlesource.com/129312 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
* Revert "remove toString"Gravatar Cary Clark2018-05-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5191880cbf3ee4d122b0d11b4945fbab0784fda7. Reason for revert: broke flutter Original change's description: > remove toString > > toString may have been used by obsolete debugger only > find out if that is so > > R=​brianosman@google.com,bsalomon@google.com > > Docs-Preview: https://skia.org/?cl=119894 > Bug:830651 > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd > Reviewed-on: https://skia-review.googlesource.com/119894 > Commit-Queue: Cary Clark <caryclark@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 830651 Reviewed-on: https://skia-review.googlesource.com/129340 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* remove toStringGravatar Cary Clark2018-05-20
| | | | | | | | | | | | | | toString may have been used by obsolete debugger only find out if that is so R=brianosman@google.com,bsalomon@google.com Docs-Preview: https://skia.org/?cl=119894 Bug:830651 Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd Reviewed-on: https://skia-review.googlesource.com/119894 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Make SkStream readers report failure.Gravatar Ben Wagner2018-05-18
| | | | | | | | | | This also fixes an issue noticed while making this change where SkFontDescriptor improperly round trips negative axis values. Change-Id: Iacc5929a185659dcacc18c802c4908e4f34c6899 Reviewed-on: https://skia-review.googlesource.com/128341 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* check path bounds before trying to shadowGravatar Mike Reed2018-05-17
| | | | | | | | Bug: oss-fuzz:8331 Change-Id: Idbff0deb0b9968edf4b4fafd4cf497bbb71c64fa Reviewed-on: https://skia-review.googlesource.com/128550 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Merge duplicate umbra points in spot shadow.Gravatar Jim Van Verth2018-05-14
| | | | | | | | | | | | | | When we search for the closest umbra point at the end of the shadow creation process, we often find the umbra point we first added. Previously we would add this point again and patch up the result. This is causing issues with fixing the falloff, so this code handles this case better by reusing the original entry in fPositions. Bug: skia:6717 Change-Id: Ic44396f9430ecca8c67f06a6ffb37aae5a38c93b Reviewed-on: https://skia-review.googlesource.com/127964 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Shadow fixes to avoid popping.Gravatar Jim Van Verth2018-05-11
| | | | | | | | | | | * Make geometric shadow generation more tolerant of nearly-convex paths. * Ensure analytic and geometric shadow positions match with large blurs. Bug: skia: Change-Id: I8d3ba43b90d1520cb20f89de9f0b13d11a1a08c3 Reviewed-on: https://skia-review.googlesource.com/127045 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* make sure we don't set level-of-detail to zeroGravatar Mike Reed2018-05-09
| | | | | | | | Bug: oss-fuzz:8156 Change-Id: I37c7fd758e347b609410c40b74f702e38b95434e Reviewed-on: https://skia-review.googlesource.com/127048 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* check for huge cubics in patchutilsGravatar Mike Reed2018-05-02
| | | | | | | | Bug: oss-fuzz:6128 Change-Id: I4c7551ea2ac4e32dc96c93426846f5ddcd42a449 Reviewed-on: https://skia-review.googlesource.com/125440 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* Minor shadow fixes.Gravatar Jim Van Verth2018-04-24
| | | | | | | | | | | | | | | Fix inset value for analytic shadows to get full inset (and hence proper falloff). Fix compute_radial_values in tessellator to return only positive values and produce cleaner arcs. Adjust shadow params in Android sample to match Android. Fix corner calculation for analytic shadow. Bug: skia:7486 Change-Id: Ib393b5d577f5a5eb89d3388aa4726ea4dae37055 Reviewed-on: https://skia-review.googlesource.com/123220 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* SkBitSet: make movable.Gravatar Hal Canary2018-04-23
| | | | | | | | Change-Id: Iaf05d652b5bb8d99db3d51d1d9009e1de27ed7a3 Reviewed-on: https://skia-review.googlesource.com/123025 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Auto-Submit: Hal Canary <halcanary@google.com>
* Revert "Remove ambient clamp hack for analytic shadows."Gravatar Jim Van Verth2018-04-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d75b34394b5c53b0a5e8144dd28f956fbc8b90b2. Reason for revert: Breaking GMs Original change's description: > Remove ambient clamp hack for analytic shadows. > > The hack was added to make analytic ambient shadows match the geometric > ones exactly. Removing it does produce a slight difference, but it's > only visible at full black values (and then, only slightly) and this > makes room to pass a blend parameter for falloff. > > Also fixes an issue with filling out arcs in the shadow tesselator. > > Bug: skia:7486 > Change-Id: If78d0104df7e18f4320c1658af75576f6a4a8c73 > Reviewed-on: https://skia-review.googlesource.com/122580 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Jim Van Verth <jvanverth@google.com> TBR=jvanverth@google.com,bsalomon@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia:7486 Change-Id: If0a20a358759c08a3a475d60be54a3d62ff7b6ad Reviewed-on: https://skia-review.googlesource.com/123120 Reviewed-by: Jim Van Verth <jvanverth@google.com>
* Remove ambient clamp hack for analytic shadows.Gravatar Jim Van Verth2018-04-19
| | | | | | | | | | | | | | | The hack was added to make analytic ambient shadows match the geometric ones exactly. Removing it does produce a slight difference, but it's only visible at full black values (and then, only slightly) and this makes room to pass a blend parameter for falloff. Also fixes an issue with filling out arcs in the shadow tesselator. Bug: skia:7486 Change-Id: If78d0104df7e18f4320c1658af75576f6a4a8c73 Reviewed-on: https://skia-review.googlesource.com/122580 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* disallow negative setReserve() callsGravatar Mike Klein2018-04-19
| | | | | | | | | | | | | | | | We already assert that setCount()'s argument is non-negative. This does the same for setReserve(). There was one call site I could find that was actually sometimes passing negative values to setReserve(), guarded here. Already reviewed: https://skia-review.googlesource.com/c/skia/+/115982 Change-Id: Ia52a286732bf4056e9baf09555d27bab9abf2554 Reviewed-on: https://skia-review.googlesource.com/122305 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* clean up setReserve() rule-bendingGravatar Mike Klein2018-04-19
| | | | | | | | | | | | | | | | | | | | | | These routines call setReserve(N), write M<N items into the reserved memory, and then setCount(M) afterwards. That happens to function with SkTDArray's current implementation, but really breaks the spirit of what setReserve() means. This CL switches those setReserve() calls to setCount(). Calling setCount(N), writing M<N items, then setCount(M) should have the exact same effect, and be completely within the rules. Already reviewed here: https://skia-review.googlesource.com/c/skia/+/115982 Change-Id: I462479488055cf1c99de2bc6dbc1707dbe24db7e Reviewed-on: https://skia-review.googlesource.com/122301 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: Mike Klein <mtklein@chromium.org>
* Add initial support for simple concave shadows.Gravatar Jim Van Verth2018-04-10
| | | | | | | | | | | Adds support for spot shadow outlines. Since filling the penumbra still needs to be done, this code is disabled for now. Bug: skia: Change-Id: I3369eb13832b47ad16dd29ce7c7d6a1a10b39aeb Reviewed-on: https://skia-review.googlesource.com/22363 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* remove SK_IGNORE_TO_STRINGGravatar Cary Clark2018-04-05
| | | | | | | | | | | | | | | | | | | SK_IGNORE_TO_STRING is not defined anywhere. The same effect can be had by using a modern linker. Removing it simplifies bookmaker and makes our includes easier to understand. R=robertphillips@google.com TBR=reed@google.com Bug: skia:6898 Change-Id: Ib716f5ef1b42a7fbda0df43ece212d1b7c40289f Reviewed-on: https://skia-review.googlesource.com/118963 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* Add SkOffsetSimplePolygon.Gravatar Jim Van Verth2018-04-03
| | | | | | | | | | | Performs inset and outset operations on simple polygons and returns a simple polygon, if possible. Bug: skia: Change-Id: I6d468174ad70b5279b736c532e19cbb84ff9f955 Reviewed-on: https://skia-review.googlesource.com/116483 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Revert "implement SkTDArray with std::vector"Gravatar Mike Klein2018-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 80e1d56e198c5fd9fe6db0c945bd558053a8dc6a. Reason for revert: SkRTree.cpp:57 asserting, probably this? Original change's description: > implement SkTDArray with std::vector > > It's always worth seeing if we can get away with replacing custom data > structures with ones from the standard library. Our array-like types > are all good candidates to replace with std::vector, and it's especially > easy to start with SkTDArray. Unlike the others, it has no preallocated > S-variant, which is tricky to make work with std::vector. > > SkTDArray also has known integer overflow bugs, leading to out of range > writes. It'd be _very_ nice to ditch it for a better standard vector. > > I removed a bunch of unused or little-used methods, and updated a couple > call sites that used methods in unusual or dangerous ways. > > I've had to tweak GrAAConvexTessellator and SkBaseShadowTessellator just > a touch to work within the constraints of an std::vector impl. It's not > intended to be legal to write to the reserved-but-not-counted elements > of an SkTDArray, but you can get away with it in our old implementation. > This version now uses setCount() to actually reserve and count them, and > should have the same performance and use the same amount of memory. > > The PathMeasure_explosion GM I added recently to reproduce this bug now > draws without triggering undefined behavior or ASAN errors, provided you > have ~40GB of RAM. > > Bug: skia:7674 > > Change-Id: I4eacae18a976cd4a6d218102f8ca5d973d4d7d0e > Reviewed-on: https://skia-review.googlesource.com/115982 > Reviewed-by: Brian Osman <brianosman@google.com> > Commit-Queue: Mike Klein <mtklein@chromium.org> TBR=mtklein@chromium.org,bungeman@google.com,brianosman@google.com Change-Id: Icffd9f22fe89746a970ff598e1a05c774960bc0e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7674 Reviewed-on: https://skia-review.googlesource.com/117901 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkPDF/SkTypefaceMetrics: Set PostScript Name in Directwrite backend.Gravatar Hal Canary2018-04-02
| | | | | | | | | | | Also, clean up Freetype and Mac impls. Also, sk_get_locale_string returns an error value. Change-Id: If8dfc101e28a1d782679174fe6f5a28812563af5 Reviewed-on: https://skia-review.googlesource.com/117229 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* implement SkTDArray with std::vectorGravatar Mike Klein2018-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's always worth seeing if we can get away with replacing custom data structures with ones from the standard library. Our array-like types are all good candidates to replace with std::vector, and it's especially easy to start with SkTDArray. Unlike the others, it has no preallocated S-variant, which is tricky to make work with std::vector. SkTDArray also has known integer overflow bugs, leading to out of range writes. It'd be _very_ nice to ditch it for a better standard vector. I removed a bunch of unused or little-used methods, and updated a couple call sites that used methods in unusual or dangerous ways. I've had to tweak GrAAConvexTessellator and SkBaseShadowTessellator just a touch to work within the constraints of an std::vector impl. It's not intended to be legal to write to the reserved-but-not-counted elements of an SkTDArray, but you can get away with it in our old implementation. This version now uses setCount() to actually reserve and count them, and should have the same performance and use the same amount of memory. The PathMeasure_explosion GM I added recently to reproduce this bug now draws without triggering undefined behavior or ASAN errors, provided you have ~40GB of RAM. Bug: skia:7674 Change-Id: I4eacae18a976cd4a6d218102f8ca5d973d4d7d0e Reviewed-on: https://skia-review.googlesource.com/115982 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Rename SkInsetConvexPolygon to SkOffsetPolygon.Gravatar Jim Van Verth2018-03-28
| | | | | | | | | Prep for adding new offset routines. Change-Id: I261c22d9998e5ae4567b697c5f20a31f20777ac1 Reviewed-on: https://skia-review.googlesource.com/116800 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* change canvas-state to just record clip boundsGravatar Mike Reed2018-03-21
| | | | | | | | | | | | This reflects the long-standing restrictions in our clients (webview) and the reality of the gpu target which just uses scissors. It also removes one of the few callers of canvas::clipRegion, which we'd like to remove. Bug: skia: Change-Id: Ie3b3c6e8752f82cddef256f753000f9da4bdbdee Reviewed-on: https://skia-review.googlesource.com/113260 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Mike Reed <reed@google.com>
* move blur impl into coreGravatar Mike Reed2018-03-12
| | | | | | | | | | | | | | | | Ever since we added drawShadow to the public api, blurs have necessarily part of the core. This CL just formalizes that. This should also allow us to have builds that exclude all of /effects (for code size) and still be valid. Will follow-up with a change to deprecate SkBlurMaskFilter and SkBlurQuality (both no longer needed). Bug: skia: Change-Id: Ifbbd8b47a30a0386d215726b67bcf1e8b84fb8f5 Reviewed-on: https://skia-review.googlesource.com/113713 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* remove unused ConvertRadiusToSigma from SkBlurMaskFilterGravatar Mike Reed2018-03-12
| | | | | | | | Bug: skia: Change-Id: I1726f22fc40ad61b1b0485bcda6d383614da1fdb Reviewed-on: https://skia-review.googlesource.com/113463 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Remove SkDumpCanvasGravatar Brian Osman2018-03-10
| | | | | | | | Bug: skia: Change-Id: I045e84f154d0294121a4c1966dcf47c0d7e52934 Reviewed-on: https://skia-review.googlesource.com/113464 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Shim to enforce that canvas virtuals are overriddenGravatar Brian Osman2018-03-09
| | | | | | | | Change-Id: Iad70d449bbc43195baefd70d20c41996a8435e6e Reviewed-on: https://skia-review.googlesource.com/113320 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>