chromium/third_party/skia/src/core/SkPaintPriv.cpp

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

#include "src/core/SkPaintPriv.h"

#include "include/core/SkBlendMode.h"
#include "include/core/SkBlender.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkShader.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkDebug.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkPicturePriv.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkSafeRange.h"
#include "src/core/SkWriteBuffer.h"
#include "src/effects/colorfilters/SkColorFilterBase.h"
#include "src/shaders/SkColorFilterShader.h"
#include "src/shaders/SkShaderBase.h"

#include <cstdint>
#include <optional>

class SkColorSpace;

static bool changes_alpha(const SkPaint& paint) {}

enum SrcColorOpacity {};

static bool blend_mode_is_opaque(SkBlendMode mode, SrcColorOpacity opacityType) {}

bool SkPaintPriv::Overwrites(const SkPaint* paint, ShaderOverrideOpacity overrideOpacity) {}

bool SkPaintPriv::ShouldDither(const SkPaint& p, SkColorType dstCT) {}

// return true if the paint is just a single color (i.e. not a shader). If its
// a shader, then we can't compute a const luminance for it :(
static bool just_a_color(const SkPaint& paint, SkColor4f* color) {}

SkColor SkPaintPriv::ComputeLuminanceColor(const SkPaint& paint) {}

void SkPaintPriv::RemoveColorFilter(SkPaint* p, SkColorSpace* dstCS) {}

#ifdef SK_DEBUG
    static void ASSERT_FITS_IN(uint32_t value, int bitCount) {}
#else
    #define ASSERT_FITS_IN
#endif

enum FlatFlags {};

// SkPaint originally defined flags, some of which now apply to SkFont. These are renames
// of those flags, split into categories depending on which objects they (now) apply to.

template <typename T> uint32_t shift_bits(T value, unsigned shift, unsigned bits) {}

constexpr uint8_t CUSTOM_BLEND_MODE_SENTINEL =;

/*  Packing the paint
 flags :  8  // 2...
 blend :  8  // 30+
 cap   :  2  // 3
 join  :  2  // 3
 style :  2  // 3
 filter:  2  // 4
 flat  :  8  // 1...
 total : 32
 */
static uint32_t pack_v68(const SkPaint& paint, unsigned flatFlags) {}

static uint32_t unpack_v68(SkPaint* paint, uint32_t packed, SkSafeRange& safe) {}

/*  To save space/time, we analyze the paint, and write a truncated version of
    it if there are not tricky elements like shaders, etc.
 */
void SkPaintPriv::Flatten(const SkPaint& paint, SkWriteBuffer& buffer) {}

SkPaint SkPaintPriv::Unflatten(SkReadBuffer& buffer) {}