OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkColorSpace_Base.h" | 9 #include "SkColorSpace_Base.h" |
10 #include "SkColorSpacePriv.h" | 10 #include "SkColorSpacePriv.h" |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 build_gamma_tables(fSrcGammaTables, fSrcGammaTableStorage, 256, srcSpace, kT
oLinear); | 1108 build_gamma_tables(fSrcGammaTables, fSrcGammaTableStorage, 256, srcSpace, kT
oLinear); |
1109 build_gamma_tables(fDstGammaTables, fDstGammaTableStorage, kDstGammaTableSiz
e, dstSpace, | 1109 build_gamma_tables(fDstGammaTables, fDstGammaTableStorage, kDstGammaTableSiz
e, dstSpace, |
1110 kFromLinear); | 1110 kFromLinear); |
1111 } | 1111 } |
1112 | 1112 |
1113 template <SkGammaNamed kDst, ColorSpaceMatch kCSM> | 1113 template <SkGammaNamed kDst, ColorSpaceMatch kCSM> |
1114 void SkColorSpaceXform_Base<kDst, kCSM> | 1114 void SkColorSpaceXform_Base<kDst, kCSM> |
1115 ::apply(void* dst, const uint32_t* src, int len, SkColorType dstColorType, SkAlp
haType dstAlphaType) | 1115 ::apply(void* dst, const uint32_t* src, int len, SkColorType dstColorType, SkAlp
haType dstAlphaType) |
1116 const | 1116 const |
1117 { | 1117 { |
| 1118 // F16 is always treated as linear. |
| 1119 SkASSERT(kRGBA_F16_SkColorType != dstColorType || kLinear_SkGammaNamed == kD
st); |
| 1120 |
1118 if (kFull_ColorSpaceMatch == kCSM) { | 1121 if (kFull_ColorSpaceMatch == kCSM) { |
1119 switch (dstAlphaType) { | 1122 switch (dstAlphaType) { |
1120 case kPremul_SkAlphaType: | 1123 case kPremul_SkAlphaType: |
1121 // We can't skip the xform since we need to perform a premultipl
y in the | 1124 // We can't skip the xform since we need to perform a premultipl
y in the |
1122 // linear space. | 1125 // linear space. |
1123 break; | 1126 break; |
1124 default: | 1127 default: |
1125 switch (dstColorType) { | 1128 switch (dstColorType) { |
1126 case kRGBA_8888_SkColorType: | 1129 case kRGBA_8888_SkColorType: |
1127 return (void) memcpy(dst, src, len * sizeof(uint32_t)); | 1130 return (void) memcpy(dst, src, len * sizeof(uint32_t)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 SkASSERT(false); | 1207 SkASSERT(false); |
1205 return; | 1208 return; |
1206 } | 1209 } |
1207 } | 1210 } |
1208 | 1211 |
1209 std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>&
space) { | 1212 std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>&
space) { |
1210 return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_Base | 1213 return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_Base |
1211 <kNonStandard_SkGammaNamed, kNone_ColorSpaceMatch> | 1214 <kNonStandard_SkGammaNamed, kNone_ColorSpaceMatch> |
1212 (space, SkMatrix::I(), space)); | 1215 (space, SkMatrix::I(), space)); |
1213 } | 1216 } |
OLD | NEW |