From ff37ce9727daf09ff83eb0f96bc499a473bb7aa1 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Fri, 26 Aug 2022 10:07:06 -0400 Subject: [PATCH] Call isEmpty() instead of constructing a new object to compare A recent change in Skia (https://skia-review.googlesource.com/c/skia/+/573636) moves operator== into the cpp file, where this file cannot access it due to libhwui's map file. Call isEmpty, which is still in the header file, and skips unnecessary creation of a new object anyway. Bug: NA Test: AImageDecoderTest Change-Id: I1dec89a38e248138ace364e8cb7259eb777e8871 --- native/graphics/jni/imagedecoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/graphics/jni/imagedecoder.cpp b/native/graphics/jni/imagedecoder.cpp index cd6ed23916083..7fe2735c9ad62 100644 --- a/native/graphics/jni/imagedecoder.cpp +++ b/native/graphics/jni/imagedecoder.cpp @@ -381,7 +381,7 @@ int AImageDecoder_setCrop(AImageDecoder* decoder, ARect crop) { SkIRect cropIRect; cropIRect.setLTRB(crop.left, crop.top, crop.right, crop.bottom); - SkIRect* cropPtr = cropIRect == SkIRect::MakeEmpty() ? nullptr : &cropIRect; + SkIRect* cropPtr = cropIRect.isEmpty() ? nullptr : &cropIRect; return imageDecoder->setCropRect(cropPtr) ? ANDROID_IMAGE_DECODER_SUCCESS : ANDROID_IMAGE_DECODER_BAD_PARAMETER; }