798 {
799
800
801 if (layout == nullptr) {
802 return nullptr;
803 }
804
805
806
807 if (!overrideMatrix) {
809 }
810 bool success;
811 std::tie(success, layout) =
apply_matrix(std::move(layout), mRec, *overrideMatrix);
812 if (!success) {
813 return nullptr;
814 }
815
816
817
818
819
820
821
822
824 &shader,
args.fDstColorInfo->colorSpace(),
true);
826 const SkScalar* positions = xformedColors.fPositions;
827 const int colorCount = xformedColors.fColors.size();
828
829 bool allOpaque = true;
830 for (
int i = 0;
i < colorCount;
i++) {
832 allOpaque = false;
833 }
834 }
835
836
839
840 if (colorizer) {
841
842
845 xformedColors.fIntermediateColorSpace.get(),
847 allOpaque);
848 } else {
849
850
851
852
853
854
856 positions,
857 colorCount,
858 allOpaque,
860 xformedColors.fIntermediateColorSpace.get(),
861 args.fDstColorInfo->colorSpace(),
863 }
864
865 if (colorizer == nullptr) {
866 return nullptr;
867 }
868
869
870
871
872
873 std::unique_ptr<GrFragmentProcessor> gradient;
877 false, allOpaque);
878 break;
881 true, allOpaque);
882 break;
884
885
886
887
888
889
890
895
896 p.append(SkRasterPipelineOp::load_f32, &ctx);
899 &alloc,
900 allOpaque,
902 xformedColors.fIntermediateColorSpace.get(),
903 args.fDstColorInfo->colorSpace());
904 p.append(SkRasterPipelineOp::store_f32, &ctx);
906
908 borderColors[0], borderColors[1], allOpaque);
909 break;
910 }
912
913
916 false);
917 break;
918 }
919
920 return gradient;
921}
static std::unique_ptr< GrFragmentProcessor > make_clamped_gradient(std::unique_ptr< GrFragmentProcessor > colorizer, std::unique_ptr< GrFragmentProcessor > gradLayout, SkPMColor4f leftBorderColor, SkPMColor4f rightBorderColor, bool colorsAreOpaque)
static std::unique_ptr< GrFragmentProcessor > make_uniform_colorizer(const SkPMColor4f *colors, const SkScalar *positions, int count, bool premul, const GrFPArgs &args)
static std::unique_ptr< GrFragmentProcessor > make_tiled_gradient(const GrFPArgs &args, std::unique_ptr< GrFragmentProcessor > colorizer, std::unique_ptr< GrFragmentProcessor > gradLayout, bool mirror, bool colorsAreOpaque)
static std::unique_ptr< GrFragmentProcessor > make_interpolated_to_dst(std::unique_ptr< GrFragmentProcessor > gradient, const SkGradientShader::Interpolation &interpolation, SkColorSpace *intermediateColorSpace, const GrColorInfo &dstInfo, bool allOpaque)
static std::unique_ptr< GrFragmentProcessor > make_textured_colorizer(const SkPMColor4f *colors, const SkScalar *positions, int count, bool colorsAreOpaque, const SkGradientShader::Interpolation &interpolation, const SkColorSpace *intermediateColorSpace, const SkColorSpace *dstColorSpace, const GrFPArgs &args)
constexpr SkPMColor4f SK_PMColor4fTRANSPARENT
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
Interpolation fInterpolation
bool interpolateInPremul() const
static void AppendInterpolatedToDstStages(SkRasterPipeline *p, SkArenaAlloc *alloc, bool colorsAreOpaque, const Interpolation &interpolation, const SkColorSpace *intermediateColorSpace, const SkColorSpace *dstColorSpace)
const SkMatrix & getGradientMatrix() const
SkTileMode getTileMode() const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static GrFPResult apply_matrix(std::unique_ptr< GrFragmentProcessor > fp, const SkShaders::MatrixRec &rec, const SkMatrix &postInv)
PODArray< SkColor > colors