float sx = float(viewPort.width()) / viewBox.width();
float sy = float(viewPort.height()) / viewBox.height();
float scale = fmin(sx, sy);
- float tx = (viewPort.width() - viewBox.width() * scale) * 0.5;
- float ty = (viewPort.height() - viewBox.height() * scale) * 0.5;
+ float tx = (viewPort.width() - viewBox.width() * scale) * 0.5f;
+ float ty = (viewPort.height() - viewBox.height() * scale) * 0.5f;
VMatrix m;
m.translate(tx, ty).scale(scale, scale);
mLayerCNode->mClipPath.elmCount = 0;
mLayerCNode->name = name().c_str();
}
- if (complexContent()) mLayerCNode->mAlpha = combinedAlpha() * 255;
+ if (complexContent()) mLayerCNode->mAlpha = combinedAlpha() * 255.f;
mLayerCNode->mVisible = visible();
// update matte
if (hasMatte()) {
cNode->mPath.ptCount = pts.size();
cNode->mPath.elmPtr = elmPtr;
cNode->mPath.elmCount = elm.size();
- cNode->mAlpha = mask.mCombinedAlpha * 255;
+ cNode->mAlpha = mask.mCombinedAlpha * 255.0f;
switch (mask.maskMode()) {
case LOTMaskData::Mode::Add:
cNode->mMode = MaskAdd;
srcPainter.begin(&srcBitmap);
renderHelper(&srcPainter, inheritMask, matteRle);
srcPainter.end();
- painter->drawBitmap(VPoint(), srcBitmap, combinedAlpha() * 255);
+ painter->drawBitmap(VPoint(), srcBitmap, combinedAlpha() * 255.0f);
} else {
renderHelper(painter, inheritMask, matteRle);
}
static float getScale(const VMatrix &matrix)
{
- constexpr float SQRT_2 = 1.41421;
+ constexpr float SQRT_2 = 1.41421f;
VPointF p1(0, 0);
VPointF p2(SQRT_2, SQRT_2);
p1 = matrix.map(p1);
p2 = matrix.map(p2);
VPointF final = p2 - p1;
- return std::sqrt(final.x() * final.x() + final.y() * final.y()) / 2.0;
+ return std::sqrt(final.x() * final.x() + final.y() * final.y()) / 2.0f;
}
void LOTStrokeItem::updateRenderNode()
for (int i = 0; i < mDashArraySize; i++) mDashArray[i] *= scale;
/* AE draw the dash even if dash value is 0 */
- if (vCompare(mDashArray[0], 0.0f)) mDashArray[0] = 0.1;
+ if (vCompare(mDashArray[0], 0.0f)) mDashArray[0] = 0.1f;
mDrawable.setDashInfo(mDashArray, mDashArraySize);
}
{
float len = length();
float t = 1.0;
- const float error = 0.01;
+ const float error = 0.01f;
if (l > len || vCompare(l, len)) return t;
t *= 0.5;
if (fabs(lLen - l) < error) break;
if (lLen < l) {
- t += (lastBigger - t) * 0.5;
+ t += (lastBigger - t) * 0.5f;
} else {
lastBigger = t;
- t -= t * 0.5;
+ t -= t * 0.5f;
}
}
return t;
// p'(t) = 3 * (-(1-2t+t^2) * p0 + (1 - 4 * t + 3 * t^2) * p1 + (2 * t - 3 *
// t^2) * p2 + t^2 * p3)
- float m_t = 1. - t;
+ float m_t = 1.0f - t;
float d = t * t;
float a = -m_t * m_t;
inline void VBezier::split(VBezier *firstHalf, VBezier *secondHalf) const
{
- float c = (x2 + x3) * .5f;
- firstHalf->x2 = (x1 + x2) * .5f;
- secondHalf->x3 = (x3 + x4) * .5f;
+ float c = (x2 + x3) * 0.5f;
+ firstHalf->x2 = (x1 + x2) * 0.5f;
+ secondHalf->x3 = (x3 + x4) * 0.5f;
firstHalf->x1 = x1;
secondHalf->x4 = x4;
- firstHalf->x3 = (firstHalf->x2 + c) * .5f;
- secondHalf->x2 = (secondHalf->x3 + c) * .5f;
- firstHalf->x4 = secondHalf->x1 = (firstHalf->x3 + secondHalf->x2) * .5f;
+ firstHalf->x3 = (firstHalf->x2 + c) * 0.5f;
+ secondHalf->x2 = (secondHalf->x3 + c) * 0.5f;
+ firstHalf->x4 = secondHalf->x1 = (firstHalf->x3 + secondHalf->x2) * 0.5f;
c = (y2 + y3) / 2;
- firstHalf->y2 = (y1 + y2) * .5f;
- secondHalf->y3 = (y3 + y4) * .5f;
+ firstHalf->y2 = (y1 + y2) * 0.5f;
+ secondHalf->y3 = (y3 + y4) * 0.5f;
firstHalf->y1 = y1;
secondHalf->y4 = y4;
- firstHalf->y3 = (firstHalf->y2 + c) * .5f;
- secondHalf->y2 = (secondHalf->y3 + c) * .5f;
- firstHalf->y4 = secondHalf->y1 = (firstHalf->y3 + secondHalf->y2) * .5f;
+ firstHalf->y3 = (firstHalf->y2 + c) * 0.5f;
+ secondHalf->y2 = (secondHalf->y3 + c) * 0.5f;
+ firstHalf->y4 = secondHalf->y1 = (firstHalf->y3 + secondHalf->y2) * 0.5f;
}
V_END_NAMESPACE
green = (green * 255) / alpha;
blue = (blue * 255) / alpha;
}
- int luminosity = (0.299 * red + 0.587 * green + 0.114 * blue);
+ int luminosity = (0.299f * red + 0.587f * green + 0.114f * blue);
*pixel = luminosity << 24;
pixel++;
}
curr = start;
if (!curr->second.isOpaque()) alpha = true;
curColor = curr->second.premulARGB(opacity);
- incr = 1.0 / (float)size;
- fpos = 1.5 * incr;
+ incr = 1.0f / (float)size;
+ fpos = 1.5f * incr;
colorTable[pos++] = curColor;
#define SUBDIVISION_MAX_ITERATIONS 10
const float VInterpolator::kSampleStepSize =
- 1.0 / float(VInterpolator::kSplineTableSize - 1);
+ 1.0f / float(VInterpolator::kSplineTableSize - 1);
void VInterpolator::init(float aX1, float aY1, float aX2, float aY2)
{
float VInterpolator::GetSlope(float aT, float aA1, float aA2)
{
- return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
+ return 3.0f * A(aA1, aA2) * aT * aT + 2.0f * B(aA1, aA2) * aT + C(aA1);
}
float VInterpolator::value(float aX) const
int i = 0;
do {
- currentT = aA + (aB - aA) / 2.0;
+ currentT = aA + (aB - aA) / 2.0f;
currentX = CalcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0.0) {
x = x < 0 ? -x : x;
y = y < 0 ? -y : y;
- return (x > y ? x + 0.375 * y : y + 0.375 * x);
+ return (x > y ? x + 0.375f * y : y + 0.375f * x);
}
inline void VLine::splitAtLength(float lengthAt, VLine &left, VLine &right) const
inv = !vIsZero(m11);
inv &= !vIsZero(m22);
if (inv) {
- invert.m11 = 1. / m11;
- invert.m22 = 1. / m22;
+ invert.m11 = 1.0f / m11;
+ invert.m22 = 1.0f / m22;
invert.mtx = -mtx * invert.m11;
invert.mty = -mty * invert.m22;
}
vCompare(mtx, o.mtx) && vCompare(mty, o.mty);
}
-#define V_NEAR_CLIP 0.000001
+#define V_NEAR_CLIP 0.000001f
#ifdef MAP
#undef MAP
#endif
x = m11 * fx + m21 * fy + mtx;
y = m12 * fx + m22 * fy + mty;
if (t == MatrixType::Project) {
- float w = 1. / (m13 * fx + m23 * fy + m33);
+ float w = 1.0f / (m13 * fx + m23 * fy + m33);
x *= w;
y *= w;
}
float partialPointAmount = points - floorf(points);
bool longSegment = false;
size_t numPoints = size_t(ceilf(points) * 2);
- float angleDir = ((dir == VPath::Direction::CW) ? 1.0 : -1.0);
+ float angleDir = ((dir == VPath::Direction::CW) ? 1.0f : -1.0f);
bool hasRoundness = false;
innerRoundness /= 100.0f;
float y;
float anglePerPoint = 2.0f * K_PI / floorf(points);
size_t numPoints = size_t(floorf(points));
- float angleDir = ((dir == VPath::Direction::CW) ? 1.0 : -1.0);
+ float angleDir = ((dir == VPath::Direction::CW) ? 1.0f : -1.0f);
bool hasRoundness = false;
roundness /= 100.0f;