Ejemplo n.º 1
0
/*
 *  TODO: clean this guy up and possibly add to SkScalar.h
 */
static inline SkScalar SkScalarDecULP(SkScalar value) {
#if SK_SCALAR_IS_FLOAT
        return SkBits2Float(SkFloat2Bits(value) - 1);
#else
    #error "need impl for doubles"
#endif
}
Ejemplo n.º 2
0
void SkAppendScalar(SkString* str, SkScalar value, SkScalarAsStringType asType) {
    switch (asType) {
        case kHex_SkScalarAsStringType:
            str->appendf("SkBits2Float(0x%08x)", SkFloat2Bits(value));
            break;
        case kDec_SkScalarAsStringType: {
            SkString tmp;
            tmp.printf("%g", value);
            if (tmp.contains('.')) {
                tmp.appendUnichar('f');
            }
            str->append(tmp);
            break;
        }
    }
}
Ejemplo n.º 3
0
static bool isFinite_int(float x) {
    uint32_t bits = SkFloat2Bits(x);    // need unsigned for our shifts
    int exponent = bits << 1 >> 24;
    return exponent != 0xFF;
}