skia2/include/effects
Mike Klein eea7c16d59 Add Matrix colorfilter pipeline stages.
This breaks the color filter down into a couple logical steps:
  - go to unpremul
  - apply the 4x5 matrix
  - clamp to [0,1]
  - go to premul

Because we already have handy premul clamp stages, we swap the order of clamp and premul.  This is lossless.

While adding our stages to the pipeline, we analyze the matrix to see if we can skip any steps:
  - we can skip unpremul if the shader is opaque (alphas are all 1 ~~~> we're already unpremul);
  - we can skip the premul back if the color filter always produces opaque (here, are the inputs opaque and do we keep them that way, but we could also check for an explicit 0 0 0 0 1 alpha row);
  - we can skip the clamp_0 if the matrix can never produce a value less than 0;
  - we can skip the clamp_1 if the matrix can never produce a value greater than 1.

The only thing that should seem missing is per-pixel alpha checks.  We don't do those here, but instead make up for it by operating on 4-8 pixels at a time.
We don't split the 4x5 matrix into a 4x4 and 1x4 translate.  We could, but when we have FMA (new x86, all ARMv8) we might as well work the translate for free into the FMAs.

This makes gm/fadefilter.cpp draw differently in sRGB and F16 modes, bringing them in line with the GPU sRGB and GPU f16 configs.  It's unclear to me what was wrong with the old CPU implementation.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4346
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Change-Id: I14082ded8fb8d63354167d9e6b3f8058f840253e
Reviewed-on: https://skia-review.googlesource.com/4346
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2016-11-03 15:49:24 +00:00
..
Sk1DPathEffect.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
Sk2DPathEffect.h Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )" 2016-03-18 11:22:57 -07:00
SkAlphaThresholdFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkArcToPathEffect.h Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )" 2016-03-18 11:22:57 -07:00
SkArithmeticMode.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkBlurDrawLooper.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkBlurImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkBlurMaskFilter.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkColorCubeFilter.h GrConstColorProcessor uses 4f colors in the destination space 2016-10-26 00:48:33 +00:00
SkColorFilterImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkColorMatrix.h Revert "Revert of impl colormatrix w/ floats (patchset #7 id:120001 of https://codereview.chromium.org/967943002/)" 2015-03-24 04:13:45 -07:00
SkColorMatrixFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkComposeImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkCornerPathEffect.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkDashPathEffect.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkDiscretePathEffect.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkDisplacementMapEffect.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkDropShadowImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkEmbossMaskFilter.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkGammaColorFilter.h GrConstColorProcessor uses 4f colors in the destination space 2016-10-26 00:48:33 +00:00
SkGaussianEdgeShader.h Remove old SkGaussianEdgeShader code 2016-09-16 09:13:15 -07:00
SkGradientShader.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkImageSource.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkLayerDrawLooper.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkLayerRasterizer.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00
SkLightingImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkLumaColorFilter.h Add Matrix colorfilter pipeline stages. 2016-11-03 15:49:24 +00:00
SkMagnifierImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkMatrixConvolutionImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkMergeImageFilter.h remove xfermode from public api 2016-10-28 20:06:17 +00:00
SkMorphologyImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkOffsetImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkPaintFlagsDrawFilter.h C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
SkPaintImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkPerlinNoiseShader.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkPictureImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkRRectsGaussianEdgeMaskFilter.h Add SkRRectsGaussianEdgeMaskFilter 2016-10-20 14:06:52 +00:00
SkShadowMaskFilter.h Add SkShadowMaskFilter 2016-10-31 20:29:30 +00:00
SkTableColorFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkTableMaskFilter.h Revert of remove unused TableMaskFilter (patchset #1 id:1 of https://codereview.chromium.org/2156463002/ ) 2016-07-18 08:18:51 -07:00
SkTileImageFilter.h remove 4 legacy flags (clients already updated) 2016-10-20 21:08:50 +00:00
SkXfermodeImageFilter.h remove lots of legacy flags 2016-10-31 19:35:15 +00:00