Ensure detail textures are positioned at integer pixel coords
Change-Id: I4ffe64e009e465d310eea875f835522a40ffc825
diff --git a/carousel/java/com/android/ex/carousel/carousel.rs b/carousel/java/com/android/ex/carousel/carousel.rs
index 9b38a5e..83483f4 100644
--- a/carousel/java/com/android/ex/carousel/carousel.rs
+++ b/carousel/java/com/android/ex/carousel/carousel.rs
@@ -709,11 +709,11 @@
if (detailTextureAlignment & BELOW) {
screenCoord.y = min(screenCoordLeft.y, screenCoordRight.y);
} else if (detailTextureAlignment & CENTER_VERTICAL) {
- screenCoord.y -= rsAllocationGetDimY(cards[i].detailTexture) / 2.;
+ screenCoord.y -= round(rsAllocationGetDimY(cards[i].detailTexture) / 2.0f);
}
if (detailTextureAlignment & CENTER_HORIZONTAL) {
- screenCoord.x += (screenCoordRight.x - screenCoordLeft.x) / 2. -
- rsAllocationGetDimX(cards[i].detailTexture) / 2.;
+ screenCoord.x += round((screenCoordRight.x - screenCoordLeft.x) / 2.0f -
+ rsAllocationGetDimX(cards[i].detailTexture) / 2.0f);
}
// Compute alpha for gradually fading in details. Applied to both line and