/** Blends the SkPaint's shader (or color if no shader) with a per-primitive color which must be setup as a vertex attribute using the specified SkXfermode::Mode. */ bool SkPaintToGrPaintWithXfermode(GrContext* context, const SkPaint& skPaint, const SkMatrix& viewM, SkXfermode::Mode primColorMode, bool primitiveIsSrc, GrPaint* grPaint) { return skpaint_to_grpaint_impl(context, skPaint, viewM, nullptr, &primColorMode, primitiveIsSrc, grPaint); }
/** Blends the SkPaint's shader (or color if no shader) with a per-primitive color which must be setup as a vertex attribute using the specified SkBlendMode. */ bool SkPaintToGrPaintWithXfermode(GrContext* context, const GrColorSpaceInfo& colorSpaceInfo, const SkPaint& skPaint, const SkMatrix& viewM, SkBlendMode primColorMode, GrPaint* grPaint) { return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, viewM, nullptr, &primColorMode, grPaint); }
/** Ignores the SkShader (if any) on skPaint. */ bool SkPaintToGrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrPaint* grPaint) { // Use a ptr to a nullptr to to indicate that the SkShader is ignored and not replaced. static const GrFragmentProcessor* kNullShaderFP = nullptr; static const GrFragmentProcessor** kIgnoreShader = &kNullShaderFP; return skpaint_to_grpaint_impl(context, skPaint, SkMatrix::I(), kIgnoreShader, nullptr, false, grPaint); }
/** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProcessor. */ bool SkPaintToGrPaintReplaceShader(GrContext* context, const SkPaint& skPaint, const GrFragmentProcessor* shaderFP, GrPaint* grPaint) { if (!shaderFP) { return false; } return skpaint_to_grpaint_impl(context, skPaint, SkMatrix::I(), &shaderFP, nullptr, false, grPaint); }
/** Ignores the SkShader (if any) on skPaint. */ bool SkPaintToGrPaintNoShader(GrContext* context, const GrColorSpaceInfo& colorSpaceInfo, const SkPaint& skPaint, GrPaint* grPaint) { // Use a ptr to a nullptr to to indicate that the SkShader is ignored and not replaced. static std::unique_ptr<GrFragmentProcessor> kNullShaderFP(nullptr); static std::unique_ptr<GrFragmentProcessor>* kIgnoreShader = &kNullShaderFP; return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, SkMatrix::I(), kIgnoreShader, nullptr, grPaint); }
/** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProcessor. */ bool SkPaintToGrPaintReplaceShader(GrContext* context, const GrColorSpaceInfo& colorSpaceInfo, const SkPaint& skPaint, std::unique_ptr<GrFragmentProcessor> shaderFP, GrPaint* grPaint) { if (!shaderFP) { return false; } return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, SkMatrix::I(), &shaderFP, nullptr, grPaint); }
bool SkPaintToGrPaint(GrContext* context, const SkPaint& skPaint, const SkMatrix& viewM, GrPaint* grPaint) { return skpaint_to_grpaint_impl(context, skPaint, viewM, nullptr, nullptr, false, grPaint); }
bool SkPaintToGrPaint(GrContext* context, const GrColorSpaceInfo& colorSpaceInfo, const SkPaint& skPaint, const SkMatrix& viewM, GrPaint* grPaint) { return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, viewM, nullptr, nullptr, grPaint); }