blob: 6c3841169227873ee00dc0f4aa7bad323897237c [file] [log] [blame]
Mike Klein6968f9c2018-05-24 12:33:23 -04001/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkColorSpaceXformSteps_DEFINED
9#define SkColorSpaceXformSteps_DEFINED
10
11#include "SkColorSpace.h"
12#include "SkImageInfo.h"
13
14struct SkColorSpaceXformSteps {
15 SkColorSpaceXformSteps(SkColorSpace* src, SkAlphaType srcAT,
16 SkColorSpace* dst);
17
Mike Klein2f2a7032018-06-05 12:24:55 -040018 static SkColorSpaceXformSteps UnpremulToUnpremul(SkColorSpace* src, SkColorSpace* dst) {
19 // The need to transform unpremul to unpremul comes up often enough that it's
20 // nice to centralize it here, especially because this use of kOpaque_SkAlphaType
21 // isn't the most intuitive. We basically want to always skip unpremul and premul.
22 return SkColorSpaceXformSteps(src, kOpaque_SkAlphaType, dst);
23 }
24
Mike Klein97918ff2018-05-25 12:55:58 -040025 bool unpremul;
26 bool linearize;
Mike Klein6968f9c2018-05-24 12:33:23 -040027 bool gamut_transform;
Mike Klein97918ff2018-05-25 12:55:58 -040028 bool encode;
Mike Klein6968f9c2018-05-24 12:33:23 -040029 bool premul;
30
Mike Klein34ab0f22018-05-30 11:07:47 -040031 SkColorSpaceTransferFn srcTF, // Apply for linearize.
32 dstTFInv; // Apply for encode.
Mike Klein7d8276c2018-05-24 13:59:58 -040033 float src_to_dst_matrix[9]; // Apply this 3x3 row-major matrix for gamut_transform.
Mike Klein6968f9c2018-05-24 12:33:23 -040034};
35
36
37
38#endif//SkColorSpaceXformSteps_DEFINED