1/* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8#ifndef GrXfermodeFragmentProcessor_DEFINED 9#define GrXfermodeFragmentProcessor_DEFINED 10 11#include "SkRefCnt.h" 12#include "SkBlendMode.h" 13 14class GrFragmentProcessor; 15 16namespace GrXfermodeFragmentProcessor { 17 18/** The color input to the returned processor is treated as the src and the passed in processor is 19 the dst. */ 20std::unique_ptr<GrFragmentProcessor> MakeFromDstProcessor(std::unique_ptr<GrFragmentProcessor> dst, 21 SkBlendMode mode); 22 23/** The color input to the returned processor is treated as the dst and the passed in processor is 24 the src. */ 25std::unique_ptr<GrFragmentProcessor> MakeFromSrcProcessor(std::unique_ptr<GrFragmentProcessor> src, 26 SkBlendMode mode); 27 28/** Takes the input color, which is assumed to be unpremultiplied, passes it as an opaque color 29 to both src and dst. The outputs of a src and dst are blended using mode and the original 30 input's alpha is applied to the blended color to produce a premul output. */ 31std::unique_ptr<GrFragmentProcessor> MakeFromTwoProcessors(std::unique_ptr<GrFragmentProcessor> src, 32 std::unique_ptr<GrFragmentProcessor> dst, 33 SkBlendMode mode); 34 35}; 36 37#endif 38