weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-weex] lvfen commented on a change in pull request #2279: [Android] fix OP.REPLACE is not allow above api 26
Date Wed, 10 Apr 2019 08:25:56 GMT
lvfen commented on a change in pull request #2279: [Android] fix OP.REPLACE is not allow above
api 26
URL: https://github.com/apache/incubator-weex/pull/2279#discussion_r273842767

 File path: android/sdk/src/main/java/com/taobao/weex/utils/BoxShadowUtil.java
 @@ -399,7 +399,13 @@ public void draw(Canvas canvas) {
       Rect newRect = new Rect(bounds);
       // Make the Canvas Rect bigger according to the padding.
       newRect.inset(-paddingX * 2, -paddingY * 2);
-      canvas.clipRect(newRect, Region.Op.REPLACE);
+      // Region.Op.REPLACE is not allow above api 26
+      if (Build.VERSION.SDK_INT >= 26) {
+        canvas.clipRect(newRect);
 Review comment:
   Here is the android source code:
   `private static void checkValidClipOp(@NonNull Region.Op op) {
           if (sCompatiblityVersion >= Build.VERSION_CODES.P
                   && op != Region.Op.INTERSECT && op != Region.Op.DIFFERENCE)
               throw new IllegalArgumentException(
                       "Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed");
        * Modify the current clip with the specified rectangle.
        * @param rect The rect to intersect with the current clip
        * @param op How the clip is modified
        * @return true if the resulting clip is non-empty
        * @deprecated Region.Op values other than {@link Region.Op#INTERSECT} and
        * {@link Region.Op#DIFFERENCE} have the ability to expand the clip. The canvas clipping
        * are intended to only expand the clip as a result of a restore operation. This enables
a view
        * parent to clip a canvas to clearly define the maximal drawing area of its children.
        * recommended alternative calls are {@link #clipRect(RectF)} and {@link #clipOutRect(RectF)};
        * As of API Level API level {@value Build.VERSION_CODES#P} only {@link Region.Op#INTERSECT}
        * {@link Region.Op#DIFFERENCE} are valid Region.Op parameters.
       public boolean clipRect(@NonNull RectF rect, @NonNull Region.Op op) {
           return nClipRect(mNativeCanvasWrapper, rect.left, rect.top, rect.right, rect.bottom,

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message