• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
14 class GrFragmentProcessor;
15 
16 namespace GrXfermodeFragmentProcessor {
17     /** The color input to the returned processor is treated as the src and the passed in processor
18         is the dst. */
19     sk_sp<GrFragmentProcessor> MakeFromDstProcessor(sk_sp<GrFragmentProcessor> dst,
20                                                     SkBlendMode mode);
21 
22     /** The color input to the returned processor is treated as the dst and the passed in processor
23         is the src. */
24     sk_sp<GrFragmentProcessor> MakeFromSrcProcessor(sk_sp<GrFragmentProcessor> src,
25                                                     SkBlendMode mode);
26 
27     /** Takes the input color, which is assumed to be unpremultiplied, passes it as an opaque color
28         to both src and dst. The outputs of a src and dst are blended using mode and the original
29         input's alpha is applied to the blended color to produce a premul output. */
30     sk_sp<GrFragmentProcessor> MakeFromTwoProcessors(sk_sp<GrFragmentProcessor> src,
31                                                      sk_sp<GrFragmentProcessor> dst,
32                                                      SkBlendMode mode);
33 };
34 
35 #endif
36