Tengo una función que toma un mapa de bits sin costura y lo desplaza por la pantalla en cualquier dirección usando coordenadas mundiales. Hay 4 sorteos (el área de juego es más pequeña que el tamaño completo del mapa de bits. Por lo tanto, como máximo, verá 4 copias del mapa de bits, solo secciones diferentes dibujadas para retener el efecto integrado). Lo que quiero saber es, ¿debo aplicar modificaciones a los límites rect para que solo se muestren las partes que debería en la pantalla? ¿O debería dejar que Android maneje eso? Y si lo hago yo mismo, ¿cómo debo manejar eso? El mundo coordina y traduce realmente me confunde, en lo que se refiere a las matemáticas. :/¿Debo confiar en Android para descartar los sorteos fuera de la pantalla?
Aquí está el código.
public void draw(Canvas canvas){
oCoords.x=(int) fX;
oCoords.y=(int) fY;
oTopLeft = gridContainingPoint(oCoords);
oTopRight.x = gridContainingPoint(oCoords).x + iWidth;
oTopRight.y = gridContainingPoint(oCoords).y;
oBottomLeft.x = gridContainingPoint(oCoords).x;
oBottomLeft.y = gridContainingPoint(oCoords).y + iHeight;
oBottomRight.x = gridContainingPoint(oCoords).x + iWidth;
oBottomRight.y = gridContainingPoint(oCoords).y + iHeight;
canvas.save();
canvas.translate(-fX, -fY);
oCloud.setBounds(oTopLeft.x, oTopLeft.y, oTopLeft.x + this.iImageWidth, oTopLeft.y + this.iImageHeight);
oCloud.draw(canvas);
oCloud.setBounds(oTopLeft.x + this.iImageWidth, oTopLeft.y, oTopLeft.x + (this.iImageWidth * 2), oTopLeft.y + this.iImageHeight);
oCloud.draw(canvas);
oCloud.setBounds(oTopLeft.x, oTopLeft.y + this.iImageHeight, oTopLeft.x + this.iImageWidth, oTopLeft.y + (this.iImageHeight * 2));
oCloud.draw(canvas);
oCloud.setBounds(oTopLeft.x + this.iImageWidth, oTopLeft.y + this.iImageHeight, oTopLeft.x + (this.iImageWidth * 2),oTopLeft.y + (this.iImageHeight * 2));
oCloud.draw(canvas);
canvas.restore();
}