@@ -170,9 +170,10 @@ class DisplayList {
170170 }
171171
172172 void setAlpha (float alpha) {
173+ alpha = fminf (1 .0f , fmaxf (0 .0f , alpha));
173174 if (alpha != mAlpha ) {
174175 mAlpha = alpha;
175- mMultipliedAlpha = (int )(255 * alpha);
176+ mMultipliedAlpha = (int ) (255 * alpha);
176177 }
177178 }
178179
@@ -184,7 +185,7 @@ class DisplayList {
184185 if (translationX != mTranslationX ) {
185186 mTranslationX = translationX;
186187 mMatrixDirty = true ;
187- if (ALMOST_EQUAL ( mTranslationX , 0 ) && ALMOST_EQUAL ( mTranslationY , 0 ) ) {
188+ if (mTranslationX == 0 . 0f && mTranslationY == 0 . 0f ) {
188189 mMatrixFlags &= ~TRANSLATION;
189190 } else {
190191 mMatrixFlags |= TRANSLATION;
@@ -196,7 +197,7 @@ class DisplayList {
196197 if (translationY != mTranslationY ) {
197198 mTranslationY = translationY;
198199 mMatrixDirty = true ;
199- if (ALMOST_EQUAL ( mTranslationX , 0 ) && ALMOST_EQUAL ( mTranslationY , 0 ) ) {
200+ if (mTranslationX == 0 . 0f && mTranslationY == 0 . 0f ) {
200201 mMatrixFlags &= ~TRANSLATION;
201202 } else {
202203 mMatrixFlags |= TRANSLATION;
@@ -208,7 +209,7 @@ class DisplayList {
208209 if (rotation != mRotation ) {
209210 mRotation = rotation;
210211 mMatrixDirty = true ;
211- if (ALMOST_EQUAL ( mRotation , 0 ) ) {
212+ if (mRotation == 0 . 0f ) {
212213 mMatrixFlags &= ~ROTATION;
213214 } else {
214215 mMatrixFlags |= ROTATION;
@@ -220,7 +221,7 @@ class DisplayList {
220221 if (rotationX != mRotationX ) {
221222 mRotationX = rotationX;
222223 mMatrixDirty = true ;
223- if (ALMOST_EQUAL ( mRotationX , 0 ) && ALMOST_EQUAL ( mRotationY , 0 ) ) {
224+ if (mRotationX == 0 . 0f && mRotationY == 0 . 0f ) {
224225 mMatrixFlags &= ~ROTATION_3D;
225226 } else {
226227 mMatrixFlags |= ROTATION_3D;
@@ -232,7 +233,7 @@ class DisplayList {
232233 if (rotationY != mRotationY ) {
233234 mRotationY = rotationY;
234235 mMatrixDirty = true ;
235- if (ALMOST_EQUAL ( mRotationX , 0 ) && ALMOST_EQUAL ( mRotationY , 0 ) ) {
236+ if (mRotationX == 0 . 0f && mRotationY == 0 . 0f ) {
236237 mMatrixFlags &= ~ROTATION_3D;
237238 } else {
238239 mMatrixFlags |= ROTATION_3D;
@@ -244,7 +245,7 @@ class DisplayList {
244245 if (scaleX != mScaleX ) {
245246 mScaleX = scaleX;
246247 mMatrixDirty = true ;
247- if (ALMOST_EQUAL ( mScaleX , 1 ) && ALMOST_EQUAL ( mScaleY , 1 ) ) {
248+ if (mScaleX == 1 . 0f && mScaleY == 1 . 0f ) {
248249 mMatrixFlags &= ~SCALE;
249250 } else {
250251 mMatrixFlags |= SCALE;
@@ -267,7 +268,7 @@ class DisplayList {
267268 void setPivotX (float pivotX) {
268269 mPivotX = pivotX;
269270 mMatrixDirty = true ;
270- if (ALMOST_EQUAL ( mPivotX , 0 ) && ALMOST_EQUAL ( mPivotY , 0 ) ) {
271+ if (mPivotX == 0 . 0f && mPivotY == 0 . 0f ) {
271272 mMatrixFlags &= ~PIVOT;
272273 } else {
273274 mMatrixFlags |= PIVOT;
@@ -278,7 +279,7 @@ class DisplayList {
278279 void setPivotY (float pivotY) {
279280 mPivotY = pivotY;
280281 mMatrixDirty = true ;
281- if (ALMOST_EQUAL ( mPivotX , 0 ) && ALMOST_EQUAL ( mPivotY , 0 ) ) {
282+ if (mPivotX == 0 . 0f && mPivotY == 0 . 0f ) {
282283 mMatrixFlags &= ~PIVOT;
283284 } else {
284285 mMatrixFlags |= PIVOT;
0 commit comments