Flutter Engine
The Flutter Engine
GrColorInfo.cpp
Go to the documentation of this file.
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
9
13
14#include <utility>
15
18 : fColorSpace(std::move(colorSpace)), fColorType(colorType), fAlphaType(alphaType) {
19 // sRGB sources are very common (SkColor, etc...), so we cache that transformation
21 fColorSpace.get(), kUnpremul_SkAlphaType);
22}
23
26 ci.alphaType(),
27 ci.refColorSpace()) {}
28
29GrColorInfo::GrColorInfo() = default;
33
34bool GrColorInfo::operator==(const GrColorInfo& that) const {
35 return fColorType == that.fColorType &&
36 fAlphaType == that.fAlphaType &&
37 SkColorSpace::Equals(fColorSpace.get(), that.fColorSpace.get());
38}
39
41 return GrColorInfo(ct, fAlphaType, this->refColorSpace());
42}
43
45 return fColorSpace && fColorSpace->gammaIsLinear();
46}
47
48SkColorSpace* GrColorInfo::colorSpace() const { return fColorSpace.get(); }
49sk_sp<SkColorSpace> GrColorInfo::refColorSpace() const { return fColorSpace; }
GrColorType
Definition: GrTypesPriv.h:540
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
Definition: GrTypesPriv.h:629
SkColorType fColorType
kUnpremul_SkAlphaType
SkAlphaType fAlphaType
SkAlphaType
Definition: SkAlphaType.h:26
SkColorSpace * sk_srgb_singleton()
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
bool isLinearlyBlended() const
Definition: GrColorInfo.cpp:44
bool operator==(const GrColorInfo &that) const
Definition: GrColorInfo.cpp:34
sk_sp< SkColorSpace > refColorSpace() const
Definition: GrColorInfo.cpp:49
SkColorSpace * colorSpace() const
Definition: GrColorInfo.cpp:48
GrColorInfo & operator=(const GrColorInfo &)
GrColorInfo makeColorType(GrColorType ct) const
Definition: GrColorInfo.cpp:40
static sk_sp< GrColorSpaceXform > Make(SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)
bool gammaIsLinear() const
static bool Equals(const SkColorSpace *, const SkColorSpace *)
T * get() const
Definition: SkRefCnt.h:303
Definition: ref_ptr.h:256