Skip to content
Snippets Groups Projects
Commit e80b7993 authored by Nicolas Roard's avatar Nicolas Roard
Browse files

Small refactor for reset buffer

Test: in main repository

Change-Id: I4d95899b9f49bc0973c63371b19739b56844aebc
parent 9720fee8
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