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 "GrColorSpaceXform.h" | 8 #include "GrColorSpaceXform.h" |
9 #include "SkColorSpace.h" | 9 #include "SkColorSpace.h" |
10 #include "SkColorSpace_Base.h" | 10 #include "SkColorSpace_Base.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor); | 52 SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor); |
53 srcToDst.setConcat(as_CSB(dst)->fromXYZD50(), src->toXYZD50()); | 53 srcToDst.setConcat(as_CSB(dst)->fromXYZD50(), src->toXYZD50()); |
54 | 54 |
55 if (matrix_is_almost_identity(srcToDst)) { | 55 if (matrix_is_almost_identity(srcToDst)) { |
56 return nullptr; | 56 return nullptr; |
57 } | 57 } |
58 | 58 |
59 return sk_make_sp<GrColorSpaceXform>(srcToDst); | 59 return sk_make_sp<GrColorSpaceXform>(srcToDst); |
60 } | 60 } |
61 | 61 |
| 62 bool GrColorSpaceXform::Equals(const GrColorSpaceXform* a, const GrColorSpaceXfo
rm* b) { |
| 63 if (a == b) { |
| 64 return true; |
| 65 } |
| 66 |
| 67 if (!a || !b) { |
| 68 return false; |
| 69 } |
| 70 |
| 71 return a->fSrcToDst == b->fSrcToDst; |
| 72 } |
| 73 |
62 GrColor4f GrColorSpaceXform::apply(const GrColor4f& srcColor) { | 74 GrColor4f GrColorSpaceXform::apply(const GrColor4f& srcColor) { |
63 GrColor4f result; | 75 GrColor4f result; |
64 fSrcToDst.mapScalars(srcColor.fRGBA, result.fRGBA); | 76 fSrcToDst.mapScalars(srcColor.fRGBA, result.fRGBA); |
65 return result; | 77 return result; |
66 } | 78 } |
OLD | NEW |