| 1 | /* |
| 2 | * Copyright 2017 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 | #include "src/gpu/GrColorInfo.h" |
| 9 | |
| 10 | #include "src/core/SkColorSpacePriv.h" |
| 11 | |
| 12 | GrColorInfo::GrColorInfo( |
| 13 | GrColorType colorType, SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace) |
| 14 | : fColorSpace(std::move(colorSpace)), fColorType(colorType), fAlphaType(alphaType) { |
| 15 | // sRGB sources are very common (SkColor, etc...), so we cache that transformation |
| 16 | fColorXformFromSRGB = GrColorSpaceXform::Make(sk_srgb_singleton(), kUnpremul_SkAlphaType, |
| 17 | fColorSpace.get(), kUnpremul_SkAlphaType); |
| 18 | } |
| 19 | |
| 20 | GrColorInfo::GrColorInfo(const SkColorInfo& ci) |
| 21 | : GrColorInfo(SkColorTypeToGrColorType(ci.colorType()), |
| 22 | ci.alphaType(), |
| 23 | ci.refColorSpace()) {} |
| 24 | |
| 25 | GrColorInfo::GrColorInfo(const GrColorInfo&) = default; |
| 26 | GrColorInfo& GrColorInfo::operator=(const GrColorInfo&) = default; |
| 27 | |