26 return ((
unsigned)(
x | -
x)) >> 31;
35 return ((
unsigned)(
x -
max)) >> 31;
44 return (
x -
max) >> 31;
48static inline unsigned div255(
unsigned x) {
50 return x * ((1 << 24) / 255) >> 24;
64 int lz_dot8 = lz >> 8;
67 uint8_t* alpha = mask->
image();
68 uint8_t*
multiply = (uint8_t*)alpha + planeSize;
69 uint8_t* additive =
multiply + planeSize;
76 for (
int y = 0;
y <= maxy;
y++) {
79 for (
int x = 0;
x <= maxx;
x++) {
81 int ny = alpha[
x +
next_row] - alpha[
x - prev_row];
83 SkFixed numer = lx * nx + ly * ny + lz_dot_nz;
98 int hilite = (2 *
dot - lz_dot8) * lz_dot8 >> 8;
108 for (
int i = specular >> 4;
i > 0; --
i) {
109 add =
div255(add * hilite);
118 additive += rowBytes;
static int neq_to_one(int x, int max)
static int nonzero_to_one(int x)
static int neq_to_mask(int x, int max)
static unsigned div255(unsigned x)
#define SkScalarToFixed(x)
static int32_t SkSqrt32(int32_t n)
constexpr uint8_t SkToU8(S x)
static void Emboss(SkMaskBuilder *mask, const SkEmbossMaskFilter::Light &)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
Int96 multiply(int64_t a, int32_t b)
SINT T dot(const Vec< N, T > &a, const Vec< N, T > &b)
static void next_row(SkCanvas *canvas)
constexpr int32_t height() const
constexpr int32_t width() const
@ k3D_Format
3 8bit per pixl planes: alpha, mul, add
size_t computeImageSize() const