skia2/tools/RuntimeBlendUtils.h
John Stiles 126788e087 Simplify GetRuntimeBlendForBlendMode.
Now that we support sampling from an SkBlender inside a Runtime Effect,
we can leverage that to reuse the blends from SkBlender::Mode. This lets
us avoid hard-coding copies of every built-in blend function.

Change-Id: I51f380490611fbde943c16648999b4fd4e6a14a9
Bug: skia:12257, skia:12085
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434472
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-30 16:42:36 +00:00

25 lines
770 B
C++

/*
* Copyright 2021 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef RuntimeBlendUtils_DEFINED
#define RuntimeBlendUtils_DEFINED
#include "include/core/SkBlendMode.h"
#include "include/core/SkRefCnt.h"
class SkBlender;
/**
* Returns a Runtime Effect-based blender which is equivalent to the passed-in SkBlendMode.
* This should generate the same output as the equivalent SkBlendMode operation, but always uses
* SkSL to perform the blend operation instead of relying on specialized/fixed-function code.
* This is useful for verifying that Runtime Blends are working as expected throughout the pipeline.
*/
sk_sp<SkBlender> GetRuntimeBlendForBlendMode(SkBlendMode mode);
#endif