Bug 803613 - Minor code cleanup. r=blassey
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 22 Oct 2012 10:14:44 -0400
changeset 111162 666a61b83149deb6aa89198e1f1098871b9e925c
parent 111161 e4fa894b7348ffcc43bd3373f0f04cf03c075bd9
child 111163 ad3b66486ce34ebe0bd9d4ee18fd0afe1ee7d3e2
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersblassey
bugs803613
milestone19.0a1
Bug 803613 - Minor code cleanup. r=blassey
mobile/android/base/gfx/ScreenshotLayer.java
--- a/mobile/android/base/gfx/ScreenshotLayer.java
+++ b/mobile/android/base/gfx/ScreenshotLayer.java
@@ -131,39 +131,38 @@ public class ScreenshotLayer extends Sin
             // clamp stuff just to be safe
             start = Math.max(0, Math.min(dst.limit(), Math.min(src.limit(), start)));
             end = Math.max(start, Math.min(dst.limit(), Math.min(src.capacity(), end)));
             dst.position(start);
             src.position(start).limit(end);
             // This allocates a lot of memory and can fail sometimes. Handling the
             // exception is better than crashing.
             try {
-              dst.put(src);
-            } catch (java.lang.OutOfMemoryError e) {}
+                dst.put(src);
+            } catch (OutOfMemoryError e) {
+            }
         }
 
         synchronized void setBitmap(ByteBuffer data, int width, int height, int format, Rect rect) {
             if (mBuffer == null) {
                 return;
             }
             mSize = new IntSize(width, height);
             mFormat = format;
             copyBuffer(data.asReadOnlyBuffer(), mBuffer.duplicate(), rect, width * BYTES_FOR_16BPP);
         }
 
         synchronized void setBitmap(Bitmap bitmap, int width, int height, int format) throws IllegalArgumentException {
             if (mBuffer == null) {
                 return;
             }
-            Bitmap tmp;
             mSize = new IntSize(width, height);
             mFormat = format;
             if (width == bitmap.getWidth() && height == bitmap.getHeight()) {
-                tmp = bitmap;
-                tmp.copyPixelsToBuffer(mBuffer.asIntBuffer());
+                bitmap.copyPixelsToBuffer(mBuffer.asIntBuffer());
             } else {
                 throw new IllegalArgumentException("### unexpected size in setBitmap: w="+width+" h="+height);
             }
         }
 
         @Override
         synchronized public ByteBuffer getBuffer() { return mBuffer; }
         @Override