blob: 5a64da6f6eb4a4552f2b9a55d06c457a4dd41024 [file] [log] [blame]
* Copyright 2021 Google LLC
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
#ifndef SkBlendModeBlender_DEFINED
#define SkBlendModeBlender_DEFINED
#include "include/core/SkFlattenable.h"
#include "src/core/SkBlenderBase.h"
#include <memory>
#include <optional>
class GrFragmentProcessor;
class SkReadBuffer;
class SkWriteBuffer;
enum class SkBlendMode;
struct GrFPArgs;
struct SkStageRec;
class SkBlendModeBlender : public SkBlenderBase {
SkBlendModeBlender(SkBlendMode mode) : fMode(mode) {}
using INHERITED = SkBlenderBase;
std::optional<SkBlendMode> asBlendMode() const final { return fMode; }
#if defined(SK_GANESH)
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
std::unique_ptr<GrFragmentProcessor> srcFP,
std::unique_ptr<GrFragmentProcessor> dstFP,
const GrFPArgs& fpArgs) const override;
#if defined(SK_GRAPHITE)
void addToKey(const skgpu::graphite::KeyContext&,
skgpu::graphite::PipelineDataGatherer*) const override;
void flatten(SkWriteBuffer& buffer) const override;
bool onAppendStages(const SkStageRec& rec) const override;
#if defined(SK_ENABLE_SKVM)
skvm::Color onProgram(skvm::Builder* p, skvm::Color src, skvm::Color dst,
const SkColorInfo& colorInfo, skvm::Uniforms* uniforms,
SkArenaAlloc* alloc) const override;
SkBlendMode fMode;