From commits-return-18306-archive-asf-public=cust-asf.ponee.io@weex.incubator.apache.org Wed Apr 10 08:25:57 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id D0AC2180626 for ; Wed, 10 Apr 2019 10:25:56 +0200 (CEST) Received: (qmail 89757 invoked by uid 500); 10 Apr 2019 08:25:56 -0000 Mailing-List: contact commits-help@weex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@weex.incubator.apache.org Delivered-To: mailing list commits@weex.incubator.apache.org Received: (qmail 89745 invoked by uid 99); 10 Apr 2019 08:25:56 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Apr 2019 08:25:56 +0000 From: GitBox To: commits@weex.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 Message-ID: <155488475611.5071.1044526819691275537.gitbox@gitbox.apache.org> Date: Wed, 10 Apr 2019 08:25:56 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 APIs * 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. The * 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} and * {@link Region.Op#DIFFERENCE} are valid Region.Op parameters. */ @Deprecated public boolean clipRect(@NonNull RectF rect, @NonNull Region.Op op) { checkValidClipOp(op); return nClipRect(mNativeCanvasWrapper, rect.left, rect.top, rect.right, rect.bottom, op.nativeInt); }` ---------------------------------------------------------------- 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: users@infra.apache.org With regards, Apache Git Services