8#ifndef SkMaskGamma_DEFINED
9#define SkMaskGamma_DEFINED
64 for (
unsigned int i =
N;
i < 8;
i +=
N) {
83template <
int R_LUM_BITS,
int G_LUM_BITS,
int B_LUM_BITS>
class SkTMaskPreBlend;
116 for (
U8CPU i = 0;
i < (1 << MAX_LUM_BITS); ++
i) {
117 U8CPU lum = sk_t_scale255<MAX_LUM_BITS>(
i);
119 deviceConvert, deviceGamma);
146 *numTables = (1 << MAX_LUM_BITS);
155 return fIsLinear ? nullptr : (
const uint8_t*) fGammaTables;
159 static const int MAX_LUM_BITS =
160 B_LUM_BITS > (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS)
161 ? B_LUM_BITS : (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS);
162 uint8_t fGammaTables[1 << MAX_LUM_BITS][256];
181 const uint8_t* r,
const uint8_t* g,
const uint8_t*
b)
182 : fParent(std::move(parent)),
fR(r),
fG(g),
fB(
b) { }
185 friend class SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>;
195 : fParent(that.fParent),
fR(that.
fR),
fG(that.
fG),
fB(that.
fB) { }
207template <
int R_LUM_BITS,
int G_LUM_BITS,
int B_LUM_BITS>
229 return lut[component];
#define SkColorGetR(color)
#define SkColorGetG(color)
#define SkColorSetRGB(r, g, b)
#define SkColorGetB(color)
U8CPU sk_t_scale255< 4 >(U8CPU base)
static U8CPU sk_t_scale255(U8CPU base)
U8CPU sk_apply_lut_if< true >(U8CPU component, const uint8_t *lut)
U8CPU sk_t_scale255< 2 >(U8CPU base)
static U8CPU sk_apply_lut_if(U8CPU component, const uint8_t *)
U8CPU sk_t_scale255< 1 >(U8CPU base)
U8CPU sk_t_scale255< 8 >(U8CPU base)
void SkTMaskGamma_build_correcting_lut(uint8_t table[256], U8CPU srcI, SkScalar contrast, const SkColorSpaceLuminance &dstConvert, SkScalar dstGamma)
sk_sp< T > sk_ref_sp(T *obj)
#define SkScalarRoundToInt(x)
static constexpr bool SkToBool(const T &x)
static U8CPU computeLuminance(SkScalar gamma, SkColor c)
virtual SkScalar fromLuma(SkScalar gamma, SkScalar luma) const =0
virtual SkScalar toLuma(SkScalar gamma, SkScalar luminance) const =0
static const SkColorSpaceLuminance & Fetch(SkScalar gamma)
virtual ~SkColorSpaceLuminance()
SkTMaskGamma(SkScalar contrast, SkScalar deviceGamma)
void getGammaTableDimensions(int *tableWidth, int *numTables) const
PreBlend preBlend(SkColor color) const
static SkColor CanonicalColor(SkColor color)
const uint8_t * getGammaTables() const
SkTMaskPreBlend< R_LUM_BITS, G_LUM_BITS, B_LUM_BITS > PreBlend
SkTMaskPreBlend(const SkTMaskPreBlend< R_LUM_BITS, G_LUM_BITS, B_LUM_BITS > &that)
bool isApplicable() const
static float lum(float r, float g, float b)