aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients/Sk4fGradientBase.cpp
Commit message (Collapse)AuthorAge
* Fuzzer assert in GradientShaderBase4fContext::TSamplerGravatar Florin Malita2016-11-29
| | | | | | | | | | | | | | | Similar to https://codereview.chromium.org/2472763002, we also need to clamp the tiled value in kRepeat mode, to avoid snapping to 1.0f. R=reed@google.com,herb@google.com BUG=skia:5975 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5079 Change-Id: I8fdac36c0d112d5eb76e47c3e4156a79a4d13b36 Reviewed-on: https://skia-review.googlesource.com/5079 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Fix fuzzer assert in GradientShaderBase4fContext::TSamplerGravatar fmalita2016-11-09
| | | | | | | | | | | | | | The arithmetic in tileProc<kMirror> may cause the result to snap to the open interval value - which violates invariants down the line. We need to clamp the result to nextafterf(2, 0) to ensure it stays less than two. BUG=skia:5913 R=reed@google.com,herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2472763002 Review-Url: https://codereview.chromium.org/2472763002
* Fix GradientShaderBase4fContext::Interval fuzzer assertGravatar fmalita2016-11-02
| | | | | | | | | | | | | Although the iterator ensures v0 != v1, 2 - v0 may still be equal to 2 - v1 for very small values due to limited float precision. We need to recheck the inequality to avoid triggering Interval asserts. BUG=skia:5903 R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2474463002 Review-Url: https://codereview.chromium.org/2474463002
* [Sk4fGradient] Use infinity floats for clamp-mode extreme positionsGravatar fmalita2016-10-21
| | | | | | | | | | | | | | | In clamp mode, we use a couple of synthetic edges that are supposed to extend to +/- infinity (-inf .. P0 and Pn .. inf). Currently we use SK_ScalarMin/Max, but these can be overrun with large/malicious inputs. Use SK_ScalarInfinity/SK_ScalarNegativeInfinity instead, and tweak compute_interval_props() to handle inf values gracefully. BUG=skia:5835 R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2441733002 Review-Url: https://chromiumcodereview.appspot.com/2441733002
* Faster 4f gradient premul pathGravatar fmalita2016-10-14
| | | | | | | | | | | | | | Similar to https://codereview.chromium.org/2409583003/, perform the premul in 4f. It turns out it's even faster to avoid the 255 load multiplication in this case. Also includes some template plumbing because DstTraits<>::load now needs to be premul-aware (previously it wasn't). R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2416233002 Review-Url: https://codereview.chromium.org/2416233002
* Harden degenerate gradient context handlingGravatar fmalita2016-10-05
| | | | | | | | | | | | | Certain inputs produce degenerate values at context creation time only. Detect such cases after context creation, and abort drawing by returning a null shader context instead. BUG=skia:5821 R=reed@google.com,brianosman@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2397473003 Review-Url: https://codereview.chromium.org/2397473003
* Observe gTreatSkColorAsSRGB for 4f gradients.Gravatar fmalita2016-04-15
| | | | | | | | | | Use SkColor4f::FromColor() in the color packer to convert srgb->linear when needed. R=reed@google.com,herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1890253002 Review URL: https://codereview.chromium.org/1890253002
* Refactor 4f gradients using trait templatesGravatar fmalita2016-03-21
| | | | | | | | | | | | | | | | Some 4f gradient housekeeping. 1) replace <DstPtrType, ColorProfile> specialization tuples with an enum covering all dest types (L32, S32, F16, F32) 2) group various template helpers into dest trait classes, specialized for each dest type (2a - conflate current dst_swizzle and scale_for_dest ops into one load op) R=reed@google.com,mtklein@google.com,herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1816883002 Review URL: https://codereview.chromium.org/1816883002
* 4f linear gradient shader blittersGravatar fmalita2016-03-18
| | | | | | | | | | | | Add F16 specializations to support writing to half-float dests. Add color profile template arg across the board to support writing to sRGB dests. R=reed@google.com,mtklein@google.com,herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1808963005 Review URL: https://codereview.chromium.org/1808963005
* Generic 4f gradient T sampler fallbackGravatar fmalita2016-03-10
| | | | | | | | | | | | | | | | | | | Add a generic T sampler fallback impl which uses T series produced by subclasses mapTs() overrides. The fallback path uses the same interval structures as the current optimized linear4f impl, but always sorted in stop order (never inverted to match dx/increasing x order). Enable the new mechanism for 4f linear w/ perspective. Other boring changes: * relocate the interval builder (back) to the base class * add a private header for shared templates BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1783823002 Review URL: https://codereview.chromium.org/1783823002
* Fix 4f gradient swizzle post http://crrev.com/1774523002Gravatar fmalita2016-03-08
| | | | | | | | | | | | * store interval colors in pm4f-natural/RGBA order * swizzle to dst order during interval advance Also remove an unused Interval ctor. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1770153002 Review URL: https://codereview.chromium.org/1770153002
* Relocate the specialized linear gradient interval builderGravatar fmalita2016-03-04
| | | | | | | | | | | | | The specialized interval setup works really well for (4f) linear gradients, but it seems unlikely to benefit other gradient subclasses. Since it gets in the way of a general/fallback gradient impl, let's move this code to Sk4fLinearGradient. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1764183002 Review URL: https://codereview.chromium.org/1764183002
* 4f gradient interval builder cleanupGravatar fmalita2016-03-02
| | | | | | | | | Untangle the builder, for hopefully improved readability. R=reed@google.com,mtklein@google.com,herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753853002 Review URL: https://codereview.chromium.org/1753853002
* 4f gradient negative-dx interval fixup for kMirror_TileModeGravatar fmalita2016-02-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | 4f intervals are meant to be monotonically increasing in X. This means we invert the point order when dx < 0: [0...1) -> (1...0] For kMirror_TileMode, we also append a duplicate/flipped interval sequence and expand the range to 2: [0...1) -> [0...1)[1...2) When dx < 0, the current logic yields (1...0] -> (1...0](2...1] which violates the interval monotonicity. To achieve the proper order, we need to swap the two halves: (1...0] -> (1...0](2...1] -> (2...1](1...0] R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1735773003 Review URL: https://codereview.chromium.org/1735773003
* Retire SkShader::kSupports4f_FlagGravatar fmalita2016-02-23
| | | | | | | | | | | No longer used except in one test. Introduce kPrefers4f_Flag instead. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1726983002 Review URL: https://codereview.chromium.org/1726983002
* Initial linear gradient 4f implGravatar fmalita2016-02-22
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1688543002 Review URL: https://codereview.chromium.org/1688543002