aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkColorSpaceXform.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-07-21 13:19:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-21 13:19:04 -0700
commit959d45b43357a40854938586c303177c6aa53220 (patch)
treedd94f8f9daf6c408deb66ca885c7d872635f064d /src/core/SkColorSpaceXform.cpp
parent4eaa320d5718d6b4ba45341c2f2e5206660fdf94 (diff)
Miscellaneous color space refactors
(1) Use float matrix[16] everywhere (enables future code sharing). (2) SkColorLookUpTable refactors *** Store in a single allocation (like SkGammas) *** Eliminate fOutputChannels (we always require 3, and probably always will) (3) Change names of read_big_endian_* helpers BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2166093003 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2166093003
Diffstat (limited to 'src/core/SkColorSpaceXform.cpp')
-rw-r--r--src/core/SkColorSpaceXform.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/core/SkColorSpaceXform.cpp b/src/core/SkColorSpaceXform.cpp
index 1b5d7e6a1e..e6bde616c3 100644
--- a/src/core/SkColorSpaceXform.cpp
+++ b/src/core/SkColorSpaceXform.cpp
@@ -490,32 +490,11 @@ std::unique_ptr<SkColorSpaceXform> SkColorSpaceXform::New(const sk_sp<SkColorSpa
///////////////////////////////////////////////////////////////////////////////////////////////////
-// TODO (msarett):
-// Once SkFastXform supports translation, delete this function and use asRowMajorf().
-static void build_src_to_dst(float srcToDstArray[12], const SkMatrix44& srcToDstMatrix) {
- // Build the following row major matrix:
- // rX gX bX 0
- // rY gY bY 0
- // rZ gZ bZ 0
- srcToDstArray[0] = srcToDstMatrix.getFloat(0, 0);
- srcToDstArray[1] = srcToDstMatrix.getFloat(0, 1);
- srcToDstArray[2] = srcToDstMatrix.getFloat(0, 2);
- srcToDstArray[3] = 0.0f;
- srcToDstArray[4] = srcToDstMatrix.getFloat(1, 0);
- srcToDstArray[5] = srcToDstMatrix.getFloat(1, 1);
- srcToDstArray[6] = srcToDstMatrix.getFloat(1, 2);
- srcToDstArray[7] = 0.0f;
- srcToDstArray[8] = srcToDstMatrix.getFloat(2, 0);
- srcToDstArray[9] = srcToDstMatrix.getFloat(2, 1);
- srcToDstArray[10] = srcToDstMatrix.getFloat(2, 2);
- srcToDstArray[11] = 0.0f;
-}
-
template <SkColorSpace::GammaNamed Dst>
SkFastXform<Dst>::SkFastXform(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44& srcToDst,
const sk_sp<SkColorSpace>& dstSpace)
{
- build_src_to_dst(fSrcToDst, srcToDst);
+ srcToDst.asRowMajorf(fSrcToDst);
build_gamma_tables(fSrcGammaTables, fSrcGammaTableStorage, 256, srcSpace, kToLinear);
build_gamma_tables(fDstGammaTables, fDstGammaTableStorage, SkDefaultXform::kDstGammaTableSize,
dstSpace, kFromLinear);
@@ -615,7 +594,7 @@ static void interp_3d_clut(float dst[3], float src[3], const SkColorLookUpTable*
const int n111 = n110 + n001;
// Base ptr into the table.
- float* ptr = &colorLUT->fTable[ix*n001 + iy*n010 + iz*n100];
+ const float* ptr = &(colorLUT->table()[ix*n001 + iy*n010 + iz*n100]);
// The code below performs a tetrahedral interpolation for each of the three
// dst components. Once the tetrahedron containing the interpolation point is