chromium/third_party/skia/src/gpu/graphite/PaintParams.h

/*
 * Copyright 2022 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef skgpu_graphite_PaintParams_DEFINED
#define skgpu_graphite_PaintParams_DEFINED

#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "src/gpu/graphite/Caps.h"
#include <functional>  // std::function

class SkColorInfo;
class SkShader;

namespace skgpu::graphite {

class DrawContext;
class KeyContext;
class PaintParamsKeyBuilder;
class PipelineDataGatherer;
class Recorder;
class TextureProxy;

// TBD: If occlusion culling is eliminated as a phase, we can easily move the paint conversion
// back to Device when the command is recorded (similar to SkPaint -> GrPaint), and then
// PaintParams is not required as an intermediate representation.
// NOTE: Only represents the shading state of an SkPaint. Style and complex effects (mask filters,
// image filters, path effects) must be handled higher up. AA is not tracked since everything is
// assumed to be anti-aliased.
class PaintParams {};

AddToKeyFn;

void Blend(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*,
           AddToKeyFn addBlendToKey, AddToKeyFn addSrcToKey, AddToKeyFn addDstToKey);
void Compose(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*,
             AddToKeyFn addInnerToKey, AddToKeyFn addOuterToKey);
// Add a fixed blend mode node for a specific SkBlendMode.
void AddFixedBlendMode(const KeyContext&,
                       PaintParamsKeyBuilder*,
                       PipelineDataGatherer*,
                       SkBlendMode);
// Add a blend mode node for an SkBlendMode that can vary
void AddBlendMode(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*, SkBlendMode);
void AddDstReadBlock(const KeyContext&,
                     PaintParamsKeyBuilder*,
                     PipelineDataGatherer*,
                     DstReadRequirement);
void AddDitherBlock(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*, SkColorType);

} // namespace skgpu::graphite

#endif // skgpu_PaintParams_DEFINED