OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 { 0.5, 0.5, 0.5, 1 }, | 105 { 0.5, 0.5, 0.5, 1 }, |
106 }; | 106 }; |
107 | 107 |
108 SkPaint paint; | 108 SkPaint paint; |
109 SkRect r = SkRect::MakeWH(100, 100); | 109 SkRect r = SkRect::MakeWH(100, 100); |
110 | 110 |
111 for (const auto& c4 : colors) { | 111 for (const auto& c4 : colors) { |
112 sk_sp<SkShader> shaders[] { | 112 sk_sp<SkShader> shaders[] { |
113 SkShader::MakeColorShader(c4, nullptr), | 113 SkShader::MakeColorShader(c4, nullptr), |
114 SkShader::MakeColorShader(c4, SkColorSpace::NewNamed(SkColorSpace::k
SRGB_Named)), | 114 SkShader::MakeColorShader(c4, SkColorSpace::NewNamed(SkColorSpace::k
SRGB_Named)), |
115 SkShader::MakeColorShader(c4, SkColorSpace::NewRGB(SkColorSpace::kLi
near_GammaNamed, | 115 SkShader::MakeColorShader(c4, |
116 mat)), | 116 SkColorSpace::NewRGB(SkColorSpace::kLinear_RenderTargetGamma
, mat)), |
117 }; | 117 }; |
118 | 118 |
119 canvas->save(); | 119 canvas->save(); |
120 for (const auto& s : shaders) { | 120 for (const auto& s : shaders) { |
121 paint.setShader(s); | 121 paint.setShader(s); |
122 canvas->drawRect(r, paint); | 122 canvas->drawRect(r, paint); |
123 canvas->translate(r.width() * 6 / 5, 0); | 123 canvas->translate(r.width() * 6 / 5, 0); |
124 } | 124 } |
125 canvas->restore(); | 125 canvas->restore(); |
126 canvas->translate(0, r.height() * 6 / 5); | 126 canvas->translate(0, r.height() * 6 / 5); |
127 } | 127 } |
128 } | 128 } |
OLD | NEW |