diff options
author | nagarajan.n <nagarajan.n@samsung.com> | 2017-07-10 15:02:00 +0530 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-07 14:44:31 +0000 |
commit | 6e17b6f20fa474b917891d0e2a5736fad98af84e (patch) | |
tree | b5752093329fc46c79d3d0d5aac1485df5fc5172 /src/codec | |
parent | b1854fad3adcc8817535de7f99bc9769667577c7 (diff) |
Remove loop unrolling code in load_gamut
This patch removes the loop unrolling code in load_gamut()
for improving the code readability.
Bug: skia: None
Change-Id: I749a3351a9f570347946a419d31efffa85818267
Reviewed-on: https://skia-review.googlesource.com/22001
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec')
-rw-r--r-- | src/codec/SkAndroidCodec.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp index f5c93f2445..c245f1d7f0 100644 --- a/src/codec/SkAndroidCodec.cpp +++ b/src/codec/SkAndroidCodec.cpp @@ -25,15 +25,11 @@ static void load_gamut(SkPoint rgb[], const SkMatrix44& xyz) { // rx = rX / (rX + rY + rZ) // ry = rY / (rX + rY + rZ) // gx, gy, bx, and gy are calulcated similarly. - float rSum = xyz.get(0, 0) + xyz.get(1, 0) + xyz.get(2, 0); - float gSum = xyz.get(0, 1) + xyz.get(1, 1) + xyz.get(2, 1); - float bSum = xyz.get(0, 2) + xyz.get(1, 2) + xyz.get(2, 2); - rgb[0].fX = xyz.get(0, 0) / rSum; - rgb[0].fY = xyz.get(1, 0) / rSum; - rgb[1].fX = xyz.get(0, 1) / gSum; - rgb[1].fY = xyz.get(1, 1) / gSum; - rgb[2].fX = xyz.get(0, 2) / bSum; - rgb[2].fY = xyz.get(1, 2) / bSum; + for (int rgbIdx = 0; rgbIdx < 3; rgbIdx++) { + float sum = xyz.get(0, rgbIdx) + xyz.get(1, rgbIdx) + xyz.get(2, rgbIdx); + rgb[rgbIdx].fX = xyz.get(0, rgbIdx) / sum; + rgb[rgbIdx].fY = xyz.get(1, rgbIdx) / sum; + } } /** |