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

Unified Diff: webrtc/sdk/android/src/jni/native_handle_impl.cc

Issue 2976423002: Fix fromAndroidGraphicsMatrix to use column-major order for output. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/src/jni/native_handle_impl.cc
diff --git a/webrtc/sdk/android/src/jni/native_handle_impl.cc b/webrtc/sdk/android/src/jni/native_handle_impl.cc
index e2f3c9cd633882686503f85d2bafeaae204b5bbc..562e7ec6f80a71306844cf570406ae6f634c51a3 100644
--- a/webrtc/sdk/android/src/jni/native_handle_impl.cc
+++ b/webrtc/sdk/android/src/jni/native_handle_impl.cc
@@ -52,15 +52,20 @@ Matrix Matrix::fromAndroidGraphicsMatrix(JNIEnv* jni, jobject j_matrix) {
// [x2 y2 0 w2]
// [ 0 0 1 0]
// [x3 y3 0 w3]
+ // Since it is stored in column-major order, it looks like this:
+ // [x1 x2 0 x3
+ // y1 y2 0 y3
+ // 0 0 1 0
+ // w1 w2 0 w3]
matrix.elem_[0 * 4 + 0] = array_3x3_ptr[0 * 3 + 0];
- matrix.elem_[0 * 4 + 1] = array_3x3_ptr[0 * 3 + 1];
- matrix.elem_[0 * 4 + 3] = array_3x3_ptr[0 * 3 + 2];
- matrix.elem_[1 * 4 + 0] = array_3x3_ptr[1 * 3 + 0];
+ matrix.elem_[0 * 4 + 1] = array_3x3_ptr[1 * 3 + 0];
+ matrix.elem_[0 * 4 + 3] = array_3x3_ptr[2 * 3 + 0];
+ matrix.elem_[1 * 4 + 0] = array_3x3_ptr[0 * 3 + 1];
matrix.elem_[1 * 4 + 1] = array_3x3_ptr[1 * 3 + 1];
- matrix.elem_[1 * 4 + 3] = array_3x3_ptr[1 * 3 + 2];
+ matrix.elem_[1 * 4 + 3] = array_3x3_ptr[2 * 3 + 1];
matrix.elem_[2 * 4 + 2] = 1; // Z-scale should be 1.
- matrix.elem_[3 * 4 + 0] = array_3x3_ptr[2 * 3 + 0];
- matrix.elem_[3 * 4 + 1] = array_3x3_ptr[2 * 3 + 1];
+ matrix.elem_[3 * 4 + 0] = array_3x3_ptr[0 * 3 + 2];
+ matrix.elem_[3 * 4 + 1] = array_3x3_ptr[1 * 3 + 2];
matrix.elem_[3 * 4 + 3] = array_3x3_ptr[2 * 3 + 2];
return matrix;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698