Added crop rect to LayerDrawable to not crop TextureView.
Verified manually with ExoPlayer that TextureView isn't cropping.
Test: Did the manual test and
atest TextureViewCameraTest
atest TextureViewSnapshotTest
atest TextureViewStressTest
atest TextureViewTest
atest PixelCopyTest
atest BitmapTest
atest HardwareBitmapTests
and with HwAccelerationTest
Added crop test at ag/15430851
BUG=152621633
Change-Id: If1f448a94908cbf51272bc0d1bbbe1e113fd15f3
diff --git a/libs/hwui/tests/common/TestUtils.cpp b/libs/hwui/tests/common/TestUtils.cpp
index e8ba15f..1bfdc47 100644
--- a/libs/hwui/tests/common/TestUtils.cpp
+++ b/libs/hwui/tests/common/TestUtils.cpp
@@ -74,7 +74,7 @@
layerUpdater->setTransform(&transform);
// updateLayer so it's ready to draw
- layerUpdater->updateLayer(true, SkMatrix::I(), nullptr);
+ layerUpdater->updateLayer(true, 0, SkRect::MakeEmpty(), nullptr);
return layerUpdater;
}
diff --git a/libs/hwui/tests/unit/DeferredLayerUpdaterTests.cpp b/libs/hwui/tests/unit/DeferredLayerUpdaterTests.cpp
index 955a5e7..ca84aee 100644
--- a/libs/hwui/tests/unit/DeferredLayerUpdaterTests.cpp
+++ b/libs/hwui/tests/unit/DeferredLayerUpdaterTests.cpp
@@ -36,19 +36,20 @@
EXPECT_EQ(0u, layerUpdater->backingLayer()->getHeight());
EXPECT_FALSE(layerUpdater->backingLayer()->getForceFilter());
EXPECT_FALSE(layerUpdater->backingLayer()->isBlend());
- EXPECT_EQ(Matrix4::identity(), layerUpdater->backingLayer()->getTexTransform());
// push the deferred updates to the layer
- SkMatrix scaledMatrix = SkMatrix::Scale(0.5, 0.5);
+ uint32_t textureTransform = 1;
SkBitmap bitmap;
bitmap.allocN32Pixels(16, 16);
+ SkRect cropRect = SkRect::MakeIWH(10, 10);
sk_sp<SkImage> layerImage = SkImage::MakeFromBitmap(bitmap);
- layerUpdater->updateLayer(true, scaledMatrix, layerImage);
+ layerUpdater->updateLayer(true, textureTransform, cropRect, layerImage);
// the backing layer should now have all the properties applied.
EXPECT_EQ(100u, layerUpdater->backingLayer()->getWidth());
EXPECT_EQ(100u, layerUpdater->backingLayer()->getHeight());
EXPECT_TRUE(layerUpdater->backingLayer()->getForceFilter());
EXPECT_TRUE(layerUpdater->backingLayer()->isBlend());
- EXPECT_EQ(scaledMatrix, layerUpdater->backingLayer()->getTexTransform());
+ EXPECT_EQ(textureTransform, layerUpdater->backingLayer()->getTextureTransform());
+ EXPECT_EQ(cropRect, layerUpdater->backingLayer()->getCropRect());
}