aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBlendMode.cpp
Commit message (Collapse)AuthorAge
* gpu impl for compose and combine maskfiltersGravatar Mike Reed2018-02-05
| | | | | | | | | | | | remove "warning" in GrProcessorSet about coverage-as-alpha (we think the current behavior is correct) update gpudevice::drawImage to check for maskfilter before trying to create its mask Bug: skia: Change-Id: I9ecb6cd25dd003bc19fa1e33edf6614a5ba4acb7 Reviewed-on: https://skia-review.googlesource.com/103761 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Post-lerp -> pre-scale if blend mode supports it.Gravatar Mike Klein2017-09-18
| | | | | | | | | | | | | | | We've been doing this for Plus and SrcOver, and now expand it to the couple other blend modes like SrcATop and DstOver that also support this trick. We need to take some special care with rgb coverage, and continue to lerp for any mode that contains an explicit source-alpha term. This is explained in the comments. Change-Id: Ie44edf1504f305aec0c69fc92504431e0efeb627 Reviewed-on: https://skia-review.googlesource.com/47401 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* rework plus blend modeGravatar Mike Klein2017-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most interesting parts of this are how plus interacts with partial coverage. Plus needs its clamp to happen after the lerp. Luckily, some of its math folds away: d' = clamp[ d*(1-c) + (s+d)*c ] == clamp[ d - dc + sc + dc ] == clamp[ d + sc ] What's nice there is that coverage can be folded into the src term. This suggests that we can re-write the plus stage to clamp internally (and thus, be viable for 8-bit) if we always pre-scale with coverage. We don't have a way to pre-scale with 565 coverage until now, but it's only a step or two away from there. We can use the alternate formulation we derived for alpha for lerp_565, calculating the alpha coverage from red, green, and blue coverages _and_ the values of src and dst alpha. While we already pre-scale srcover today for 8-bit or constant coverage, we cannot do the same for 565. When evaluating the expression d' = s + (1-a)d we need the a term to be pre-scaled with red's coverage when calculating dr', with blue's when calculating db', etc. Essentially we need to carry around a bunch of extra values, and we've got no way to do that. So instead, we'll just carefully pre-scale plus with any coverage, and keep post-lerping srcover when we have 565 coverage. Change-Id: I7a7a52eec7d482e1b98bb8a01ea0a3d5e67bef65 Reviewed-on: https://skia-review.googlesource.com/38300 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Florin Malita <fmalita@chromium.org>
* convert over to 2d-modeGravatar Mike Klein2017-07-20
| | | | | | | | | | | | [√] convert all stages to use SkJumper_MemoryCtx / be 2d-compatible [√] convert compile to 2d also, remove 1d run/compile [√] convert all call sites [√] no diffs Change-Id: I3b806eb8fe0c3ec043359616409f7cd1211a1e43 Reviewed-on: https://skia-review.googlesource.com/24263 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
* attempt to fix compiler errorGravatar Mike Reed2017-06-10
| | | | | | | | | | | | | | | | | | | ../../third_party/skia/src/core/SkBlendMode.cpp: In function 'SkPM4f SkBlendMode_Apply(SkBlendMode, SkPM4f, SkPM4f)': ../../third_party/skia/src/core/SkBlendMode.cpp:133:1: error: unrecognizable insn: } ^ (insn 48 47 49 7 (set (reg:V4SF 112 [ D.89567 ]) (unspec:V4SF [ (mem/c:V4SF (reg/f:SI 104 virtual-incoming-args) [0 MEM[(const __builtin_neon_sf[4] *)&src]+0 S16 A32]) ] UNSPEC_VLD1)) /b/c/b/android/src/third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:8693 -1 (nil)) ../../third_party/skia/src/core/SkBlendMode.cpp:133:1: internal compiler error: in extract_insn, at recog.c:2202 Bug: skia: Change-Id: I85e98e858d00b8b505c6676e9a9dc762f0ccb25c Reviewed-on: https://skia-review.googlesource.com/19392 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* CanOverflow -> ClampIfNeededGravatar Mike Klein2017-06-09
| | | | | | | | | Centralize the clamping in ClampIfNeeded, and switch it to clamp_1. Change-Id: I056ac029d3ddc81e3f0f194f2b9c9924cad4caae Reviewed-on: https://skia-review.googlesource.com/19401 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Reed <reed@google.com>
* replace 4f procs with pipeline (only called in 2 places by ganesh)Gravatar Mike Reed2017-06-09
| | | | | | | | | | | enables lots of code to delete CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Bug: skia: Change-Id: I13631ead68a9232bd8c13c5ef54727f44def26ca Reviewed-on: https://skia-review.googlesource.com/19278 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Reed <reed@google.com>
* move Coeff into blendmodeGravatar Mike Reed2017-06-06
Bug: skia: Change-Id: Ib4f3398b0cdc6b0f575f6db80d2ce0bf9666f077 Reviewed-on: https://skia-review.googlesource.com/18843 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>