From b1854fad3adcc8817535de7f99bc9769667577c7 Mon Sep 17 00:00:00 2001 From: "nagarajan.n" Date: Wed, 19 Jul 2017 19:53:21 +0530 Subject: [PATCH] Remove loop unrolling code in onQueryYUV8 This patch removes the loop unrolling code in onQueryYUV8() to improve code readability. Bug: skia: None Change-Id: Iddbc0a114fae05234bfea39802f19a430f6c86ec Reviewed-on: https://skia-review.googlesource.com/22000 Commit-Queue: Leon Scroggins Reviewed-by: Leon Scroggins --- src/codec/SkJpegCodec.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp index 837481cc3f..bf6b6f497c 100644 --- a/src/codec/SkJpegCodec.cpp +++ b/src/codec/SkJpegCodec.cpp @@ -825,15 +825,11 @@ bool SkJpegCodec::onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpa return false; } - sizeInfo->fSizes[SkYUVSizeInfo::kY].set(dinfo->comp_info[0].downsampled_width, - dinfo->comp_info[0].downsampled_height); - sizeInfo->fSizes[SkYUVSizeInfo::kU].set(dinfo->comp_info[1].downsampled_width, - dinfo->comp_info[1].downsampled_height); - sizeInfo->fSizes[SkYUVSizeInfo::kV].set(dinfo->comp_info[2].downsampled_width, - dinfo->comp_info[2].downsampled_height); - sizeInfo->fWidthBytes[SkYUVSizeInfo::kY] = dinfo->comp_info[0].width_in_blocks * DCTSIZE; - sizeInfo->fWidthBytes[SkYUVSizeInfo::kU] = dinfo->comp_info[1].width_in_blocks * DCTSIZE; - sizeInfo->fWidthBytes[SkYUVSizeInfo::kV] = dinfo->comp_info[2].width_in_blocks * DCTSIZE; + jpeg_component_info * comp_info = dinfo->comp_info; + for (auto i : { SkYUVSizeInfo::kY, SkYUVSizeInfo::kU, SkYUVSizeInfo::kV }) { + sizeInfo->fSizes[i].set(comp_info[i].downsampled_width, comp_info[i].downsampled_height); + sizeInfo->fWidthBytes[i] = comp_info[i].width_in_blocks * DCTSIZE; + } if (colorSpace) { *colorSpace = kJPEG_SkYUVColorSpace;