Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: tests/SkColor4fTest.cpp

Issue 1726983002: Retire SkShader::kSupports4f_Flag (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: kPrefers4f_Flag Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/Sk4fGradientBase.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/effects/gradients/Sk4fGradientBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698