diff options
author | Jorge E. Moreira <jemoreira@google.com> | 2017-01-09 17:42:10 -0800 |
---|---|---|
committer | Jorge E. Moreira <jemoreira@google.com> | 2017-01-09 17:42:10 -0800 |
commit | 34040f466a2a1570d09e40bf2bc4b535181ef24d (patch) | |
tree | 0742c2a13dd9510794ea2748e5dacbf095707c27 | |
parent | db4012d8049251786be524c68d714d09c97e523a (diff) | |
download | libyuv-34040f466a2a1570d09e40bf2bc4b535181ef24d.tar.gz |
Makes ConvertToARGB rotate with every source format
Bug: 34165328
Test: Ran the AVD with the new hwcomposer in landscape orientation.
Change-Id: If9a721ac29a63e9b8187bda0425fc3435db63024
-rw-r--r-- | files/source/convert_to_argb.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/files/source/convert_to_argb.cc b/files/source/convert_to_argb.cc index aecdc80f..bccb34c3 100644 --- a/files/source/convert_to_argb.cc +++ b/files/source/convert_to_argb.cc @@ -45,8 +45,8 @@ int ConvertToARGB(const uint8* sample, size_t sample_size, int r = 0; // One pass rotation is available for some formats. For the rest, convert - // to I420 (with optional vertical flipping) into a temporary I420 buffer, - // and then rotate the I420 to the final destination buffer. + // to ARGB (with optional vertical flipping) into a temporary ARGB buffer, + // and then rotate the ARGB to the final destination buffer. // For in-place conversion, if destination crop_argb is same as source sample, // also enable temporary buffer. LIBYUV_BOOL need_buf = (rotation && format != FOURCC_ARGB) || @@ -102,10 +102,12 @@ int ConvertToARGB(const uint8* sample, size_t sample_size, crop_width, inv_crop_height); break; case FOURCC_ARGB: - src = sample + (src_width * crop_y + crop_x) * 4; - r = ARGBToARGB(src, src_width * 4, - crop_argb, argb_stride, - crop_width, inv_crop_height); + if (!need_buf && !rotation ) { + src = sample + (src_width * crop_y + crop_x) * 4; + r = ARGBToARGB(src, src_width * 4, + crop_argb, argb_stride, + crop_width, inv_crop_height); + } break; case FOURCC_BGRA: src = sample + (src_width * crop_y + crop_x) * 4; @@ -294,6 +296,11 @@ int ConvertToARGB(const uint8* sample, size_t sample_size, crop_width, abs_crop_height, rotation); } free(rotate_buffer); + } else if (rotation) { + src = sample + (src_width * crop_y + crop_x) * 4; + r = ARGBRotate(src, src_width * 4, + crop_argb, argb_stride, + crop_width, inv_crop_height, rotation); } return r; |