diff options
author | raftias <raftias@google.com> | 2016-12-01 15:31:29 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-01 21:25:28 +0000 |
commit | 197e311ac9d15696fae929d8f5fcf9d93ec55e18 (patch) | |
tree | 0ffeec5bb09757f1c94a4516170d7b2615d8ca6e /src/core/SkColorSpace_A2B.h | |
parent | 35455f931c94715d6e98b2a2ab8717d125e97de3 (diff) |
Optimized gamma table inversion.
Brought calculation into a central place so the loop did not have to
recalculate everything before the previous entry to find the inverse
index. O(n) vs O(n^2). Assumes an increasing (or at least
non-decreasing) table gamma just as the previous code did.
BUG=skia:
Change-Id: I7ea200c06511b3d74745fe4a6e3dde706bbee02f
Reviewed-on: https://skia-review.googlesource.com/5402
Commit-Queue: Robert Aftias <raftias@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src/core/SkColorSpace_A2B.h')
-rw-r--r-- | src/core/SkColorSpace_A2B.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/SkColorSpace_A2B.h b/src/core/SkColorSpace_A2B.h index b42de77137..6c340c6ca3 100644 --- a/src/core/SkColorSpace_A2B.h +++ b/src/core/SkColorSpace_A2B.h @@ -85,8 +85,13 @@ public: , fGammas(std::move(gammas)) , fMatrix(SkMatrix44::kUninitialized_Constructor) , fInputChannels(fGammas->channels()) - , fOutputChannels(fGammas->channels()) - {} + , fOutputChannels(fGammas->channels()) { + for (int i = 0; i < fGammas->channels(); ++i) { + if (SkGammas::Type::kTable_Type == fGammas->type(i)) { + SkASSERT(fGammas->data(i).fTable.fSize >= 2); + } + } + } explicit Element(sk_sp<SkColorLookUpTable> colorLUT) : fType(Type::kCLUT) |