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 "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkColorMatrixFilter.h" | 9 #include "SkColorMatrixFilter.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 SkPaint paint; | 150 SkPaint paint; |
151 for (const auto& rec : recs) { | 151 for (const auto& rec : recs) { |
152 uint32_t storage[200]; | 152 uint32_t storage[200]; |
153 paint.setShader(rec.fFact())->unref(); | 153 paint.setShader(rec.fFact())->unref(); |
154 // Encourage 4f context selection. At some point we may need | 154 // Encourage 4f context selection. At some point we may need |
155 // to instantiate two separate contexts for optimal 4b/4f selection. | 155 // to instantiate two separate contexts for optimal 4b/4f selection. |
156 const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr, | 156 const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr, |
157 SkShader::ContextRec::kPM4f_DstTyp e); | 157 SkShader::ContextRec::kPM4f_DstTyp e); |
158 SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage)); | 158 SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage)); |
159 SkShader::Context* ctx = paint.getShader()->createContext(contextRec, st orage); | 159 SkShader::Context* ctx = paint.getShader()->createContext(contextRec, st orage); |
160 REPORTER_ASSERT(reporter, ctx->supports4f() == rec.fSupports4f); | 160 if (rec.fSupports4f) { |
reed1
2016/02/24 03:01:13
I think we can even skip this, since all shaders "
| |
161 if (ctx->supports4f()) { | |
162 const int N = 100; | 161 const int N = 100; |
163 SkPM4f buffer4f[N]; | 162 SkPM4f buffer4f[N]; |
164 ctx->shadeSpan4f(0, 0, buffer4f, N); | 163 ctx->shadeSpan4f(0, 0, buffer4f, N); |
165 SkPMColor buffer4b[N]; | 164 SkPMColor buffer4b[N]; |
166 ctx->shadeSpan(0, 0, buffer4b, N); | 165 ctx->shadeSpan(0, 0, buffer4b, N); |
167 compare_spans(buffer4f, buffer4b, N, reporter, rec.fTolerance); | 166 compare_spans(buffer4f, buffer4b, N, reporter, rec.fTolerance); |
168 } | 167 } |
169 ctx->~Context(); | 168 ctx->~Context(); |
170 } | 169 } |
171 } | 170 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 // | 235 // |
237 DEF_TEST(Color4f_xfermode_proc4f, reporter) { | 236 DEF_TEST(Color4f_xfermode_proc4f, reporter) { |
238 // TODO: extend xfermodes so that all cases can be tested. | 237 // TODO: extend xfermodes so that all cases can be tested. |
239 // | 238 // |
240 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; + +mode) { | 239 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; + +mode) { |
241 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode); | 240 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode); |
242 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode); | 241 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode); |
243 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f)); | 242 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f)); |
244 } | 243 } |
245 } | 244 } |
OLD | NEW |