Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java

Issue 23677011: Byte-swap the video frame pixels before passing them to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
index bd2a25e9eb34fea296f997ea7f8d8e204213c5dd..872afcaf92ea2288bbcdc62f2b641b2e19b331c6 100644
--- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
@@ -142,6 +142,9 @@ public class JniInterface {
/** Screen height of the video feed. */
private static int sHeight = 0;
+ /** Bitmap holding the latest screen image. */
+ private static Bitmap sBitmap = null;
+
/** Buffer holding the video feed. */
private static ByteBuffer sBuffer = null;
@@ -310,12 +313,12 @@ public class JniInterface {
return null;
}
- int[] frame = new int[sWidth * sHeight];
-
- sBuffer.order(ByteOrder.LITTLE_ENDIAN);
- sBuffer.asIntBuffer().get(frame, 0, frame.length);
+ if (sBitmap == null || sBitmap.getWidth() != sWidth || sBitmap.getHeight() != sHeight) {
+ sBitmap = Bitmap.createBitmap(sWidth, sHeight, Bitmap.Config.ARGB_8888);
+ }
- return Bitmap.createBitmap(frame, 0, sWidth, sWidth, sHeight, Bitmap.Config.ARGB_8888);
+ sBitmap.copyPixelsFromBuffer(sBuffer);
+ return sBitmap;
}
/**
« no previous file with comments | « no previous file | remoting/client/rectangle_update_decoder.cc » ('j') | remoting/client/rectangle_update_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698