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

Commit e9c97fcd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Avoid sampling outside BQ crop rect" into sc-dev am: 5c86f288 am: d4d62f58

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15283873

Change-Id: I2a41b848550f20e0260d9ef16827b9020aadec87
parents c9e7975a d4d62f58
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -183,8 +183,10 @@ CopyResult Readback::copySurfaceInto(ANativeWindow* window, const Rect& inSrcRec
    SkPaint paint;
    paint.setAlpha(255);
    paint.setBlendMode(SkBlendMode::kSrc);
    canvas->drawImageRect(image, imageSrcRect, imageDstRect, sampling, &paint,
                          SkCanvas::kFast_SrcRectConstraint);
    const bool hasBufferCrop = cropRect.left < cropRect.right && cropRect.top < cropRect.bottom;
    auto constraint =
            hasBufferCrop ? SkCanvas::kStrict_SrcRectConstraint : SkCanvas::kFast_SrcRectConstraint;
    canvas->drawImageRect(image, imageSrcRect, imageDstRect, sampling, &paint, constraint);
    canvas->restore();

    if (!tmpSurface->readPixels(*bitmap, 0, 0)) {