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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 memset(matrix.elem_, 0, sizeof(matrix.elem_)); 45 memset(matrix.elem_, 0, sizeof(matrix.elem_));
46 // The android.graphics.Matrix looks like this: 46 // The android.graphics.Matrix looks like this:
47 // [x1 y1 w1] 47 // [x1 y1 w1]
48 // [x2 y2 w2] 48 // [x2 y2 w2]
49 // [x3 y3 w3] 49 // [x3 y3 w3]
50 // We want to contruct a matrix that looks like this: 50 // We want to contruct a matrix that looks like this:
51 // [x1 y1 0 w1] 51 // [x1 y1 0 w1]
52 // [x2 y2 0 w2] 52 // [x2 y2 0 w2]
53 // [ 0 0 1 0] 53 // [ 0 0 1 0]
54 // [x3 y3 0 w3] 54 // [x3 y3 0 w3]
55 // Since it is stored in column-major order, it looks like this:
56 // [x1 x2 0 x3
57 // y1 y2 0 y3
58 // 0 0 1 0
59 // w1 w2 0 w3]
55 matrix.elem_[0 * 4 + 0] = array_3x3_ptr[0 * 3 + 0]; 60 matrix.elem_[0 * 4 + 0] = array_3x3_ptr[0 * 3 + 0];
56 matrix.elem_[0 * 4 + 1] = array_3x3_ptr[0 * 3 + 1]; 61 matrix.elem_[0 * 4 + 1] = array_3x3_ptr[1 * 3 + 0];
57 matrix.elem_[0 * 4 + 3] = array_3x3_ptr[0 * 3 + 2]; 62 matrix.elem_[0 * 4 + 3] = array_3x3_ptr[2 * 3 + 0];
58 matrix.elem_[1 * 4 + 0] = array_3x3_ptr[1 * 3 + 0]; 63 matrix.elem_[1 * 4 + 0] = array_3x3_ptr[0 * 3 + 1];
59 matrix.elem_[1 * 4 + 1] = array_3x3_ptr[1 * 3 + 1]; 64 matrix.elem_[1 * 4 + 1] = array_3x3_ptr[1 * 3 + 1];
60 matrix.elem_[1 * 4 + 3] = array_3x3_ptr[1 * 3 + 2]; 65 matrix.elem_[1 * 4 + 3] = array_3x3_ptr[2 * 3 + 1];
61 matrix.elem_[2 * 4 + 2] = 1; // Z-scale should be 1. 66 matrix.elem_[2 * 4 + 2] = 1; // Z-scale should be 1.
62 matrix.elem_[3 * 4 + 0] = array_3x3_ptr[2 * 3 + 0]; 67 matrix.elem_[3 * 4 + 0] = array_3x3_ptr[0 * 3 + 2];
63 matrix.elem_[3 * 4 + 1] = array_3x3_ptr[2 * 3 + 1]; 68 matrix.elem_[3 * 4 + 1] = array_3x3_ptr[1 * 3 + 2];
64 matrix.elem_[3 * 4 + 3] = array_3x3_ptr[2 * 3 + 2]; 69 matrix.elem_[3 * 4 + 3] = array_3x3_ptr[2 * 3 + 2];
65 return matrix; 70 return matrix;
66 } 71 }
67 72
68 jfloatArray Matrix::ToJava(JNIEnv* jni) const { 73 jfloatArray Matrix::ToJava(JNIEnv* jni) const {
69 jfloatArray matrix = jni->NewFloatArray(16); 74 jfloatArray matrix = jni->NewFloatArray(16);
70 jni->SetFloatArrayRegion(matrix, 0, 16, elem_); 75 jni->SetFloatArrayRegion(matrix, 0, 16, elem_);
71 return matrix; 76 return matrix;
72 } 77 }
73 78
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 int height, 345 int height,
341 const Matrix& matrix, 346 const Matrix& matrix,
342 jobject j_video_frame_buffer) const { 347 jobject j_video_frame_buffer) const {
343 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 348 JNIEnv* jni = AttachCurrentThreadIfNeeded();
344 return new rtc::RefCountedObject<AndroidVideoBuffer>( 349 return new rtc::RefCountedObject<AndroidVideoBuffer>(
345 jni, j_retain_id_, j_release_id_, width, height, matrix, 350 jni, j_retain_id_, j_release_id_, width, height, matrix,
346 j_video_frame_buffer); 351 j_video_frame_buffer);
347 } 352 }
348 353
349 } // namespace webrtc_jni 354 } // namespace webrtc_jni
OLDNEW
« 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