Skip to content
Snippets Groups Projects
Commit 3e1917f8 authored by Nicolas Roard's avatar Nicolas Roard Committed by Android (Google) Code Review
Browse files

Merge "Small refactor for reset buffer" into main

parents d6371ae6 e80b7993
No related branches found
No related tags found
No related merge requests found
......@@ -49,8 +49,13 @@ public class RemoteComposeBuffer {
this.mRemoteComposeState = remoteComposeState;
}
public void reset() {
mBuffer.reset();
/**
* Reset the internal buffers
*
* @param expectedSize provided hint for the main buffer size
*/
public void reset(int expectedSize) {
mBuffer.reset(expectedSize);
mRemoteComposeState.reset();
}
......@@ -288,8 +293,7 @@ public class RemoteComposeBuffer {
public static void read(InputStream fd, RemoteComposeBuffer buffer) {
try {
byte[] bytes = readAllBytes(fd);
buffer.reset();
buffer.mBuffer.resize(bytes.length);
buffer.reset(bytes.length);
System.arraycopy(bytes, 0, buffer.mBuffer.mBuffer, 0, bytes.length);
buffer.mBuffer.mSize = bytes.length;
} catch (Exception e) {
......
......@@ -83,10 +83,18 @@ public class WireBuffer {
mIndex = currentIndex;
}
public void reset() {
/**
* Reset the internal buffer
*
* @param expectedSize provided hint for the buffer size
*/
public void reset(int expectedSize) {
mIndex = 0;
mStartingIndex = 0;
mSize = 0;
if (expectedSize > mMaxSize) {
resize(expectedSize);
}
}
public int size() {
......
......@@ -33,7 +33,7 @@ public class BitmapData implements Operation {
int mImageWidth;
int mImageHeight;
byte[] mBitmap;
public static final int MAX_IMAGE_DIMENSION = 6000;
public static final int MAX_IMAGE_DIMENSION = 8000;
public static final Companion COMPANION = new Companion();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment