OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkColorSpaceXform.h" | 10 #include "SkColorSpaceXform.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 SkMatrix44 wideGamut(SkMatrix44::kUninitialized_Constructor); | 35 SkMatrix44 wideGamut(SkMatrix44::kUninitialized_Constructor); |
36 wideGamut.set3x3RowMajorf(kWideGamutRGB_toXYZD50); | 36 wideGamut.set3x3RowMajorf(kWideGamutRGB_toXYZD50); |
37 | 37 |
38 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRG
B_Named); | 38 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRG
B_Named); |
39 sk_sp<SkColorSpace> dstSpace = | 39 sk_sp<SkColorSpace> dstSpace = |
40 SkColorSpace::NewRGB(SkColorSpace::kLinear_RenderTargetGamma, wi
deGamut); | 40 SkColorSpace::NewRGB(SkColorSpace::kLinear_RenderTargetGamma, wi
deGamut); |
41 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpa
ce.get(), | 41 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpa
ce.get(), |
42 dstSpa
ce.get()); | 42 dstSpa
ce.get()); |
43 | 43 |
44 xform->apply(fWideGamutColors, colors, kNumColors, | 44 xform->apply(SkColorSpaceXform::kRGBA_F32_ColorFormat, fWideGamutColors, |
45 SkColorSpaceXform::kRGBA_F32_ColorFormat, | 45 SkColorSpaceXform::kBGRA_8888_ColorFormat, colors, kNumColo
rs, |
46 SkColorSpaceXform::kBGRA_8888_ColorFormat, kOpaque_SkAlphaT
ype); | 46 kOpaque_SkAlphaType); |
47 } | 47 } |
48 | 48 |
49 SkString onShortName() override { | 49 SkString onShortName() override { |
50 return SkString("colorspacexform"); | 50 return SkString("colorspacexform"); |
51 } | 51 } |
52 | 52 |
53 SkISize onISize() override { | 53 SkISize onISize() override { |
54 return SkISize::Make(500, 200); | 54 return SkISize::Make(500, 200); |
55 } | 55 } |
56 | 56 |
(...skipping 22 matching lines...) Expand all Loading... |
79 private: | 79 private: |
80 static constexpr int kNumColors = 10; | 80 static constexpr int kNumColors = 10; |
81 | 81 |
82 SkColor4f fSRGBColors[kNumColors]; | 82 SkColor4f fSRGBColors[kNumColors]; |
83 SkColor4f fWideGamutColors[kNumColors]; | 83 SkColor4f fWideGamutColors[kNumColors]; |
84 | 84 |
85 typedef skiagm::GM INHERITED; | 85 typedef skiagm::GM INHERITED; |
86 }; | 86 }; |
87 | 87 |
88 DEF_GM(return new ColorSpaceXformGM;) | 88 DEF_GM(return new ColorSpaceXformGM;) |
OLD | NEW |