Avoid sampling outside BQ crop rect
The region outside of the BQ crop rect is potentially garbage. Avoid sampling from it. Fixes: 189656466 Bug: 193378020 Test: CTS PixelCopyTests & DecodeAccuracyTest Change-Id: I2910d93471f08aaf807ac9f87fdf84cf29cf4143 Merged-In: I2910d93471f08aaf807ac9f87fdf84cf29cf4143
This commit is contained in:
@@ -189,8 +189,10 @@ CopyResult Readback::copySurfaceInto(ANativeWindow* window, const Rect& inSrcRec
|
||||
if (srcRect.width() != bitmap->width() || srcRect.height() != bitmap->height()) {
|
||||
paint.setFilterQuality(kLow_SkFilterQuality);
|
||||
}
|
||||
canvas->drawImageRect(image, imageSrcRect, imageDstRect, &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, &paint, constraint);
|
||||
canvas->restore();
|
||||
|
||||
if (!tmpSurface->readPixels(*bitmap, 0, 0)) {
|
||||
|
||||
Reference in New Issue
Block a user