Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 350141e1 authored by Michael Ludwig's avatar Michael Ludwig Committed by Android (Google) Code Review
Browse files

Merge "Check return value of SkRect::intersect()" into main

parents e4d969c1 dc1f09b8
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -722,10 +722,15 @@ void RecyclingClippingPixelAllocator::copyIfNecessary() {

            auto canvas = SkCanvas(recycledPixels->getSkBitmap());
            SkRect destination = SkRect::Make(recycledPixels->info().bounds());
            destination.intersect(SkRect::Make(mSkiaBitmap->info().bounds()));
            if (destination.intersect(SkRect::Make(mSkiaBitmap->info().bounds()))) {
                canvas.drawImageRect(mSkiaBitmap->asImage(), *mDesiredSubset, destination,
                                     SkSamplingOptions(SkFilterMode::kLinear), nullptr,
                                     SkCanvas::kFast_SrcRectConstraint);
            } else {
                // The canvas would have discarded the draw operation automatically, but
                // this case should have been detected before getting to this point.
                ALOGE("Copy destination does not intersect image bounds");
            }
        } else {
            void* dst = recycledPixels->pixels();
            const size_t dstRowBytes = mRecycledBitmap->rowBytes();