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

Side by Side Diff: tests/SkColor4fTest.cpp

Issue 1877483002: Add clone to Stage. Rename place to mix and PolymorphicUnion to Stage. Cleanup. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address review comments. Created 4 years, 8 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/core/SkLinearBitmapPipeline_sample.h ('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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 { make_color_sh, true, 1.0f/255 }, 146 { make_color_sh, true, 1.0f/255 },
147 // PMColor 4f gradients are interpolated in 255-multiplied values, so we need a 147 // PMColor 4f gradients are interpolated in 255-multiplied values, so we need a
148 // slightly relaxed tolerance to accommodate the cumulative precision de viation. 148 // slightly relaxed tolerance to accommodate the cumulative precision de viation.
149 { make_grad_sh, true, 1.001f/255 }, 149 { make_grad_sh, true, 1.001f/255 },
150 { make_image_sh, false, 1.0f/255 }, 150 { make_image_sh, false, 1.0f/255 },
151 { make_cf_sh, true, 1.0f/255 }, 151 { make_cf_sh, true, 1.0f/255 },
152 }; 152 };
153 153
154 SkPaint paint; 154 SkPaint paint;
155 for (const auto& rec : recs) { 155 for (const auto& rec : recs) {
156 uint32_t storage[300]; 156 uint32_t storage[400];
157 paint.setShader(rec.fFact()); 157 paint.setShader(rec.fFact());
158 // Encourage 4f context selection. At some point we may need 158 // Encourage 4f context selection. At some point we may need
159 // to instantiate two separate contexts for optimal 4b/4f selection. 159 // to instantiate two separate contexts for optimal 4b/4f selection.
160 const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr, 160 const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr,
161 SkShader::ContextRec::kPM4f_DstTyp e); 161 SkShader::ContextRec::kPM4f_DstTyp e);
162 SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage)); 162 SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage));
163 SkShader::Context* ctx = paint.getShader()->createContext(contextRec, st orage); 163 SkShader::Context* ctx = paint.getShader()->createContext(contextRec, st orage);
164 if (rec.fSupports4f) { 164 if (rec.fSupports4f) {
165 const int N = 100; 165 const int N = 100;
166 SkPM4f buffer4f[N]; 166 SkPM4f buffer4f[N];
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // 240 //
241 DEF_TEST(Color4f_xfermode_proc4f, reporter) { 241 DEF_TEST(Color4f_xfermode_proc4f, reporter) {
242 // TODO: extend xfermodes so that all cases can be tested. 242 // TODO: extend xfermodes so that all cases can be tested.
243 // 243 //
244 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; + +mode) { 244 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; + +mode) {
245 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode); 245 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode);
246 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode); 246 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode);
247 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f)); 247 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f));
248 } 248 }
249 } 249 }
OLDNEW
« no previous file with comments | « src/core/SkLinearBitmapPipeline_sample.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698