Skip to content

Commit 55adc14

Browse files
committed
Adjust buffer position after copying
Make Bitmap.copyPixelsFromBuffer() adjust the buffer's position, making it consistent with Bitmap.copyPixelsToBuffer(). b/6948775 Change-Id: Ie26f8050b1fb4d19cd39ee1a08b6f652a732fec3
1 parent 0e2aade commit 55adc14

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

graphics/java/android/graphics/Bitmap.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ public void copyPixelsFromBuffer(Buffer src) {
413413
}
414414

415415
nativeCopyPixelsFromBuffer(mNativeBitmap, src);
416+
417+
// now update the buffer's position
418+
int position = src.position();
419+
position += bitmapBytes >> shift;
420+
src.position(position);
416421
}
417422

418423
/**

0 commit comments

Comments
 (0)