blob: 0c4c07d7041e7cfefe6a26f91c1a91f8d837ecc9 [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 <optional>
class SkReadBuffer;
class SkWriteBuffer;
enum class SkBlendMode;
struct SkStageRec;
class SkBlendModeBlender : public SkBlenderBase {
SkBlendModeBlender(SkBlendMode mode) : fMode(mode) {}
BlenderType type() const override { return BlenderType::kBlendMode; }
SkBlendMode mode() const { return fMode; }
using INHERITED = SkBlenderBase;
std::optional<SkBlendMode> asBlendMode() const final { return fMode; }
#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;