@@ -189,18 +189,23 @@ public void draw(Canvas canvas) {
189189 continue ;
190190 }
191191
192+ // We need paint for drawing (opacity animated) bitmaps and paths
193+ mDrawingPaint .setShader (null );
194+ mDrawingPaint .setAlpha (featureState .getAlpha ());
195+
196+ // Drawing bitmap
192197 final Bitmap backedImage = featureState .getBackedImageBitmap ();
193198 final Matrix uniqueFeatureMatrix = featureState .getUniqueFeatureMatrix ();
194199 if (backedImage != null && uniqueFeatureMatrix != null ) {
195200 // This block is for the experimental bitmap supporting
196201 canvas .save ();
197202 canvas .concat (mScaleMatrix );
198- canvas .drawBitmap (backedImage , uniqueFeatureMatrix , null );
199-
203+ canvas .drawBitmap (backedImage , uniqueFeatureMatrix , mDrawingPaint );
200204 canvas .restore ();
201205 continue ;
202206 }
203207
208+ // Drawing path
204209 pathToDraw = featureState .getCurrentPathForDrawing ();
205210 if (pathToDraw == null || pathToDraw .isEmpty ()) {
206211 continue ;
@@ -209,7 +214,6 @@ public void draw(Canvas canvas) {
209214 canvas .save ();
210215 applyScaleAndClipCanvas (canvas , featureState .getCurrentMaskPath (), Region .Op .INTERSECT );
211216 }
212- mDrawingPaint .setShader (null );
213217 mDrawingPaint .setStrokeCap (featureState .getStrokeLineCap ());
214218 if (featureState .getFillColor () != Color .TRANSPARENT ) {
215219 mDrawingPaint .setStyle (Paint .Style .FILL );
@@ -224,7 +228,6 @@ public void draw(Canvas canvas) {
224228 }
225229 if (featureState .getStrokeColor () != Color .TRANSPARENT && featureState .getStrokeWidth () > 0 ) {
226230 mDrawingPaint .setColor (featureState .getStrokeColor ());
227- mDrawingPaint .setAlpha (featureState .getAlpha ());
228231 mDrawingPaint .setStyle (Paint .Style .STROKE );
229232 mDrawingPaint .setStrokeWidth (
230233 featureState .getStrokeWidth () * mScale * mScaleFromCenter * mScaleFromEnd );
@@ -484,6 +487,7 @@ public void setupFeatureStateForProgress(float frameProgress) {
484487 if (layerTransformMatrix != null && !layerTransformMatrix .isIdentity ()) {
485488 mFeatureMatrix .postConcat (layerTransformMatrix );
486489 }
490+ mFeature .setOpacity (mOpacity , frameProgress );
487491 KeyFramedPath path = mFeature .getPath ();
488492 if (hasCustomDrawable () || path == null ) {
489493 return ; // skip all the path stuff
@@ -494,8 +498,8 @@ public void setupFeatureStateForProgress(float frameProgress) {
494498
495499 mFeature .setStrokeWidth (mStrokeWidth , frameProgress );
496500 mFeature .setStrokeColor (mStrokeColor , frameProgress );
501+ mFeature .setFillColor (mFillColor , frameProgress );
497502 mStrokeWidth .adjustScale (extractScaleFromMatrix (mFeatureMatrix ));
498- mFeature .setOpacity (mOpacity , frameProgress );
499503 if (mFeature .getEffect () != null ) {
500504 prepareShadersForFeature (mFeature );
501505 }
0 commit comments