xref: /third_party/skia/src/core/SkBlendModePriv.h (revision cb93a386)
1/*
2 * Copyright 2016 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
8#ifndef SkBlendModePriv_DEFINED
9#define SkBlendModePriv_DEFINED
10
11#include "include/core/SkBlendMode.h"
12#include "include/core/SkColor.h"
13#include "include/private/SkColorData.h"
14
15class SkRasterPipeline;
16
17/**
18 *  Sentinel value for SkBlendMode enum.
19 *
20 *  Will never be a valid enum value, but will be storable in a byte.
21 */
22constexpr uint8_t kCustom_SkBlendMode = 0xFF;
23
24bool SkBlendMode_SupportsCoverageAsAlpha(SkBlendMode);
25
26static inline bool SkBlendMode_CaresAboutRBOrder(SkBlendMode mode) {
27    return (mode > SkBlendMode::kLastSeparableMode);
28}
29
30bool SkBlendMode_ShouldPreScaleCoverage(SkBlendMode, bool rgb_coverage);
31void SkBlendMode_AppendStages(SkBlendMode, SkRasterPipeline*);
32
33SkPMColor4f SkBlendMode_Apply(SkBlendMode, const SkPMColor4f& src, const SkPMColor4f& dst);
34
35#if SK_SUPPORT_GPU
36#include "src/gpu/GrXferProcessor.h"
37const GrXPFactory* SkBlendMode_AsXPFactory(SkBlendMode);
38#endif
39
40#endif
41