aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar nagarajan.n <nagarajan.n@samsung.com>2017-07-19 19:53:21 +0530
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-07 14:42:04 +0000
commitb1854fad3adcc8817535de7f99bc9769667577c7 (patch)
tree31de40a424d273e73be40e36b9aae9ea5c657c2f
parent67e3429ce0df02dbdda128c978b6ceee1655b18b (diff)
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 <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
-rw-r--r--src/codec/SkJpegCodec.cpp14
1 files 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;