Update shadow tiling when page size changes

Without this patch, the shadows for the page get drawn with stale page heights
because the vertex buffers are not updated when the page height changes. With
the previous patch applied, this results in shadows extending down past the page
when they shouldn't.
This commit is contained in:
Doug Turner 2011-11-07 14:17:00 -08:00
parent 4fefbf7dd5
commit 12e8924064
4 changed files with 10 additions and 1 deletions

View File

@ -182,6 +182,7 @@ public class LayerController implements ScaleGestureDetector.OnScaleGestureListe
public void setPageSize(IntSize size) {
mPageSize = size.scale(getZoomFactor());
mView.notifyRendererOfPageSizeChange();
}
public boolean post(Runnable action) { return mView.post(action); }

View File

@ -142,6 +142,10 @@ public class LayerRenderer implements GLSurfaceView.Renderer {
gl.glDisable(GL10.GL_BLEND);
}
public void pageSizeChanged() {
mShadowLayer.recreateVertexBuffers();
}
private void setupPageTransform(GL10 gl) {
LayerController controller = mView.getController();
IntRect visibleRect = controller.getVisibleRect();

View File

@ -86,6 +86,10 @@ public class LayerView extends GLSurfaceView {
public LayerController getController() { return mController; }
public void geometryChanged() { /* TODO: Schedule a redraw. */ }
public void notifyRendererOfPageSizeChange() {
mRenderer.pageSizeChanged();
}
/** The LayerRenderer calls this to indicate that the window has changed size. */
public void setScreenSize(int width, int height) {
mController.setScreenSize(width, height);

View File

@ -101,7 +101,7 @@ public class NinePatchTileLayer extends TileLayer {
recreateVertexBuffers();
}
private void recreateVertexBuffers() {
public void recreateVertexBuffers() {
IntSize pageSize = mLayerController.getPageSize();
float[] sideVertices = {