GrXfermodeFragmentProcessor.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #ifndef GrXfermodeFragmentProcessor_DEFINED
  8. #define GrXfermodeFragmentProcessor_DEFINED
  9. #include "include/core/SkBlendMode.h"
  10. #include "include/core/SkRefCnt.h"
  11. class GrFragmentProcessor;
  12. namespace GrXfermodeFragmentProcessor {
  13. /** The color input to the returned processor is treated as the src and the passed in processor is
  14. the dst. */
  15. std::unique_ptr<GrFragmentProcessor> MakeFromDstProcessor(std::unique_ptr<GrFragmentProcessor> dst,
  16. SkBlendMode mode);
  17. /** The color input to the returned processor is treated as the dst and the passed in processor is
  18. the src. */
  19. std::unique_ptr<GrFragmentProcessor> MakeFromSrcProcessor(std::unique_ptr<GrFragmentProcessor> src,
  20. SkBlendMode mode);
  21. /** Takes the input color, which is assumed to be unpremultiplied, passes it as an opaque color
  22. to both src and dst. The outputs of a src and dst are blended using mode and the original
  23. input's alpha is applied to the blended color to produce a premul output. */
  24. std::unique_ptr<GrFragmentProcessor> MakeFromTwoProcessors(std::unique_ptr<GrFragmentProcessor> src,
  25. std::unique_ptr<GrFragmentProcessor> dst,
  26. SkBlendMode mode);
  27. };
  28. #endif