|
29 | 29 | import android.graphics.Canvas; |
30 | 30 | import android.graphics.Color; |
31 | 31 | import android.graphics.ColorFilter; |
32 | | -import android.graphics.ComposeShader; |
33 | 32 | import android.graphics.DashPathEffect; |
34 | 33 | import android.graphics.Outline; |
35 | 34 | import android.graphics.Paint; |
36 | 35 | import android.graphics.Path; |
37 | 36 | import android.graphics.PathEffect; |
38 | 37 | import android.graphics.PixelFormat; |
39 | 38 | import android.graphics.PointF; |
40 | | -import android.graphics.PorterDuff; |
41 | 39 | import android.graphics.Rect; |
42 | 40 | import android.graphics.RectF; |
43 | 41 | import android.graphics.Region; |
44 | | -import android.graphics.Shader; |
45 | 42 | import android.graphics.drawable.Drawable; |
46 | 43 | import android.view.View; |
47 | 44 | import androidx.annotation.Nullable; |
|
55 | 52 | import com.facebook.react.uimanager.LengthPercentageType; |
56 | 53 | import com.facebook.react.uimanager.PixelUtil; |
57 | 54 | import com.facebook.react.uimanager.Spacing; |
58 | | -import com.facebook.react.uimanager.style.BackgroundImageLayer; |
59 | 55 | import com.facebook.react.uimanager.style.BorderRadiusProp; |
60 | 56 | import com.facebook.react.uimanager.style.BorderRadiusStyle; |
61 | 57 | import com.facebook.react.uimanager.style.BorderStyle; |
62 | 58 | import com.facebook.react.uimanager.style.ComputedBorderRadius; |
63 | 59 | import com.facebook.react.uimanager.style.CornerRadii; |
64 | | -import java.util.List; |
65 | 60 | import java.util.Locale; |
66 | 61 | import java.util.Objects; |
67 | 62 |
|
@@ -134,7 +129,6 @@ public class CSSBackgroundDrawable extends Drawable { |
134 | 129 | /* Used by all types of background and for drawing borders */ |
135 | 130 | private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); |
136 | 131 | private int mColor = Color.TRANSPARENT; |
137 | | - private @Nullable List<BackgroundImageLayer> mBackgroundImageLayers = null; |
138 | 132 | private int mAlpha = 255; |
139 | 133 |
|
140 | 134 | // There is a small gap between the edges of adjacent paths |
@@ -358,11 +352,6 @@ public void setColor(int color) { |
358 | 352 | invalidateSelf(); |
359 | 353 | } |
360 | 354 |
|
361 | | - public void setBackgroundImage(@Nullable List<BackgroundImageLayer> backgroundImageLayers) { |
362 | | - mBackgroundImageLayers = backgroundImageLayers; |
363 | | - invalidateSelf(); |
364 | | - } |
365 | | - |
366 | 355 | public int getColor() { |
367 | 356 | return mColor; |
368 | 357 | } |
@@ -414,13 +403,6 @@ private void drawRoundedBackgroundWithBorders(Canvas canvas) { |
414 | 403 | canvas.drawPath(Preconditions.checkNotNull(mBackgroundColorRenderPath), mPaint); |
415 | 404 | } |
416 | 405 |
|
417 | | - if (mBackgroundImageLayers != null && !mBackgroundImageLayers.isEmpty()) { |
418 | | - mPaint.setShader(getBackgroundImageShader()); |
419 | | - mPaint.setStyle(Paint.Style.FILL); |
420 | | - canvas.drawPath(Preconditions.checkNotNull(mBackgroundColorRenderPath), mPaint); |
421 | | - mPaint.setShader(null); |
422 | | - } |
423 | | - |
424 | 406 | final RectF borderWidth = getDirectionAwareBorderInsets(); |
425 | 407 | int colorLeft = getBorderColor(Spacing.LEFT); |
426 | 408 | int colorTop = getBorderColor(Spacing.TOP); |
@@ -1152,12 +1134,6 @@ private void drawRectangularBackgroundWithBorders(Canvas canvas) { |
1152 | 1134 | canvas.drawRect(getBounds(), mPaint); |
1153 | 1135 | } |
1154 | 1136 |
|
1155 | | - if (mBackgroundImageLayers != null && !mBackgroundImageLayers.isEmpty()) { |
1156 | | - mPaint.setShader(getBackgroundImageShader()); |
1157 | | - canvas.drawRect(getBounds(), mPaint); |
1158 | | - mPaint.setShader(null); |
1159 | | - } |
1160 | | - |
1161 | 1137 | final RectF borderWidth = getDirectionAwareBorderInsets(); |
1162 | 1138 |
|
1163 | 1139 | final int borderLeft = Math.round(borderWidth.left); |
@@ -1449,28 +1425,6 @@ public RectF getDirectionAwareBorderInsets() { |
1449 | 1425 | return new RectF(borderLeftWidth, borderTopWidth, borderRightWidth, borderBottomWidth); |
1450 | 1426 | } |
1451 | 1427 |
|
1452 | | - private @Nullable Shader getBackgroundImageShader() { |
1453 | | - if (mBackgroundImageLayers == null) { |
1454 | | - return null; |
1455 | | - } |
1456 | | - |
1457 | | - Shader compositeShader = null; |
1458 | | - for (BackgroundImageLayer backgroundImageLayer : mBackgroundImageLayers) { |
1459 | | - Rect bounds = getBounds(); |
1460 | | - Shader currentShader = backgroundImageLayer.getShader(bounds.width(), bounds.height()); |
1461 | | - if (currentShader == null) { |
1462 | | - continue; |
1463 | | - } |
1464 | | - if (compositeShader == null) { |
1465 | | - compositeShader = currentShader; |
1466 | | - } else { |
1467 | | - compositeShader = |
1468 | | - new ComposeShader(currentShader, compositeShader, PorterDuff.Mode.SRC_OVER); |
1469 | | - } |
1470 | | - } |
1471 | | - return compositeShader; |
1472 | | - } |
1473 | | - |
1474 | 1428 | /** |
1475 | 1429 | * Multiplies the color with the given alpha. |
1476 | 1430 | * |
|
0 commit comments