/* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file.
*/
staticinlinebool SkScalarIsInt(SkScalar x) { return x == SkScalarFloorToScalar(x);
}
/** * Returns -1 || 0 || 1 depending on the sign of value: * -1 if x < 0 * 0 if x == 0 * 1 if x > 0
*/ staticinlineint SkScalarSignAsInt(SkScalar x) { return x < 0 ? -1 : (x > 0);
}
// Scalar result version of above staticinline SkScalar SkScalarSignAsScalar(SkScalar x) { return x < 0 ? -SK_Scalar1 : ((x > 0) ? SK_Scalar1 : 0);
}
/** Linearly interpolate between A and B, based on t. If t is 0, return A If t is 1, return B else interpolate. t must be [0..SK_Scalar1]
*/ staticinline SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t) {
SkASSERT(t >= 0 && t <= SK_Scalar1); return A + (B - A) * t;
}
/** Interpolate along the function described by (keys[length], values[length]) for the passed searchKey. SearchKeys outside the range keys[0]-keys[Length] clamp to the min or max value. This function assumes the number of pairs (length) will be small and a linear search is used.
Repeated keys are allowed for discontinuous functions (so long as keys is monotonically increasing). If key is the value of a repeated scalar in keys the first one will be used.
*/
SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[], const SkScalar values[], int length);
/* * Helper to compare an array of scalars.
*/ staticinlinebool SkScalarsEqual(const SkScalar a[], const SkScalar b[], int n) {
SkASSERT(n >= 0); for (int i = 0; i < n; ++i) { if (a[i] != b[i]) { returnfalse;
}
} returntrue;
}
#endif
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.