chromium/third_party/skia/src/gpu/ganesh/GrColor.h


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

#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/gpu/ganesh/GrTypes.h"
#include "include/private/SkColorData.h"
#include "src/base/SkHalf.h"
#include "src/gpu/BufferWriter.h"

/**
 * GrColor is 4 bytes for R, G, B, A, in a specific order defined below. Whether the color is
 * premultiplied or not depends on the context in which it is being used.
 */
GrColor;

// shift amount to assign a component to a GrColor int
// These shift values are chosen for compatibility with GL attrib arrays
// ES doesn't allow BGRA vertex attrib order so if they were not in this order
// we'd have to swizzle in shaders.
#ifdef SK_CPU_BENDIAN
    #define GrColor_SHIFT_R
    #define GrColor_SHIFT_G
    #define GrColor_SHIFT_B
    #define GrColor_SHIFT_A
#else
    #define GrColor_SHIFT_R
    #define GrColor_SHIFT_G
    #define GrColor_SHIFT_B
    #define GrColor_SHIFT_A
#endif

/**
 *  Pack 4 components (RGBA) into a GrColor int
 */
static inline GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a) {}

// extract a component (byte) from a GrColor int

#define GrColorUnpackR(color)
#define GrColorUnpackG(color)
#define GrColorUnpackB(color)
#define GrColorUnpackA(color)

/**
 *  Since premultiplied means that alpha >= color, we construct a color with
 *  each component==255 and alpha == 0 to be "illegal"
 */
#define GrColor_ILLEGAL

/** Normalizes and coverts an uint8_t to a float. [0, 255] -> [0.0, 1.0] */
static inline float GrNormalizeByteToFloat(uint8_t value) {}

/** Used to pick vertex attribute types. */
static inline bool SkPMColor4fFitsInBytes(const SkPMColor4f& color) {}

static inline uint64_t SkPMColor4f_toFP16(const SkPMColor4f& color) {}

#endif