blob: 42a61b054dc59c7c738c77cf13aa70aabe08e590 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrColorSpaceInfo_DEFINED
#define GrColorSpaceInfo_DEFINED
#include "GrColorSpaceXform.h"
#include "GrTypes.h"
#include "SkColorSpace.h"
#include "SkRefCnt.h"
/** Describes the color space properties of a surface context. */
class GrColorSpaceInfo {
public:
GrColorSpaceInfo(sk_sp<SkColorSpace>, GrPixelConfig);
bool isGammaCorrect() const { return static_cast<bool>(fColorSpace); }
SkColorSpace* colorSpace() const { return fColorSpace.get(); }
sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; }
GrColorSpaceXform* colorSpaceXformFromSRGB() const;
sk_sp<GrColorSpaceXform> refColorSpaceXformFromSRGB() const {
return sk_ref_sp(this->colorSpaceXformFromSRGB());
}
// TODO: Remove or replace with SkColorType
GrPixelConfig config() const { return fConfig; }
private:
sk_sp<SkColorSpace> fColorSpace;
mutable sk_sp<GrColorSpaceXform> fColorXformFromSRGB;
GrPixelConfig fConfig;
mutable bool fInitializedColorSpaceXformFromSRGB;
};
#endif
|