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
Родитель c783463c77
Коммит 2081db70d4
4 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -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); }

Просмотреть файл

@ -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();

Просмотреть файл

@ -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);

Просмотреть файл

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