From 26401e5f904e110a513f0b67af7ad6494107a96f Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 31 Mar 2012 13:30:11 -0400 Subject: [PATCH] Bug 740061. Remove support for subuploads. r=kats Since, the dirtyRect is either the size of the buffer or empty we don't need to support subuploads anymore. --- mobile/android/base/gfx/TileLayer.java | 39 ++------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/mobile/android/base/gfx/TileLayer.java b/mobile/android/base/gfx/TileLayer.java index c2b184cd233..52dd0ab9236 100644 --- a/mobile/android/base/gfx/TileLayer.java +++ b/mobile/android/base/gfx/TileLayer.java @@ -182,53 +182,18 @@ public abstract class TileLayer extends Layer { if (imageBuffer == null) return; - boolean newlyCreated = false; - if (mTextureIDs == null) { mTextureIDs = new int[1]; GLES20.glGenTextures(mTextureIDs.length, mTextureIDs, 0); - newlyCreated = true; } - IntSize bufferSize = mImage.getSize(); - Rect bufferRect = new Rect(0, 0, bufferSize.width, bufferSize.height); - int cairoFormat = mImage.getFormat(); CairoGLInfo glInfo = new CairoGLInfo(cairoFormat); bindAndSetGLParameters(); - if (newlyCreated || dirtyRect.contains(bufferRect)) { - GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, glInfo.internalFormat, mSize.width, - mSize.height, 0, glInfo.format, glInfo.type, imageBuffer); - return; - } - - // Make sure that the dirty region intersects with the buffer rect, - // otherwise we'll end up with an invalid buffer pointer. - if (!Rect.intersects(dirtyRect, bufferRect)) { - return; - } - - /* - * Upload the changed rect. We have to widen to the full width of the texture - * because we can't count on the device having support for GL_EXT_unpack_subimage, - * and going line-by-line is too slow. - * - * XXX We should still use GL_EXT_unpack_subimage when available. - */ - Buffer viewBuffer = imageBuffer.slice(); - int bpp = CairoUtils.bitsPerPixelForCairoFormat(cairoFormat) / 8; - int position = dirtyRect.top * bufferSize.width * bpp; - if (position > viewBuffer.limit()) { - Log.e(LOGTAG, "### Position outside tile! " + dirtyRect.top); - return; - } - - viewBuffer.position(position); - GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, dirtyRect.top, bufferSize.width, - Math.min(bufferSize.height - dirtyRect.top, dirtyRect.height()), - glInfo.format, glInfo.type, viewBuffer); + GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, glInfo.internalFormat, mSize.width, + mSize.height, 0, glInfo.format, glInfo.type, imageBuffer); } private void bindAndSetGLParameters() {